Vizabi documentation
What is Vizabi?
Gapminder Vizabi is our framework for developing maintainable visual exploration tools. It has support for mobile devices, responsiveness, localization, embedding and unified data schema.
You can freely use Vizabi to:
- embed our chart into your web page (and modify the options if you like);
- create a new chart based on your data;
- extend any of our charts to create your own, or create one from scratch.
Downloading
See the changelog to keep track of what’s new in the current version.
There are different alternatives for downloading the Vizabi library files:
-
Direct Download , the zip archive contains JavaScript and CSS files required to run Vizabi.
-
Via NPM package manager using:
Embedding
Bubble chart
You can embed a Vizabi tool on your page or blog and tell your story with our graph:
In the following example, Vizabi BubbleChart will appear in the div placeholder
Line chart
Similarly, you can also embed our line chart.
In the following example, Vizabi LineChart will appear in the div placeholder
Responsiveness
Responsiveness
You can also embed the chart in a placeholder with flexible width. Resize the browser window to see the effect on the previous chart or view the example on Codepen. Styling and layouting of the bubble chart tool will change.
If on a mobile, just flip your device.
Tuning
Colors
Vizabi tools are crafted to be highly customisable. You can enable or disable features and do all sorts of tuning. Let’s hack the color of regions.
Vizabi Initialization:
This state → marker → color → palette sequence is rather obscure. Read the bubble chart default state here to see what is possible to change.
Indicators
One strong side of Vizabi framework is that you can change the displayed indicators as easily as you change colors. Let’s set X axis to show population and color to show life expectancy:
Entities
We can also select which entities will be visible on the chart. In the next example we make the graph display only the Nordics and color them so that they look different:
Language
Vizabi framework supports localisation. In the following example we switch the language to Swedish and provide a few language strings:
The same customization options (color, entities, indicator, language) also work for the other charts. Learn more about the available options for line chart or bar chart.
Creating own tool
Read our blog post: Creating your own tool
Vizabi Framework
As a framework, Vizabi provides a number of features in order to ease development of new tools, while maintaining consistency between them.
When you add Vizabi to a page, Vizabi
will be added to the global scope.
You can use it to initialize existing tools, like the BubbleChart or LineChart, or extend the framework with new functionality.
Vizabi.Class
Provides basic prototype inheritance to all Vizabi classes. It also provides the useful method _super
, which can be used to call the super class method.
It also allows classes to be registered in collections. This is particularly useful when defining reusable components.
Vizabi.utils
Provides basic utility functions. See all here. Example:
Vizabi.Promise
Basic promises implementation. Example:
Vizabi.Events
Base class for events. It provides useful functionality such as on
and trigger
:
It also allows for more advanced binding formats and triggering multiple events:
Vizabi.Model
Base class for models. It extends Vizabi.Events
. Models come with basic setters and getters. It also triggers special events.
There are some special models that we call hooks. They have the properties use
and which
and they are used to bind a model to data. These types of models have super powers. They can request data and map data points. There’s a section dedicated to these types of models.
Extending Vizabi.Model
Vizabi comes with many built-in models/hooks. You can find them under src/models
. All of them extend Vizabi.Model
. You can also create your own model like this:
And you can register your model (if reusable):
Vizabi built-in models use the later syntax. You can also see all registered models with Vizabi.Model.getCollection()
.
Validation
All models execute validation
after any change. This is useful to guarantee consistency. Check out the example below
Vizabi.Tool
Vizabi tools are the ultimate wrapper, the final packaging of our components. Think of it as an app. Vizabi.Tool
extends Vizabi.Component
, so they are essentially a component (which means they can render and include components) with an extra touch.
Vizabi tools have default_options
, which basically describe the entire model structure of the tool and include other models. Moreover, they have a special model and template. Finally, they have their own validate
method which allows for cross model validation.
For more details, checkout how LineChart is implemented.
Built-in tools
Vizabi currently ships with three built-in Tools: BubbleChart, LineChart and BarChart.
You can initialize registered tools with the following:
Contributing
You can be part of our adventure
You can run Vizabi source code on your machine, and contribute to the development of tools or the framework.
Here are some of the things we would love to improve:
- Development of awesome visualization tools
- Improvement of QA and testing routines
- More readers that support various data formats
- More buttons and UI controls
- Offline version for Windows and Mac