react-apexcharts icon indicating copy to clipboard operation
react-apexcharts copied to clipboard

[BUG] - Chart not rendered properly when using dynamic data

Open sujit-baniya opened this issue 1 year ago • 7 comments

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>
    );
};

sujit-baniya avatar Dec 22 '23 16:12 sujit-baniya

Hello @sujit-baniya any update, I am also facing same issue :)

vamsikrishnareddy22 avatar Apr 12 '24 06:04 vamsikrishnareddy22

@vamsikrishnareddy22 I was not able to work with bug so I am currently using different chart library

sujit-baniya avatar Apr 12 '24 06:04 sujit-baniya

@sujit-baniya can you suggest the package to me

vamsikrishnareddy22 avatar Apr 12 '24 06:04 vamsikrishnareddy22

https://recharts.org/en-US/

sujit-baniya avatar Apr 12 '24 06:04 sujit-baniya

thank you @sujit-baniya

vamsikrishnareddy22 avatar Apr 12 '24 06:04 vamsikrishnareddy22

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.

github-actions[bot] avatar Aug 02 '24 14:08 github-actions[bot]