Getting started with the SDK
You'll need to have Node and NPM installed on your machine to install the Flourish SDK.
Install the SDK
npm install -g @flourish/sdk
Create a new template
flourish new my_template
Run a template
cd my_template
and flourish run
. Your project should now be running on localhost:1685
. You should see an empty preview window and a settings panel on the right-hand side.
Edit a template
First, open src/index.js
, and you'll see the top-level Flourish structure:
- the
data
object, that's where user-editable data tables will be stored - the
state
object, which stores the visualization's current state - the
draw()
function, which is called once when the visualization loads - the
update()
function, which gets called every time the data or state changes
Publish a template
cd my_template
and flourish publish
Next steps
You should have your first Flourish project up and running.
- For more information about which files were just created and what they do, have a look at the Flourish template file structure
- If you wish to explore more SDK commands beyond
flourish new
andflourish run
, have a look at the SDK commands overview
In the next pages we are going to look at how the settings panel and data selection work.