我正在使用 React Vis 创建一个简单的图表。这是我的代码:
import React from 'react';
import '../../../node_modules/react-vis/dist/style.css';
import {XYPlot, VerticalBarSeries} from 'react-vis';
const myData = [
{x: 'A', y: 10},
{x: 'B', y: 5},
{x: 'C', y: 15}
]
export const Chart = () => {
return (
<XYPlot height={500} width={500}>
<VerticalBarSeries data={myData} />
</XYPlot>
)
};
export default Chart;
我收到此错误消息:
Received NaN for the `x` attribute. If this is expected, cast the value to a string."