Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Y Axes Reference

How do I reference a plot to the second Y axis?

Using the example Multiple Y Axis....
I want Plot 2 to reference the seconds Y axis, however, it always references the first Y axis
void CMultipleYAxisDlg::OnGenerateData()
{
int i;
CNiReal64Vector RedData(100);
CNiReal64Vector MagentaData(100);
CNiReal64Vector WhiteData(100);

for (i = 0; i < 100; i++)
{
MagentaData[i] = -25;
WhiteData[i] = 125; // always references 1st Y axis on right side
RedData[i] = 700;
}
m_Graph.GetPlots().Item(1).PlotY(MagentaData,0,1);
m_Graph.GetPlots().Item(2).PlotY(WhiteData,0,1);
m_Graph.GetPlots().Item(3).PlotY(RedData,0,1);
}
0 Kudos
Message 1 of 2
(3,041 Views)
The CNiPlot class has a YAxis property whose type is CNiAxis. You should set this property to the axis that you want associated with the plot. For example, assuming your graph has at least two plots and at least two y axes, you could do this:

m_Graph.Plots.Item(2).YAxis = m_graph.Axes.Item(3);

- Elton
0 Kudos
Message 2 of 2
(3,041 Views)