0

my line graph is not displaying decimal values instead it is rounding off the decimal values on y axis

var line1 = new RGraph.Line({
        id: 'cvs',
        data: [
            [5.85, 5.86, 5.87, 5.88, 5.89, 5.90, 5.91, 5.92, 5.93, 5.94]
        ],
        options: {
            linewidth: 1,
            backgroundGrid: false,
            title: 'X-Chart',
            colors: ['red'],
            fillstyle: 'rgba(255,0,0,0.2)',
            ymin: 5.75,
            ymax: 6,
            labels: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
            scale: 0.2,
            textAccessible: true
        }
    }).draw();

thank you

Mahi
  • 1,707
  • 11
  • 22
  • please add code snippet – muneebShabbir Dec 05 '16 at 06:47
  • var line1 = new RGraph.Line({ id: 'cvs', data: [ [5.85, 5.86, 5.87, 5.88, 5.89, 5.90, 5.91, 5.92, 5.93, 5.94] ], options: { linewidth: 1, backgroundGrid: false, title: 'X-Chart', colors: ['red'], fillstyle: 'rgba(255,0,0,0.2)', ymin: 5.75, ymax: 6, labels: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], scale: 0.2, textAccessible: true } }).draw(); – Varsha Soni Dec 05 '16 at 06:51
  • Edit your question and add this code there. It will be helpful for users to understand your question – muneebShabbir Dec 05 '16 at 06:53
  • http://www.rgraph.net/docs/line.html#labels you can use your own `scaleFormatter` – Mahi Dec 05 '16 at 07:27

1 Answers1

0

You should add the scaleDecimals option to your configuration:

...
scaleDecimals: 2,
...

There's an example of it in a demo called line-us-prison-population.html and you can see that by downloading the RGraph archive here:

https://www.rgraph.net/download.html#stable

Richard
  • 4,809
  • 3
  • 27
  • 46