Key not showing up on my chart

Share RGraph:   Share or Like RGraph on Facebook!

« 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 QA Solutions on 26th March 2016
New to Rgraph, going well so far but can't figure out why the key/legend won't show up in the graph below.
Chart shows correct with title, numbers otherwise.

Any help appreciated.

<canvas id="cvgraph1" width="700" height="350">
         [No canvas support]
</canvas>
<script>
     var line = new RGraph.Line({
         id: 'cvgraph1',
         data: [[3289340.64,2870500.45,216366.18,4829015.61,3382175.55,3838843.08,4091408.46,4212094.73,3080621.31,5079325.24,2663527.86,3401494.64],[1319132.34,1269.5,0,3119635.7,3303541.24,3148108.85,1913423.95,853210.43,1929954.29,2876245.09,1002519.72,1046418.26],[32905.57,0,0,774173.23,1061494.46,824299.31,400570.08,273541.57,2104418.13,476281.92,182129.96,507903.96]],
         options: {
             key: ['Charges', 'Adjustments', 'Payments'],
             keyPosition: 'gutter',
             gutterTop: 40,
             gutterLeft: 40,
             gutterRight: 20,
             gutterBottom: 50,
             spline: true,
             resizable: true,
             title:'Charges,Adjustments,Payments - Last 12 Months',
             titleYaxis: '$ Dollars',
             ymin:-1269831.31,
             ymax:6349156.55,
             linewidth: 3,
             hmargin: 25,
             labelsAbove: true,
             labels: ['Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec','Jan-16','Feb','Mar'],
             ylabels: false,
             tooltips: [],
             tickmarks: 'circle',
             ticksize: 2
         }
     }).draw();
</script>
Posted by Richard on 26th March 2016
Hi,

There's nothing wrong with the JavaScript - the chart showed up when I tried it. So you may just need to include the key code in your page:

<script src="RGraph.common.key.js"></script>

Also, you may want to set labelsAboveDecimals to 1 or 2.






Richard
Posted by QA Solutions on 29th March 2016
Thank for your help! I'll add the script and give it a shot.

Add a reply




« Back to message list