nvd3 chart strange behavior with date range slider

↘锁芯ラ 提交于 2019-12-01 14:50:50
Mike Burba

Couple of issues for you to look at:

  1. I agree with shabeer90, the data is funky. You have multiple values occurring at the same time.

  2. Your sort is correct, but where you have it in your code doesn't work...try adding it inside the response of the ajax call (right after setting $scope.data = data).

  3. Also, you need to make the changes that I outlined in another question (to nvd3 in the lineWithFocusChart model).

  4. Accessing the xScale is a little more tricky...on this chart you need to go through the lines:

$scope.options = {
    chart: {
    type: 'lineWithFocusChart',
    height: 450,
    margin : {
        top: 20,
        right: 20,
        bottom: 60,
        left: 40
    },
    transitionDuration: 500,
    lines : { // <-- add this
        xScale : d3.time.scale()
    },
    lines2 : { // <-- add this too
        xScale : d3.time.scale()
    },
    xAxis: {
        ticks : d3.time.months, <-- add the time interval
        axisLabel: 'X Axis',
        tickFormat: function(d){
            return  d3.time.format('%d/%m/%y')(new Date(d))
        }
    },
    x2Axis: {
        tickFormat: function(d){
            return  d3.time.format('%d/%m/%y')(new Date(d))
        }
    },
    yAxis: {
        axisLabel: 'Y Axis',
        tickFormat: function(d){
            return d3.format(',.2f')(d);
        },
        rotateYLabel: false
    },
     y2Axis: {
        tickFormat: function(d){
            return d3.format(',.2f')(d);
        }
    }
}

};

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!