Branch for next major release 2.0.
DO NOT use for production.
# Run install command from shell
$ npm install git+https://github.com/naver/billboard.js.git#v2 --save
- Move codebase to TypeScript
- Restructure of file system & class architecture
- Make smaller build & run faster
- Do not break backward compatibility
Reorganized selection
and state
variables. (Note: Even is accessible, do not use nor access private values)
- All states are member of
state
prop. - All selections are member of
$el
prop.
const chart = bb.generate({});
chart.internal.width;
// --> chart.internal.state.width
chart.internal.selectChart;
// --> chart.internal.$el.chart
When chart is instantiated, APIs were assigned as own member to the instance. The reason mainly comes to handle namespaced APIs, like .data.shown()
.
const chart = bb.generate({});
chart;
1.x
was extending methods from Chart.prototype, to its instance.
// 1.x
Chart { ... }
plugins: []
internal: ChartInternal {api: Chart, config: {…}, data: {…}, cache: {…}, axes: {…}, …}
$: {chart: Selection, svg: Selection, defs: Selection, main: Selection, tooltip: Selection, …}
element: div.bb
focus: Æ’ ()
defocus: Æ’ ()
...
2.x
avoid extending as possible. Only will extend those namespaced APIs to keep the backward compatibility.
// 2.x
Chart { ... }
plugins: []
internal: ChartInternal {api: Chart, config: {…}, cache: Cache, state: {…}, charts: Array(1), …}
axis: {labels: Æ’, min: Æ’, max: Æ’, range: Æ’}
data: Æ’ ()
xgrids: Æ’ ()
ygrids: Æ’ ()
legend: {show: Æ’, hide: Æ’}
regions: Æ’ ()
tooltip: {show: Æ’, hide: Æ’}
zoom: Æ’ ()
$: {chart: Selection, svg: Selection, defs: Selection, main: Selection, tooltip: Selection, …}
element: div.bb