请注意我的项目图表,一切都运行良好,只是它只显示线数据而不是条形图
import RTChart from 'react-rt-chart';
//data changes on state change thats why value for data of object instead of array
const data={
date: Date.now(),
Current: [1800],
Predicted: [500],
}
// note according to the documentation chart should be similar to c3 js chart option
var chart = {
data:{
types: {
Current: 'line',
},
type:"bar",
axis: {
y: { min: 0, max: 3000 }
},
}
<RTChart
fields={['Current','Predicted']}
data={data}
chart={chart}
/>
对象是错误的,它应该是
type
并且types
应该在数据对象中
let chart = {
data:{
type:"bar",
types: {
Current: 'line',
},
axis: {
y: { min: 0, max: 3000 }
},
}