react-apexcharts
react-apexcharts copied to clipboard
[BUG] - Chart not rendered properly when using dynamic data
Video of bug: https://www.loom.com/share/8224f404e44f44508e5533bd37935a99
Code:
<StackedAreaChart series={queuedMessages} colors={['#008FFB', '#00E396', '#CED4DC']} dataOptions={{title: "Queued Messages", xaxis:{type:"datetime"}, yaxis:{type:"number"}}} height={300}/>
import React from 'react';
import ReactApexChart from 'react-apexcharts';
export const StackedAreaChart = ({series, height, colors, dataOptions}) => {
let options = {
chart: {
type: 'area',
height: height,
stacked: true,
events: {
selection: function (chart, e) {
console.log(new Date(e.xaxis.min));
}
}
},
colors: colors,
dataLabels: {
enabled: false
},
stroke: {
curve: 'smooth'
},
fill: {
type: 'gradient',
gradient: {
opacityFrom: 0.6,
opacityTo: 0.8
}
},
legend: {
position: 'top',
horizontalAlign: 'left'
}
};
if (dataOptions.hasOwnProperty('title')) {
options.title = {text: dataOptions.title}
}
if (dataOptions.hasOwnProperty('xaxis')) {
options.xaxis = dataOptions.xaxis
}
if (dataOptions.hasOwnProperty('yaxis')) {
options.yaxis = dataOptions.yaxis
}
return (
<div>
<ReactApexChart options={options} series={series} type="area" height={height}/>
</div>
);
};
Hello @sujit-baniya any update, I am also facing same issue :)
@vamsikrishnareddy22 I was not able to work with bug so I am currently using different chart library
@sujit-baniya can you suggest the package to me
https://recharts.org/en-US/
thank you @sujit-baniya
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.