From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Y-Axes slows WaveformGraph down

Hi,

 

I want to use multiple y-axes in a WaveformGraph to scale single waveforms without caching all data points and plot them again.

 

The attached minimal sample shows the behaviour with and without multiple y-axes. In the screenshot “MultiAxes.png” each waveform has its own y-axis. In the screenshot “SingleAxis.png” all waveforms use the same y-axis. Without using multiple y-axes the time to reconfigure the graph reduces from 3.3 seconds to 0.5 seconds.

 

How can I shorten the time to rebuild the WaveformGraph without omit use of multiple y-axes?

 

Best regards,

Stephan

Download All
0 Kudos
Message 1 of 5
(4,704 Views)

Hi Stephan,

 

Would you please give me the details about which Visual Studio/Measurement Studio you are using?

 

Best regards

Christoph

Staff Applications Engineer
National Instruments
Certified LabVIEW Developer (CLD), Certified LabVIEW Embedded Systems Developer (CLED)


Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved
0 Kudos
Message 2 of 5
(4,668 Views)

Hi Christoph,

 

I am using Visual Studio 2012 and Measurement Studio 2013.

 

Best regards,

Stephan

0 Kudos
Message 3 of 5
(4,647 Views)

Hi Stephan,

 

I would like to point you to the source code. There you see a clear difference in behaviour between only one axis and multiple axes. The for loop runs either 1 or number of waveforms (e.g. 200) which should account for a difference in computation time.

 

 

if (true == mMultiAxesCheckBox.Checked)
	axesCount = mWaveformCount;
else
	axesCount = 1;

for (int i = 0; i < axesCount; i++)
{
	var yAxis = new YAxis();
	SetAxisInvisible(yAxis);
	yAxis.Range = CalcRange(i, 1.0);
	yAxis.OriginLineVisible = true;

	yAxes.Add(yAxis);
	//mGraph.YAxes.Add(yAxis);
}

 

Best regards

Christoph

Staff Applications Engineer
National Instruments
Certified LabVIEW Developer (CLD), Certified LabVIEW Embedded Systems Developer (CLED)


Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved
0 Kudos
Message 4 of 5
(4,644 Views)

Hi Christoph,

Thank you for your fast answer.

As you can find in row "Axes created" of the following table the loop you point to consumes only 12 ms of the CPU time.

 

Axis Count

1 Axis

200 Axes

200 Axes without optimization

Clear axes

14 ms

943 ms

2796 ms

Axes created

0 ms

12 ms

7 ms

Axes added

1 ms

453 ms

2373 ms

Clear plot

40 ms

372 ms

2336 ms

Waveforms added

37 ms

393 ms

2338 ms

Plot samples added

113 ms

106 ms

109 ms

Clear annotation

25 ms

360 ms

2312 ms

Annotations added

281 ms

657 ms

2650 ms

Total

535 ms

3312 ms

14938 ms

 

The problem is that all actions on the graph take much longer if I add multiple axes however the amount of plotted data is the same.


I am searching for a optimization like I have used in the method SetAxisInvisible(). See the lines after the comment in the following code snipped. The time behaviour without this optimization I have added to the table above in column "200 Axes without optimization".

 

private void SetAxisInvisible(Axis axis)
{
	axis.Visible = false;
	axis.Mode = AxisMode.Fixed;
	// the following lines doesn't change anything on the appearance of the axis because 
	// the whole axis is invisible but they improve the performance of the graph drastically
	axis.AutoSpacing = false;
	axis.CaptionVisible = false;
	axis.EndLabelsAlwaysVisible = false;
	axis.MajorDivisions.GridVisible = false;
	axis.MajorDivisions.LabelVisible = false;
	axis.MajorDivisions.TickVisible = false;
	axis.MinorDivisions.GridVisible = false;
	axis.MinorDivisions.TickVisible = false;
}

 

Best regards,

Stephan

0 Kudos
Message 5 of 5
(4,637 Views)