davenok

Dual Y axis - align zeros

Recommended Posts

So, I have an issue where I'm doing a combo chart with bar graph and line graph.

The bar graph displays daily revenue amount, and occasionally, due to credit processing, the revenue will go negative for the day.

 

The line graph shows a Month to Date cumulative revenue, and will always be positive (Guess it technically could be negative on day 1 of the month)

 

The problem is that since the daily amount goes negative, the scale on the primary Y axis goes from $-x.00 to zero then to $+x.00

Whereas, the secondary Y axis, for monthly sales is all positive, with $0 at the bottom of the scale, so the zero lines of the 2 axis do not align properly. This results in a rather ugly chart.

 

Is there a way to force the zero axis on pri-y and sec-y to both align zero?

post-65186-0-33663300-1423261111_thumb.jpg

Share this post


Link to post
Share on other sites

Hi,

 

Could you please make use of the attribute "syncAxisLimits" in the chart element and set it to 1.

 

Setting this attribute to 1 lets you synchronize the limits of both the primary and secondary axes.

 

Hope this helps.

 

Thanks.

Share this post


Link to post
Share on other sites

Hi,

 

You can set the y-axis max and min value for the chart. Please make use if the attribute "adjustDiv" and set it to 0 in the chart element.  It disables the automatic adjustment of divisional lines and allows you to explicitly specify the number of div lines to render as well as the y-axis lower and upper limits.

 

With the attributes "yAxisMinValue" and "yAxisMaxValue" you can specify the lower and upper limits respectively for y-axis. And with "numdivlines" attributes you can specify the number if horizontal div lines for y-axis.

 

Please refer the documentation link below for better understanding.

http://docs.fusioncharts.com/tutorial-configuring-your-chart-div-lines-and-grids.html

 

However, please note that if there is any negative value in the chart data it will override the minimum y-axis values. For instance, if u have a value as -10 and set minValue in y-axis as 0 it will automatically override and show the negative values as well in the chart.

 

Hope the information is helpful. Do drop us a mail if you require any further assistance.

 

Thanks.

Share this post


Link to post
Share on other sites

OK. This "kind of" works for me.

 

The problem is that when I use syncAxisLimits, it puts the same scale on both Axis. I want to sync the 0 line, but have the primary axis scale with the daily sales numbers, which are typically in the 100k's values, so the PYAxis would have a max around $1M. On the other hand, the SYAxis would contain our cumulative monthly sales, which could reach 20-30M.

 

I tried using the "yAxisMinValue" and "yAxisMaxValue" to force them both to zero, which didn't work since some days may actually have a negative value due to credit returns, and as you said, negative values over ride the min setting.

 

Next, I tried setting the min for both axis to -100000, which was more than enough to accomodate any credit returns, however, the monthly cumulative, since it doesn't go negative, still starts out on the zero axis, and the graphs don't align.

 

Is there no way to force the zero axis to both sync, but to scale each axis independently from there?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now