Stacked Stream
Info - How to setup Vizzu
In HTML
, create a placeholder element that will contain the rendered chart.
<html>
<body>
<div id="myVizzu">
</div>
</body>
</html>
In JavaScript
, initialize and configure the chart:
import Vizzu from 'https://cdn.jsdelivr.net/npm/vizzu@0.17/dist/vizzu.min.js'
import {
data
} from 'https://lib.vizzuhq.com/0.17/assets/data/music_industry_history_1.js'
let chart = new Vizzu('myVizzu')
chart.initializing
chart.animate({
data
})
This is a 2-step animation:
1st: set the Split parameter to true
2nd:
- move the Measure to the X-axis
- set the Align parameter 'center'
- set the Split parameter to false
- arrange the markers in reverse order
- switch the Geometry from Area to Rectangle
chart.on('plot-axis-label-draw', (event) => {
const year = parseFloat(event.detail.text)
if (!event.detail.text.includes('$') && !isNaN(year) && year % 5 !== 0)
event.preventDefault()
});
chart.animate({
config: {
"channels": {
"x": "Year",
"y": {
"set": [
"Revenue",
"Format"
],
"align": "center"
},
"color": "Format"
},
"geometry": "area"
},
style: {
"plot": {
"xAxis": {
"label": {
"angle": 0
}
},
"yAxis": {
"label": {
"numberScale": "K, M, B, T"
}
}
}
}
});
chart.animate({});
chart.animate({
config: {
"channels": {
"y": {
"set": [
"Revenue",
"Year"
],
"align": "none",
"split": false
},
"x": {
"set": [
"Format"
],
"sort": "byValue",
"reverse": true
}
},
"geometry": "rectangle"
},
style: {
"plot": {
"xAxis": {
"label": {
"angle": null
}
}
}
}
});
chart.feature('tooltip', true);