-
Notifications
You must be signed in to change notification settings - Fork 351
Migration Guide to v2
Jae Sung Park edited this page Jun 16, 2020
·
11 revisions
There're 2 main changes to migrate v2
.
NOTE: If you haven't read v2 CHANGELOG, checkout the detailed changes before continuing with this document.
- All callback-ish options' context has been updated to bound to the current chart instance by default.
- Those callback options where passing a
context
param, was removed.
tooltip: {
position: function() {
this; // <-- current chart instance
},
// v1
onshow: function(ctx, selectedData) {
ctx;
},
// v2
onshow: function(selectedData) {
this;
}
}
// v1
import bb from "billboard.js";
bb.generate({
...,
data: {
type: "line",
// or spcifying type for each data
types: {
data1: "bar",
data1: "area-spline"
}
}
});
v2
, every chart types modules will named exported and just import only used chart types modules.
This will make beneficial tree-shake unused codes making smaller the bundle size.
// v2 - import used chart types only
import bb, {
area,
areaLineRange,
areaSpline,
areaSplineRange,
areaStep,
bar,
bubble,
donut,
gauge,
line,
pie,
radar,
scatter,
spline,
step
}
bb.generate({
...,
data: {
// by calling `line()`, will make internally extend 'line' type related functionality.
// line() will return "line" string.
type: line(),
// or spcifying type for each data
types: {
data1: bar(),
data1: areaSpline()
}
}
});
If data.type
option not specified, v1
treat as "line" type by default.
// v1
import bb from "billboard.js";
bb.generate({
...,
data: {
/// There's no need to explicitly specify 'data.type' option for 'line'
// type: "line",
}
});
As of the changes in chart types modules(named exports), need specify explicitly data.type/data.types
option value.
// v2
import bb, {line} from "billboard.js";
bb.generate({
...,
data: {
/// Specify 'data.type' option value
type: line(),
}
});
- Why we decided to start billboard.js?
- Comparison table
- How to migrate from C3.js?
- Who's using billboard.js
- Third party applications
- Themes
- Roadmap
- Architecture & Event
- Plugin Interface
- Release workflow
- How behaves for dynamic loading?
- How tooltip behaves on grouped option?
- How to load as ESM directly from the browser?
- How to implement realtime chart?
- How to bundle for legacy browsers?
- How to generate chart image in Node.js environment?
- Understanding padding