我正在使用 chartist.js 制作饼图组件。我想使用图例插件https://codeyellowbv.github.io/chartist-plugin-legend/
我的饼图中没有得到图例。看下面的截图
代码:
import React, { Component } from 'react';
import ChartistGraph from "react-chartist";
import Legend from "chartist-plugin-legend";
import './piechart.css';
let options = {
width:400,
height:500,
labelInterpolationFnc: function(value) {
return value[0]
}
};
let plugin = {
plugin:'legend'
}
class Chart extends Component {
render(){
return(
<div>
<div className="center">
<ChartistGraph data={data} options={options} plugins={plugin} type="Pie"/>
</div>
</div>
)}
}
export default Chart;
截屏: