Bug in Bar/Line combo Y axis?

Share RGraph:  

« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by Dustin Boswell on 8th July 2013
If you set the ymax value for either or both the bar and line charts, the ymax value is respected for the bar chart, but ignored for the line chart.
Posted by Dustin Boswell on 10th July 2013
Any feedback on this?
Posted by RGraph support on 10th July 2013
Hi there,

Seem to to have missed this message - there's an example of a combined bar/line chart here:

www.rgraph.net/fiddle/view/79e88f82230a4d84714b3530832972b8

It uses the CombinedChart class which sets a few settings such as gutters and the hmargin.






Richard, RGraph support
Posted by Dustin Boswell on 11th July 2013
Yes, I'm aware of that.

BUT...

If you set ymax, the bar chart respects that value but the line chart does not.

For example, if the "natural" ymax is 3500, but you set ymax to 5000, the y-axis is drawn correctly and the bar chart displays properly against it.

But the line chart displays according to an apparently random (and invisible) y-axis with a totally different ymax.

This is true whether you set ymax for the bar chart, the line chart, or both.
Posted by Dustin Boswell on 11th July 2013
Example:

         data = [607.00,3229.45,2849.75,1137.00,1521.36,1191.80,433.45,808.27];
         var rg_dow_bar = new RGraph.Bar('rg_dow',data);
         rg_dow_bar.Set('chart.labels',['Thu','Fri','Sat','Sun','Mon','Tue','Wed','today']);
         rg_dow_bar.Set('chart.ylabels.count',4);
         rg_dow_bar.Set('ymax',5000);
         rg_dow_bar.Set('chart.gutter.left',100);
         rg_dow_bar.Set('chart.hmargin',10);
         rg_dow_bar.Set('chart.text.font','Weezer');
         rg_dow_bar.Set('chart.text.size',9);
         rg_dow_bar.Set('chart.units.pre','$');
         rg_dow_bar.Set('chart.colors',['#71C293']);
         rg_dow_bar.Set('chart.gutter.top',50);
         rg_dow_bar.Set('key',['last 7 days','4-week avg','52-week avg']);
         rg_dow_bar.Set('key.colors',['#92C2A6','#92B2C2','#E18D87']);
         rg_dow_bar.Set('key.position','gutter');
         rg_dow_bar.Set('key.position.gutter.boxed',false);
         rg_dow_bar.Set('chart.background.grid.vlines',false);
         data = [1103.110385,1140.801731,1507.666346,1255.552885,825.966346,569.706923,516.302885,1103.110385];
         var data2 = [1472.775000,2092.395000,1945.250000,1007.550000,1167.752500,507.450000,835.675000,1472.775000];
         var rg_dow_line = new RGraph.Line('rg_dow',data,data2);
         rg_dow_line.Set('linewidth',2);
         rg_dow_line.Set('chart.colors',['#92B2C2','#E18D87']);
         rg_dow_line.Set('ymax',5000);
         var rg_dow = new RGraph.CombinedChart(rg_dow_bar, rg_dow_line);
         rg_dow.Draw();
Posted by RGraph support on 11th July 2013
Hi there,

Looks fine. Perhaps your confusion is being caused by the fact that there's only four labels.



Richard

Add a reply




« Back to message list