SVG Fundamentals
This example demonstrates the fundamental structure of a VizHub V3 visualization, displaying the text “Hello God World!” centered within a container using inline HTML and CSS. The code exports a `main` function that receives a `container` DIV element, whose `clientWidth` and `clientHeight` can be measured for responsive layout. A `fontSize` variable is set to 222 pixels and rendered using a template literal inside `container.innerHTML`. The example introduces the runtime’s key patterns for state management and hot reloading, serving as a starting point for building interactive SVG-based charts.
AI-generated descriptionA blank slate starting point showing the "Hello World" for the VizHub V3 Runtime Environment, which supports continuous hot reloading with interactive widgets.
- There is no
index.html- that's what triggers the V3 Runtime - The entry point is the
mainfunction exported fromindex.js - The
mainfunction takes an argumentcontainer, a DIV that has measurable dimensions usingclientWidthandclientHeight - The second argument to
mainis an options object containingstateandsetState. - The state of the application is stored in
state, which is initialized as an empty object{}. - The
setStatefunction can be called with a function that uses the previous state to create a new state object using immutable update patterns. - For an interactive example, see Mouse Follower.
Full course playlist: YouTube: Constructing Visualization 2024.