如何在NVD3图上显示2行不同范围 我正在使用NVD3库绘制线路图,它绘制了两行,但两个行值都有很大的差异,一行(线1)的值接近500,第二行(第2行)具有值B。 .

问题描述 投票:0回答:3
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的图:

enter image description here

Edit:

测试数据

enter image description here { "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网站上似乎没有文档
javascript jquery graph nvd3.js
3个回答
1
投票
http://krispo.github.io/angular-nvd3/#/multichart

在NVD3的情况下,您可以为Y轴使用日志刻度。对于这种系列有用。

发现了一些东西,将您在y轴上拥有的所有数据归一化:

a'(i) = a(i)/mean(a)

or

0
投票
a'(i) = (a(i) - mean(a))/std_dev(a)

a是数据阵列。

0
投票

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);

	

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.