0

LHS 軸 ("y") にいくつかのシリーズを表示し、RHS 軸 ("other y") にいくつかのシリーズを表示する折れ線グラフを作成しようとしています:

//Init chart and set theme
var myChart = new Chart("graphDiv")
myChart.setTheme(theme)

//Add plot for LHS axis
myChart.addPlot("default", {
    type: Lines,
    markers: true,
    hAxis: "x",
    vAxis: "y"
})

//Add additional plot for RHS axis
myChart.addPlot("other", {
    type: Lines,
    markers: true,
    hAxis: "x",
    vAxis: "other y"
})

//Add axis
myChart.addAxis("x", {
    fixUpper: "major",
    fixLower:"minor"
})
myChart.addAxis("y", {
    title: "Y Axis Left",
    vertical: true,
    fixUpper: "major",
    fixLower:"minor"
})
myChart.addAxis("other y", {
    title: "Y Axis Right",
    vertical: true,
    leftBottom: false,
    fixUpper: "major",
    fixLower:"minor",
})

//Add the data
myChart.addSeries('test1',[{x:1,y:2},{x:2,y:2},{x:3,y:2},{x:4,y:2}],{plot:'default'})
myChart.addSeries('test2',[{x:1,y:3},{x:2,y:3},{x:3,y:3},{x:4,y:3}],{plot:'default'})
myChart.addSeries('test3',[{x:1,'other y':5},{x:2,'other y':5},{x:3,'other y':5}, x:4,'other y':5}],{plot:'other'})
myChart.render()

2 番目の軸はレンダリングされず、2 番目のプロット (「その他」) のデータはレンダリングされません。ただし、console.log(myChart)myChart.series にすべてのデータがあることがわかります。コンソール ウィンドウにエラーはありません。私は Dojo 1.9 と chrome を使用しています。

ああ!

私が間違っていることはありますか?

4

1 に答える 1

2

他のプロットのように、データ フィールド「other y」を「y」に設定します。プロパティは、軸名ではなく、x または y である軸に対応します。つまり、3 番目のシリーズは次のようになります。

myChart.addSeries('test3',[{x:1,y:5},{x:2,y:5},{x:3,y:5}, {x:4,y:5}],{plot:'other'})

この例ではそのシリーズをアニメーション化して目立つようにしました: http://jsfiddle.net/psoares/nYtAg/

于 2013-07-29T14:32:05.627 に答える