Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Creating realtime Bar chart with react-rt-chart

Please i need concerning my graph for my project everthing works perfectly just that it is only showing line data instead of bar chart

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}
/>

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

The object is wrong it should be both type and types should be in the data object

let chart = {
data:{
type:"bar",
types: {
Current: 'line',
},
axis: {
y: { min: 0, max: 3000 }
},
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading