Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

c# current time x-axis

Solved!
Go to solution

I'm trying to have the current time be shown on the x axis on the waveform graph but it always start from 12 am and counts normally after that.

 

How do I get it to start from the current time at this moment.

 

private void timer1_Tick(object sender, EventArgs e)
        {

            gauge2.Value = Convert.ToInt32(rxString);

            waveformGraph1.XAxes[0].MajorDivisions.LabelFormat = new NationalInstruments.UI.FormatString(NationalInstruments.UI.FormatStringMode.DateTime, "hh:mm:ss tt");

            waveformGraph1.PlotYAppend(Convert.ToInt32(rxString));                 
      
        }        

time

0 Kudos
Message 1 of 3
(4,453 Views)

I also added this code before the append and still nothing.

 

            waveformPlot1.DefaultWaveformPlotOptions = new AnalogWaveformPlotOptions(AnalogWaveformPlotDisplayMode.Time, AnalogWaveformPlotScaleMode.Raw);
            waveformPlot1.DefaultTiming = WaveformTiming.CreateWithRegularInterval(TimeSpan.FromSeconds(1), DateTime.Now);    

             waveformGraph1.XAxes[0].MajorDivisions.LabelFormat = new NationalInstruments.UI.FormatString(NationalInstruments.UI.FormatStringMode.DateTime, "hh:mm:ss tt");
0 Kudos
Message 2 of 3
(4,438 Views)
Solution
Accepted by topic author cheece2001

looks like i figured it out .

 

just added this

 

 

this.waveformPlot1.DefaultStart = (double)DataConverter.Convert(DateTime.Now, typeof(double)); 
0 Kudos
Message 3 of 3
(4,435 Views)