Losing ymin with combination charts

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 Laura Gilbert on 28th February 2013
Hi,
I am trying to plot a bar and line chart (same data) on top of one another. The data range is 0-5, but I want to show the y sale 0-10. This works find when I plot the graphs one after the other. But when I combine them, it shows the y range as -10 to 10 (so the bottom half of the plot is empty). How do I force the combination chart to start at 0, not -(ymax)? If I remove the restrictions I have added on the yscale it still plots -5 to 5, not 0-5 which is the data range.

Code:
    var bar_one = new RGraph.Bar('bar_one', generallyone);
             bar_one.Set('hmargin', 1);
             bar_one.Set('xaxispos', 'center');
             bar_one.Set('gutter.bottom', 50);
             bar_one.Set('chart.labels', labels);
             bar_one.Set('chart.colors.sequential',true);
             bar_one.Set('chart.colors', one_col_list);
             bar_one.Set('chart.title','One');
             bar_one.Set('chart.ymax',10);
             bar_one.Set('chart.ymin',0);
            
             var line_one = new RGraph.Line('bar_one', generallyone);
             line_one.Set('chart.colors', [one_col]);
             line_one.Set('linewidth', 1);
             line_one.Set('spline', true);
             line_one.Set('shadow', true);
             line_one.Set('shadow.offsetx', 0);
             line_one.Set('shadow.offsety', 0);
             line_one.Set('shadow.blur', 2);
             line_one.Set('xaxispos', 'center');
             line_one.Set('chart.ymax',bar_one.max);
             line_one.Set('chart.ymin',bar_one.min);
       
             combo_one = new RGraph.CombinedChart(bar_one, line_one);
             combo_one.Draw(RGraph.Effects.Bar.Grow,RGraph.Effects.Line.jQuery.Trace);

Thanks for your help!
Laura
Posted by Laura Gilbert on 1st March 2013
...not to worry. Removing the ('xaxispos', 'center'); values fixes it. Seems obvious now.
Posted by RGraph support on 1st March 2013
Hi there,

Only obvious when you know how! :-)



Richard, RGraph Support


  

Add a reply




« Back to message list