Line chart with simple line and filled area

« 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 Will Kostelecky on 24th September 2013
I need to do a moving line chart with two series. One would be a highwater line and would not be filled. The other series would be filled. Can I do this by tweaking the below code (which has not worked for me) or do I need to do a combined chart?

         if (!window.__rgraph_line__) {
             window.__rgraph_line__ = new RGraph.Line(id, d1, d2);
             window.__rgraph_line__.Set('chart.background.barcolor1', 'rgb(100,100,100)');
             window.__rgraph_line__.Set('chart.background.barcolor2', 'rgb(100,100,100)');
             window.__rgraph_line__.Set('chart.background.grid', false);
             window.__rgraph_line__.Set('chart.gutter.left', 0);
             window.__rgraph_line__.Set('chart.gutter.right', 0);
             window.__rgraph_line__.Set('', 0);
             window.__rgraph_line__.Set('chart.gutter.bottom', 0);
             window.__rgraph_line__.Set('ylabels', false);
             window.__rgraph_line__.Set('xlabels', false);
             window.__rgraph_line__.Set('yaxis', false);
             window.__rgraph_line__.Set('xaxis', false);
             window.__rgraph_line__.Set('colors', ['red', 'blue']);
             window.__rgraph_line__.Set('filled', [false, true]);
             window.__rgraph_line__.Set('chart.linewidth',[4.0, 4.0]);
             window.__rgraph_line__.Set('chart.ymax', 100);
             window.__rgraph_line__.Set('chart.filled.accumulative', false);

Thanks in advance for any help,
Posted by RGraph support on 24th September 2013
Hi there,

I wouldn't use the CombinedChart - that's really targeted at bar/line charts. You can just add multiple line charts to the same canvas. The second line chart will need its background grid, axes and Y labels turning off though so that they're not repeated.

Also ensure that both charts are on the same scale (if necessary). If you need to do that then you can set the chart.ymax property.

Richard, RGraph Support

Add a reply

« Back to message list