NVD3 - lineWithFocusChart - disable auto sorting for labels / ticks along the x axis

I am creating a line chart with View Finder in nvd3, and my problem is that even if I specify my ticks using an (unsorted) array and .tickValues, the result will be sorted again. To be more clear: my array contains numbers like (49,50,51,52,1,2,3,4). I would like to have the x axis in exactly that order. But the result is a sorted version (1,2,3,4,49,50,51,52). So I guess there is some sort of automatic sorting even if I use .tickValues?! How to disable this sorting?

Here is a sample code:

nv.addGraph(function() {
    var chart = nv.models.lineWithFocusChart();

    // chart.transitionDuration(500);

    chart.xAxis.tickValues(x_labels_array);
    chart.x2Axis.tickValues(x_labels_array);

    chart.yAxis.tickFormat(d3.format(',.2f'));
    chart.y2Axis.tickFormat(d3.format(',.2f'));
    d3.select('#chart svg').datum(createData()).call(chart);

    nv.utils.windowResize(chart.update);

    return chart;
}); 
+3
source share
1 answer

xDomain[firstVal, lastVal], lines: {xDomain[firstVal, lastVal]} plunker Angular -nvd3

0

All Articles