Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

synchronize two Graphs

Hello

 

I have two scattergraphs with the same XAxis Range. When I zoom in, the YAxis is scaled new and the graphs look like in the attached jpg.

Is it possible to draw the plotarea with the same width?

 

Best regards

 

Gerald

 

 

0 Kudos
Message 1 of 2
(3,381 Views)

Hi Gerald,

as far as I have seen the PlotAreaBounds attributes are readonly.

 

Therefore, in order to align your y axes, you would have to perform a small workaround (C# example):

 

 

private void button1_Click(object sender, EventArgs e)
{
int[] dimensions = new int[3];

// aligns the graphs to the left border of a plot

// scattergraph1: master graph
dimensions[0] = scatterGraph1.PlotAreaBounds.Left; // left plot area border (master plot)
dimensions[1] = dimensions[0]-scatterGraph1.Left; // space for y axes
dimensions[2] = scatterGraph2.PlotAreaBounds.Left; // left plot area border (slave plot)

// set slave graph plot
scatterGraph2.Left += dimensions[0] - dimensions[2]; // move graph by required amount
scatterGraph2.Width -= dimensions[0] - dimensions[2]; // crop graph

}

 

This code will simply move the second graph in order to align the graph borders. The result will look like pictured in the attached image.

 

Please let us know if you need more information. 

 

Best regards

 

 

Message Edited by PaSB on 07-31-2009 03:54 PM
--
Peter A.
Field Sales Engineer, NI Germany
0 Kudos
Message 2 of 2
(3,351 Views)