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

Error on synchronized charts exemple #90

Open
dawadam opened this issue Dec 18, 2023 · 1 comment
Open

Error on synchronized charts exemple #90

dawadam opened this issue Dec 18, 2023 · 1 comment

Comments

@dawadam
Copy link

dawadam commented Dec 18, 2023

Hi,
This example doesn't work: https://apexcharts.com/vue-chart-demos/line-charts/syncing-charts/

The result is not synchronized.

I found generateDayWiseTimeSeries on another site (https://observablehq.com/@tmcw/using-apexcharts), but I think that's not the problem.

A complete vuejs 3 code:


<script lang="ts">


//serie generate
function generateDayWiseTimeSeries(baseval, count, yrange) {
    var i = 0;
    var series = [];
    while (i < count) {
        var x = baseval;
        var y =
            Math.floor(Math.random() * (yrange.max - yrange.min + 1)) + yrange.min;

        series.push([x, y]);
        baseval += 86400000;
        i++;
    }
    return series;
}

export default {
    el: '#app',

    data() {
        return {

            series: [{
                data: generateDayWiseTimeSeries(new Date('11 Feb 2017').getTime(), 20, {
                    min: 10,
                    max: 60
                })
            }],
            chartOptions: {
                chart: {
                    id: 'fb',
                    group: 'social',
                    type: 'line',
                    height: 160
                },
                colors: ['#008FFB']
            },

            seriesLine2: [{
                data: generateDayWiseTimeSeries(new Date('11 Feb 2017').getTime(), 20, {
                    min: 10,
                    max: 30
                })
            }],
            chartOptionsLine2: {
                chart: {
                    id: 'tw',
                    group: 'social',
                    type: 'line',
                    height: 160
                },
                colors: ['#546E7A']
            },

            seriesArea: [{
                data: generateDayWiseTimeSeries(new Date('11 Feb 2017').getTime(), 20, {
                    min: 10,
                    max: 60
                })
            }],
            chartOptionsArea: {
                chart: {
                    id: 'yt',
                    group: 'social',
                    type: 'area',
                    height: 160
                },
                colors: ['#00E396']
            },

            seriesSmall: [{
                data: generateDayWiseTimeSeries(new Date('11 Feb 2017').getTime(), 20, {
                    min: 10,
                    max: 60
                })
            }],
            chartOptionsSmall: {
                chart: {
                    id: 'ig',
                    group: 'social',
                    type: 'area',
                    height: 160,
                    width: 300
                },
                colors: ['#008FFB']
            },

            seriesSmall2: [{
                data: generateDayWiseTimeSeries(new Date('11 Feb 2017').getTime(), 20, {
                    min: 10,
                    max: 60
                })
            }],
            chartOptionsSmall2: {
                chart: {
                    id: 'li',
                    group: 'social',
                    type: 'area',
                    height: 160,
                    width: 300
                },
                colors: ['#546E7A']
            },
        }

    },

}
</script>

<template>
    <div id="wrapper">
        <div id="chart-line">
            <apexchart type="line" height="160" :options="chartOptions" :series="series"></apexchart>
        </div>
        <div id="chart-line2">
            <apexchart type="line" height="160" :options="chartOptionsLine2" :series="seriesLine2"></apexchart>
        </div>
        <div id="chart-area">
            <apexchart type="area" height="160" :options="chartOptionsArea" :series="seriesArea"></apexchart>
        </div>
        <div class="columns">
            <div id="chart-small">
                <apexchart type="area" height="160" width="300" :options="chartOptionsSmall" :series="seriesSmall">
                </apexchart>
            </div>
            <div id="chart-small2">
                <apexchart type="area" height="160" width="300" :options="chartOptionsSmall2" :series="seriesSmall2">
                </apexchart>
            </div>
        </div>

    </div>
</template>
@dawadam
Copy link
Author

dawadam commented Dec 18, 2023

It's mistake, seem working.

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

1 participant