apexcharts / vue3-apexcharts

📊 Vue-3 component for ApexCharts
MIT License
314 stars 35 forks source link

animation: The charts (line) isn't showing the animation after I update the series #88

Open FabianMontoya opened 1 year ago

FabianMontoya commented 1 year ago

First I created a chart with empty series and xaxis categories, after a request I update the series and categories:

EX:

chartOptions.value = {
      ...chartOptions.value,
      xaxis: {
        ...chartOptions.value.xaxis,
        categories: ['Initial', 'Month 1', 'Month 2', 'Month 3', 'Month 4', 'Month 5']
      }
    };
 chartData.value[0].data = [80, 70, 65, 60, 55, 50];

And the data only appear, doesn't showing any animation (like when the chart is created as new).

For now, I solved it adding a v-if into the apexchart component:

<apexchart v-if="showChart" type="line" height="100%" :options="chartOptions" :series="chartData" />

And I init it in false, and after I update the values, change it to true:

chartOptions.value = {
    ...chartOptions.value,
    xaxis: {
      ...chartOptions.value.xaxis,
      categories: ['Initial', 'Month 1', 'Month 2', 'Month 3', 'Month 4', 'Month 5']
    }
  };
  chartData.value[0].data = [80, 70, 65, 60, 55, 50];

  setTimeout(() => {
    showChart.value = true;
  }, 0);

I don't know if it's an error or if I'm doing something wrong.

github-actions[bot] commented 3 months ago

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.