如何在胜利中实现像附加的传奇?

lia*_* xu 1 d3.js reactjs victory-charts

在此处输入图片说明

我正在使用胜利来创建图表,但 VictoryLegend 不提供这种图例。是否有任何现有的可直接使用的 react Legend 组件?

Pix*_*omo 5

简单看一下文档,看起来胜利确实提供了传奇,在这里阅读更多

这是他们文档中的一个简单实现:

<VictoryLegend x={125} y={50}
  title="Legend"
  centerTitle
  orientation="vertical"
  gutter={20}
  style={{ border: { stroke: "black" }, title: {fontSize: 20 } }}
  data={[
    { name: "One", symbol: { fill: "tomato", type: "square" } },
    { name: "Two", symbol: { fill: "orange", type: "square" } },
    { name: "Three", symbol: { fill: "gold", type: "square" } }
  ]}
/>
Run Code Online (Sandbox Code Playgroud)

要创建方形点,请指定“方形”类型,此处列出了其他选项。

您可以选择“圆形”、“菱形”、“加号”、“方形”、“星形”、“三角形向下”、“三角形向上”