使用react-rt-chart创建实时条形图

问题描述 投票:0回答:1

请注意我的项目图表,一切都运行良好,只是它只显示线数据而不是条形图

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}
/>
javascript reactjs bar-chart c3.js
1个回答
0
投票

对象是错误的,它应该是

type
并且
types
应该在数据对象中

let chart = {
data:{
type:"bar",
types: {
Current: 'line',
},
axis: {
y: { min: 0, max: 3000 }
},
}
© www.soinside.com 2019 - 2024. All rights reserved.