Circles on nvd3 line chart

余生颓废 提交于 2019-12-13 00:15:54

问题


I need to add circules/nodes to each point on a line chart of nvd3. I have my codes here - https://jsfiddle.net/sujit77/7ns2g4a1/12/

Also I need to have these circles with different colors depending on value at that point.

I tried to follow "http://www.d3noob.org/2013/01/change-line-chart-into-scatter-plot.html". But messed up my code between D3 and nvd3 functions.

nv.addGraph(function() {
    var chart = nv.models.lineChart()
        .x(function(d) {
            return d3.time.format("%Y-%m-%d %H:%M:%S").parse(d['key']);
        })
        .y(function(d){ return d.value; })

    var format = d3.time.format("%m %d %Y");

    chart.yAxis
    .tickFormat(d3.format(',.2f'));

    chart.xAxis
    .tickFormat(function(d) { 
        return d3.time.format('%Y %b %d')(new Date(d)) 
    });

    d3.select('#line-charts').append('svg')
       .attr('height', 250)
       .attr('width', 400)
       .datum(dataValue)
       .call(chart);

    nv.utils.windowResize(chart.update);
    return chart;
});

I found similar question - Draw a circle at a point on an NVD3 line chart, but its unaswered yet.

来源:https://stackoverflow.com/questions/44322853/circles-on-nvd3-line-chart

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