简体   繁体   中英

Amcharts - Change value axis properties dynamically

I have a StackedBarChart which shows serveral values per day. Now i want to switch the view from absolute values to relative values. Therefore i need to change the valueAxis properties like

valueAxis.min = 0;
valueAxis.max = 100;
valueAxis.strictMinMax = true;
valueAxis.calculateTotals = true;
valueAxis.renderer.minWidth = 50;

But how can i get the valueAxis from an existing chart object?

You can access your axis object by accessing it from thexAxes oryAxes list , depending on where you assigned the object to, and use getIndex or loop through them using each if you have multiple axes you want to update.

// assuming you have one value axis on the y axis:
var valueAxis = chart.yAxes.getIndex(0);
// make updates to the variable

// if you have multiple value axes:
chart.yAxes.each(function(valueAxis) {
  // make changes to each axis object
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM