1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| const chart = new F2.Chart(config); chart.legend(false); chart.point() .position('date*weight') .size('tag', function (val) { return val ? 3 : 0; }) .style('tag', { fill: function fill(val) { return '#0ac7d9' }, stroke: '#fff', lineWidth: 1 }); chart.source(chartData, { date: { range: [0, 1], type: 'timeCat', mask: 'MM-DD' }, weight: { max: 120, tickCount: 5, alias: '体重(kg)' } }); chart.tooltip({ showCrosshairs: true, showTitle: false, showItemMarker: false, snap: true, crosshairsType: 'xy', onShow: function onShow(ev) { return (ev.items = ev.items.splice(1)); }, }); chart.area().position('date*weight').color('#0ac7d9').shape('smooth').adjust('stack'); chart.line().position('date*weight').color('#0ac7d9').shape('smooth').adjust('stack'); chart.render(); f2Chart = chart; return chart;
|