5

I am using ApexCharts with the Vue wrapper. I can successfully change the min and max values by setting them with a function. this.options.yaxis[0].min = Number(4500); for example, when I log it out in the console, the value is what I set it to. However, it seems to have no effect on the chart itself, the scales still read defaults of the pushed series.

initGraph(data) {
  var tempNum = 0;
  var tempNum2 = tempNum;
  this.options.yaxis[0].max = Number(5000);
  this.options.yaxis[0].min = Number(4500);
  console.log(this.options.yaxis[0].min);
  console.log(this.options.yaxis[0].max);
  for (var series in data) {
    this.series.push(data[series]);
  }
}

My goal is to change the scales on the y-axis as new series are filtered into the series object.

Dimanoid
  • 6,999
  • 4
  • 40
  • 55
James Weeks
  • 101
  • 1
  • 4

2 Answers2

3

You need to update the whole options config and not just a single property to allow the Vue watcher to catch the change.

this.options = {
  yaxis: {
    min: 4500,
    max: 5000
  }
}
junedchhipa
  • 4,694
  • 1
  • 28
  • 28
2

Update option before update series and it works:

chart.updateOptions( {
  xaxis: {
    categories: ["Stackoverflow", "is", "great"]
  },
  yaxis: {
    min: 4500,
    max: 5000
  }
});
vahid sabet
  • 485
  • 1
  • 6
  • 16