Open zachshelter opened 7 years ago
const chart = new G2.Chart({ id: chartId, height: 320, forceFit: true, plotCfg: { margin: [20, 120, 40, 50] } }); var frame = new G2.Frame(dataSource); chart.source(frame, { date: { type: 'time', nice: false, alias: ' ' }, originCount: { type: 'linear' } }); chart.tooltip({ crosshairs: true, map: { value: 'originCount' } }); chart.legend({ title: null }); chart.area().position('date*totalCount').color('alarmCategory').shape('smooth'); chart.render();
tooltip始终显示的是 totalCount的值,而无法显示originCount的值是为什么呢?
因为 originCount 没有参与到图形语法中,你可以这样;
chart.tooltip({ crosshairs: true }); chart.legend({ title: null }); chart.area().position('date*totalCount').color('alarmCategory').shape('smooth').tooltip('originCount');
https://antv.alipay.com/g2/api/geom.html#tooltip
tooltip始终显示的是 totalCount的值,而无法显示originCount的值是为什么呢?