问题描述
我正在尝试将此库用于 React 中的图表: https://nivo.rocks/
我已经复制了水平柱状图(条形图)的 exact same example in the docs,但在我的环境中,图例根本没有显示。
我已经查找了之前发布的所有其他问题,这些问题涉及标签未显示和图例问题的故障排除。但这是一个不同的问题。它只是没有按预期工作/如文档实时预览中所示
CodeSandBox 显示问题: https://codesandbox.io/s/missing-legends-text-pns6v
解决方法
有一个 div
标记,如下所示:
<div style={{ width: "80%",height: "400px",color: "white" }}>
颜色设置为白色。删除它,文本将显示。