sparklines.js
是用 TypeScript 开发的迷你图。
<div id="line" >line loading</div>
sparklines(document.getElementById('line'), { values: [5, 6, 7, 9, 9, 5, 3, 2, 2, 4, -6, 7], });
<div id="bar" >bar loading</div>
sparklines(document.getElementById('bar'), { values: [5, 6, 7, 9, 9, 5, 3, 2, 2, 4, -6, 7], type: 'bar' });
<div id="pie" >pie loading</div>
sparklines(document.getElementById('pie'), { values: [5, 6, 7, 9, 9, 5, 3, 2, 2, 4, -6, 7], type: 'pie' });
<div id="line" >line loading</div>
const changelineEl = document.getElementById('changeline'); const changeline = sparklines(changelineEl, { values: [ 2, 4, -6, 7], }); var linebtn = document.getElementById('linebtn'); linebtn.onclick = () => { const { render } = changeline; render(changelineEl, { values: [5, 6, 7, 9, 7], type: 'pie' }); };