jscharting-react
jscharting-react copied to clipboard
Getting error while using Column & Area Spline types with react typescript
It is very strange that the library throws error whenever we try to use column or area spline chart types, where as other works, didn't check all but works with line
Here is the error we are getting
Uncaught TypeError: Cannot read properties of undefined (reading 'x')
at ha (jscharting.js:70:1)
at a.showHalo (jscharting.js:1035:1)
at a.hideHalo (jscharting.js:1037:1)
at jscharting.js:1482:1
at Pn (jscharting.js:33:1)
at x (jscharting.js:483:1)
at c.each (jscharting.js:525:1)
at c.redraw (jscharting.js:1482:1)
at SA (jscharting.js:461:1)
at jscharting.js:1470:1
This is our config
const config = {
palette: ['#FBC02D'],
xAxis_crosshair_enabled: false,
defaultSeries: {
type: 'column',
events: {},
legendEntry: {
visible: false
}
},
defaultPoint_label_visible: false,
yAxis: {
label_text: '',
defaultTick: {
value: ''
}
},
xAxis: {
label_text: '',
defaultTick: {
value: ''
}
},
title_label_text: '',
series: [
{
points: [
{ x: 'A', y: 50 },
{ x: 'B', y: 30 },
{ x: 'C', y: 30 },
{ x: 'D', y: 50 },
{ x: 'E', y: 50 },
{ x: 'F', y: 50 }
]
}
]
}
We are using typescript with react.
Thanks for help..
I have updated the code with proper typescript Props.. It still crashes
const config = (color: string, points: IChartPointProps[]): JSC.JSCChartConfig => {
return {
palette: [color],
type: 'line',
yAxis_scale_invert: false,
legend_visible: false,
series: [
{
points
}
],
yAxis: {
label: {
text: 'Students'
},
defaultTick: {
value: '1'
},
formatString: 'd'
},
xAxis: {
label: {
text: 'Year'
},
defaultTick: {
value: '1'
},
formatString: 'd'
},
defaultTooltip: {
label: {
style: {
fontSize: '10px'
}
},
margin: 10
}
}
}
export interface IChartPointProps {
name: string
y: number
}