nvd3折线图工具提示显示所有日期的12/31

时间:2016-06-30 21:25:15

标签: nvd3.js

我必须在这里遗漏一些愚蠢的东西。有人可以帮忙解决工具提示的问题吗?

http://plnkr.co/edit/qu1AFWnAMxQE6Z6KKPJx?p=preview

 nv.addGraph(function () {
            var chart = nv.models.linePlusBarChart()
                .margin({top: 30, right: 60, bottom: 50, left: 70})
                //We can set x data accessor to use index. Reason? So the bars all appear evenly spaced.
                .x(function (d, i) { return i })
                .y(function (d, i) { return d[1] })
                .options({ focusEnable: false })
                .showLegend(false);

            chart.xAxis
                .ticks(testdata[0].values.length)
                .axisLabel('Day')
                .tickFormat(function (d) {
                    var dx = testdata[0].values[d] && testdata[0].values[d][0] || 0;
                    return d3.time.format('%m/%d')(new Date(dx))
                });

            chart.y1Axis
                .axisLabel('Total Tests')
                .tickFormat(d3.format(',0f'));

                chart.bars.forceY([0]);

        d3.select('#chart1 svg')
            .datum(testdata)
            .transition().duration(500).call(chart);

        return chart;
    });

0 个答案:

没有答案
相关问题