We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
如果代码打不开,可以看一下下面的,root更一下就可以了
import F2 from '@antv/f2'; import _ from 'lodash'; fetch('https://gw.alipayobjects.com/os/antfincdn/OVMtvjbnut/series-line.json') .then(res => res.json()) .then(data => { const chart = new F2.Chart({ id: 'root', pixelRatio: window.devicePixelRatio }); chart.source(data); chart.scale('date', { type: 'timeCat', tickCount: 3 }); chart.scale('value', { tickCount: 5 }); chart.axis('date', { label: function label(text, index, total) { // 只显示每一年的第一天 const textCfg = {}; if (index === 0) { textCfg.textAlign = 'left'; } else if (index === total - 1) { textCfg.textAlign = 'right'; } return textCfg; } }); chart.tooltip({ custom: true, // 自定义 tooltip 内容框 showXTip: true, showYTip: true, snap: true, crosshairsType: 'xy', crosshairsStyle: { lineDash: [2] }, onChange: function onChange(obj) { const legend = chart.get('legendController').legends.top[0]; const tooltipItems = obj.items; const legendItems = legend.items; const map = {}; legendItems.forEach(function(item) { map[item.name] = _.clone(item); }); tooltipItems.forEach(function(item) { const name = item.name; const value = item.value; if (map[name]) { map[name].value = value; } }); legend.setItems(_.values(map)); }, onHide: function onHide() { const legend = chart.get('legendController').legends.top[0]; legend.setItems(chart.getLegendItems().country); } }); chart.line().position('date*value').color('type'); chart.area().position('date*value').color('type'); chart.render(); });
The text was updated successfully, but these errors were encountered:
这个是 f2 的问题,可以到 f2 提交 issue~ G2 F2 API 比较类似,但是在细节实现上还是有一些区别的。 @ruoru
Sorry, something went wrong.
sorry @hustcc
@hustcc 关于另一个问题,点击new issue的时候请把仓库名自动做一个选中,不然很容易忽略,提错。
什么意思?不是从哪里点就是哪里嘛,你从哪里点 new issue 的
No branches or pull requests
Reproduction link
Steps to reproduce
如果代码打不开,可以看一下下面的,root更一下就可以了
The text was updated successfully, but these errors were encountered: