Adjust yAxis problem


#1

Hi

What I’m trying to do is to update “start”, “end” and “step” values of y-axis each time I receive new data from server. I’m using this approach:

...
chart.define('yAxis', {start: 0, end: 150, step: 4});
...

However chart after this manipulation gets scaled weirdly: i.imgur.com/f0lvcvk.png . As you can see, blue value is 12, black is 25, but it looks like in total they are over 52.

This can be reproduced on official samples:
dhtmlx.com/docs/products/dhtmlxC … chart.html
Initially it looks fine. But once you execute following code in console:

myBarChart.define("yAxis", {start: 0, end: 120, step: 10});
myBarChart.refresh();

it becomes - i.imgur.com/bJXg35z.png

However:
dhtmlx.com/docs/products/dhtmlxC … cales.html

myBarChart1.define("yAxis", {start: 0, end: 120, step: 10});
myBarChart1.refresh()

it is still OK - i.imgur.com/ySOO1vs.png
Is this known/expected behavior? Is this true that it occurs only with stacked bar chart?

What would you recommend to adjust y-axis in runtime?

Thanks in advance.


#2

Any ideas?


#3

Seems that problem occurs on charts which show several series of data:
dhtmlx.com/docs/products/dhtmlxC … eries.html
CompanyB’s January value is 2.3
After this code executed

myLineChart.define("yAxis", {start: 0, end: 6, step: 1});
myLineChart.refresh();

It looks like this i.imgur.com/ZBfeQtG.png - 2.3 is drawn between 1 and 2.


#4

Update to prev post.

Seems that data which added by addSeries method doesn’t get scaled at all.
See this - i.imgur.com/VEl6AqY.png
CompanyA’s line looks fine.
But green lines are identical on both charts!


#5

Hi
There is no way to redraw charts this way. You need to call destructor() and rebuild chart every time you need to update “start”, “end” and “step” values of y-axis


#6

Hi Darya
This is what I exactly made - I recreate chart each time I receive new data.
Thanks for reply.

But think the way chart behaves after

chart.define("yAxis", {start: 0, end: 6, step: 1});
chart.refresh();

is contradictory. Chart with single portion data gets redraw properly, but chart with series of data - does not. I think these to use cases should behave consistently.

Thanks


#7

Thanks for the comment. We will consider such opportunity in one of the following versions.