0

我目前正在尝试使用 ReactJS 显示饼图的不同方法,我发现了这个叫做 react-mininal-pie-chart [https://github.com/toomuchdesign/react-minimal-pie-chart]

问题是即使在阅读了他们的示例后我也无法弄清楚如何在侧面显示图例?

使用 react-google-chart 我可以像这样显示侧面图例:

import { Chart } from "react-google-charts";
<div className="row">
                    <Chart
                      width={'800px'}
                      height={'800px'}
                      chartType="PieChart"
                      loader={<div>Loading Chart</div>}
                      data={[
                        ['Sentiment', 'Percentage'],
                        ['Negative', 20],
                        ['Neutral', 10],
                        ['Positive', 70]
                      ]}
                      options={{
                        title: 'Sentiments extracted from the dataset',
                      }}
                      rootProps={{ 'data-testid': '1' }}
                    />
                </div>

但是我不知道如何使用 react-minimal-pie-chart 添加图例,你们有什么想法吗?

4

0 回答 0