fli*_*m57 1 meteor chartist.js
我已经安装了 mfpierre:chartist 流星包和 mspi:chartistlegend 插件(两个大气包)。我有这样的插件:
new Chartist.Bar('.ct-chart', {
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
series: [
[1,2,3,4],
[1,2,3,4],
[1,2,3,4]
]
}, {
plugins: [ Chartist.plugins.legend() ]
});
Run Code Online (Sandbox Code Playgroud)
图表不会在“插件”键/值对就位的情况下呈现。如果我删除“插件”键/值,图表呈现良好。据我所知,我正在关注文档。欢迎任何帮助。
我没有使用流星,所以你的里程可能会有所不同,但我使用的是 Angular2 并且遇到了类似的错误。我的答案是首先使用图例插件对其进行初始化,然后像您所做的那样在 Chartist 插件定义中使用它。这感觉很糟糕,但它的工作......
import * as Chartist from 'chartist';
import * as MyLegend from 'chartist-plugin-legend';
constructor(){
var tester = new MyLegend(); //without this line, you get 'Chartist.plugins undefined'
}
.... in another method like ngOnInit or something...
new Chartist.Bar('.ct-chart', {
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
series: [
[1,2,3,4],
[1,2,3,4],
[1,2,3,4]
]
}, {
plugins: [ Chartist.plugins.legend({
legendNames: ['Blue pill', 'Red pill', 'Purple pill']
}) ]
});
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
4642 次 |
最近记录: |