Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sujit-baniya opened this issue Dec 22, 2023 · 5 comments
Open

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

sujit-baniya opened this issue Dec 22, 2023 · 5 comments

Comments

@sujit-baniya
Copy link

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>
    );
};
@vamsikrishnareddy22
Copy link

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

@sujit-baniya
Copy link
Author

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

@vamsikrishnareddy22
Copy link

@sujit-baniya can you suggest the package to me

@sujit-baniya
Copy link
Author

@vamsikrishnareddy22
Copy link

thank you @sujit-baniya

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants