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

Type of chart not updated properly when provided via options.chart.type #129

Open
christian-judt opened this issue Nov 5, 2024 · 0 comments

Comments

@christian-judt
Copy link

When initially providing the vue3-apexcharts component with its chart type via the vue-property options (by provinding options .chart.type) everything works fine. When I then change the chart type by the same means, various problems of varying serverity occur depending on the exact initial and the exact updating chart type.

Reproduction:

<div id="appl">
  <button @click="toggleChartType">Toggle Chart Type</button>
  <div id="chart">
    <apexchart width="500" :options="options" :series="series"></apexchart>
  </div>
</div>
  • JS:
Vue.component('apexchart', VueApexCharts);

var app = new Vue({
  el: '#appl',
  data: {
    // replace "bar" with "line" here to reproduce the problems
    // occuring when transitioning from a line chart to a bar chart
    options: { chart: { type: "bar" }},
    series: [{ data: [[1, 34], [2, 43], [3, 31], [4, 43], [5, 33], [6, 52]] }]
  },
  methods: {
    toggleChartType()
    {
      this.options = { ...this.options, chart: { ...this.options.chart,
        type: this.options.chart.type === 'bar' ? 'line' : 'bar'
      }};
    }
  }
});

I do not consider this a serious problem, since it can simply be worked around by using the vue-property type instead of the property options to initialize and update the chart type, but it should be a relatively simple fix on your end too.

@christian-judt christian-judt changed the title Type of chart not updated when provided via options.chart.type Type of chart not updated properly when provided via options.chart.type Nov 5, 2024
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