nv.addGraph(function() {
var chart = nv.models.lineChart()
.width(800).height(420)
.margin({left: 100,right:100}) //Adjust chart margins to give the x-axis some breathing room.
.useInteractiveGuideline(true) //We want nice looking tooltips and a guideline!
.transitionDuration(350) //how fast do you want the lines to transition?
.showLegend(true) //Show the legend, allowing users to turn on/off line series.
.showYAxis(true) //Show the y-axis
.showXAxis(true) //Show the x-axis
;
chart.xAxis //Chart x-axis settings
.axisLabel('X-axis');
chart.yAxis //Chart y-axis settings
.axisLabel('')
.tickFormat(d3.format('.02f'));
d3.select('#graph-chart svg') //Select the <svg> element you want to render the chart in.
.datum(data) //Populate the <svg> element with chart data...
.call(chart); //Finally, render the chart!
//Update the chart when window resizes.
nv.utils.windowResize(function() { chart.update(); });
return chart;
});
there beta的图显示为平面线:
仅带有beta的图:
测试数据
{
"key": "key1",
"values": [
[
1697000000,
19024000000
],
[
1764000000,
19764000000
],
[
1829000000,
21496000000
],
[
2122000000,
20559000000
]
]
},
{
"key": "key2",
"values": [
[
1697000000,
13530000
],
[
1764000000,
41790000
],
[
1829000000,
29280000
],
[
2122000000,
11050000
]
]
}
您可能想使用具有
轴y y y轴
的多人类型。 nvd3网站上似乎没有文档
在NVD3的情况下,您可以为Y轴使用日志刻度。对于这种系列有用。
发现了一些东西,将您在y轴上拥有的所有数据归一化:or
a'(i) = (a(i) - mean(a))/std_dev(a)
a是数据阵列。
a(i) = a'(i) * mean(a) or a(i) = a'(i) * std_dev(a) + mean(a)
chart.yAxis //Chart y-axis settings
.axisLabel('')
.tickFormat(formatter);