0
我試圖讓兩條線使用兩個不同的比例。NVD3圖:使用muiltiChart /多個yScales繪製切換會導致軸消失,但不是繪圖
當我嘗試切換繪圖時,網格線消失,而不是圖。
你能弄清楚我做錯了什麼嗎?
var dataset1 = {
values : [],
key : "Math.cos",
type: "line",
color: '#2ca02c',
yAxis: 1
};
var dataset2 = {
values : [],
key : "sin",
type: "line",
color : "#ff7f0e",
yAxis: 2
};
for (var i = -3.14; i < 3.1415; i+= .01){
dataset1.values.push({ x: i , y : Math.cos(i) });
dataset2.values.push({ x: i , y : Math.sin(i) * 3 });
}
var data = [dataset1, dataset2];
nv.addGraph(function() {
var chart = nv.models.multiChart()
.margin({top: 30, right: 60, bottom: 50, left: 70})
.color(d3.scale.category10().range());
chart.xAxis
.tickFormat(d3.format(',.2f'));
chart.yAxis1
.tickFormat(d3.format(',.1f'));
chart.yAxis2
.tickFormat(d3.format(',.1f'));
d3.select('#chart svg')
.datum(data)
.transition().duration(500).call(chart);
return chart;
});
沒有做任何的反覆? –
它使用內置的D3切換選項...我附加了一個圖像。謝謝。 – Derrick
哦,我明白了。看起來像是一個NVD3的bug。 –