Search code examples
graphscalerickshaw

Rickshaw strange values on the scale


I use RickShaw to creat some graph, the only problem is the values of the second Y-Axis as you can see on fiddle : http://jsfiddle.net/tWXzL/419/

I put a scale between [0,50]

var scale2 = d3.scale.linear().domain([0, 50]).nice();

But the second scale axis1 show value between 0 and 1 and not between 0 and 50.

Maybe i don"t understand how it's works, but for the first scale it works perfectly, so why the second scale doesn't work ?


Solution

  • The second y-axis is not of the the ".Scaled" type. Fixed example: http://jsfiddle.net/tWXzL/477/

    var y_axis = new Rickshaw.Graph.Axis.Y.Scaled( { /*Scaled missing*/
        graph: graph,
        orientation: 'right',
        scale: scale2,
        grid: false,
        tickFormat: Rickshaw.Fixtures.Number.formatKMBT,
        element: document.getElementById('axis1'),
    } );