Question

I'm trying to create a line graph with some series displayed on the LHS axis ("y") and some series on the RHS axis ("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()

The second axis is not rendered and the data for the second plot ("other") is not rendered. However, if I console.log(myChart) I can see in myChart.series that all the data is there! There are no errors in the console window, I'm using Dojo 1.9 and chrome.

ahhh!

Any ideas what I'm doing wrong?

Was it helpful?

Solution

Set your data field "other y" to be "y", as in the other plot. The property corresponds to the axis being x or y, not to the axis name. i.e. your third series should be :

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

I animated that series in this example so it stands out : http://jsfiddle.net/psoares/nYtAg/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top