You must be logged in to post your query.
Home › Forums › Chart Support › React rendering canvasjs chart with mapping
Tagged: Mapping, React
I am trying to render canvasjs charts using React.
https://jsfiddle.net/fg70s6zh/1/
I have pushed options in array and iterated to render charts using mapping.
Can anybody help me what’s wrong?
I have solved it. Thank you for your consideration.
I changed the curly bracket and put the <div> attribute.
https://jsfiddle.net/5gown7ud/1/
Here is how I have done.
@wellhys,
In the code shared by you, there is a syntax error while pushing the chart-options to the options array. Pushing the chart-options as shown in the code snippet below should work fine –
options.push({ title: { text: "Basic Column Chart in React" }, data: [{ type: "column", dataPoints: [ { label: "Apple", y: 10 }, { label: "Orange", y: 15 }, { label: "Banana", y: 25 }, { label: "Mango", y: 30 }, { label: "Grape", y: 28 } ] }] })
Please take a look at this StackBlitz example for a working code.
___________ Indranil Deo Team CanvasJS
Thank you for fixing!
You must be logged in to reply to this topic. Login/Register