Question

I have a large grouped chart and the y axis will not formulate properly. I have tried getting rid of zeros, and double checking for syntax typos and cannot seem to figure it out. Basically the y-axis ticks are 0 0 1 1 thats it???

<script>
window.onload = function ()
{
    var data = [ ['18','47','11'] , ['10','4','1'] , ['0','0','1'] , ['0','2','0'] , ['8','9','0'] , ['6','6','0'] , ['5','3','1'] , ['2','7','0'] , ['9','5','1'] , ['5','6','0'] , ['6','5','0'] , ['4','5','0'] , ['3','2','2'] , ['3','2','0'] , ['0','1','0'] , ['1','0','0'] ]  ;

    var bar = new RGraph.Bar('cvs', data)
        .Set('labels', ['JH', '166', 'JC', 'DR', 'KL', '206', '499', '181', '127', '01', '211', 'RK', '111', '46', '485', '65'])
        .Set('colors', ['Gradient(#99f:#27afe9:#058DC7:#058DC7)', 'Gradient(#94f776:#50B332:#B1E59F)', 'Gradient(#fe783e:#EC561B:#F59F7D)'])
        .Set('hmargin', 8)
        .Set('strokestyle', 'white')
        .Set('linewidth', 1)
        .Set('shadow', true)
        .Set('shadow.color', '#ccc')
        .Set('shadow.offsetx', 0)
        .Set('shadow.offsety', 0)
        .Set('shadow.blur', 10)

        .Draw();
}
</script>
Was it helpful?

Solution

That's because putting single quotes around your numbers turns them into strings - which are equivalent to 0. So you end up charting an array of zeros. RGraph then generates an appropriate scale of which the max is 1 - so a scale of 0.2, 0.4, 0.6, 0.8, 1. Then by default there's no decimals so they get rounded - producing 0,0,1,1,1.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top