Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

DateTime on YAxis of Intensity Graph

Solved!
Go to solution

How can the YAxis of an Intensity Graph be setup for the DateTime data type, similar to the Waveform Graph XAxis?  You can set the MajorDivisions FormatString to DateTime, but there is no way to setup the YAxis values.  The Waveform Graph has a PlotY(double[], DateTime, TimeSpan) function which will setup the XScale with proper DateTime values, but the Intensity Graph does not seem to have a similar capability.  I have tried to setup the Intensity Graph YAxis MajorDivisions Format string to DateTime, and then pass the plot function Tick values for the yScaleStart and YScaleIncrement values, but this is not working probperly.  The MS2012 release notes say that the Intensity Graph now has an AutoFormat to display DateTime on the X and Y axis.  I tried to use this functionality to test the DateTime X and Y axis capability; however, the Auto Formatting function is not available for the Intensity Graph.  Any help is appreciated.

 

Thanks!

Jon

0 Kudos
Message 1 of 2
(5,120 Views)
Solution
Accepted by topic author JonB

Hello there,

 

Try the following piece of code.

 

            // Set the label format correctly
intensityYAxis1.MajorDivisions.LabelFormat = new NationalInstruments.UI.FormatString(NationalInstruments.UI.FormatStringMode.DateTime, "g"); intensityYAxis1.Mode = NationalInstruments.UI.IntensityAxisMode.AutoScaleExact; double[,] data = new double[100, 100]; for (int i = 0; i < 100; i++ ) { for (int j = 0; j < 100; j++ ) { data[i, j] = (i + j) / (colorScale1.Range.Interval * 2); } }
// IntensityGraph only understands double values. But graph can interchange the data value from different types using the DataConverter provided by NI. intensityPlot1.Plot(data, 0, 1, (double)DataConverter.Convert(DateTime.Now, typeof(double)), (double)DataConverter.Convert(TimeSpan.FromDays(1), typeof(double)));

 

 

Hope it helps.

 

Vijet Patankar

National Instruments

Message 2 of 2
(5,117 Views)