XY Chart NET 3 Control Reference
Trend Property

Use this property to return/set values that determines the chart's trending characteristics.   Trend uses the Trend Class set of properties for its characteristics.

Syntax
[Visual Basic]
Property Trend() As C_Trend
[C#]
XYChartNet.XYChartNETCtl.C_Trend XYChartNETCtl.Trend
[C++]
property XYChartNet::XYChartNETCtl::C_Trend ^ XYChartNet::XYChartNETCtl::Trend
       
Example
' XYChartNETCtl1 is the name of the XY Chart NET control instance placed on the form.

Dim TrendSample As Integer

'Trend - command button control
'Trending commences upon first click; trending stops upon second click.
Private Sub Trend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Trend.Click
   If TrendTimer.Enabled Then
      TrendTimer.Enabled = False
      XYChartNETCtl1.Trend.Enable = False
      XYChartNETCtl1.Refresh()
   Else
      With XYChartNETCtl1
         .ClearChartData()
         .Trend.Enable = True
         .Trend.DisplayLength = 50
         .Refresh()
      End With
      TrendSample = 1
      With TrendTimer
         .Interval = 100
         .Enabled = True
      End With
   End If
End Sub

'TrendTimer - timer control
Private Sub TrendTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrendTimer.Tick
   Dim arrData(0, 1) As Integer

   arrData(0, 0) = TrendSample
   arrData(0, 1) = Int((201) * Rnd - 100)

   XYChartNETCtl1.Trend.AddData(1, arrData)
   XYChartNETCtl1.Refresh()

   TrendSample += 1
End Sub
// XYChartNETCtl1 is the name of the XY Chart NET control instance placed on the form.

private int TrendSample;

//Trend - command button control
//Trending commences upon first click; trending stops upon second click.
private void Trend_Click(object sender, System.EventArgs e)
{
    if (timer1.Enabled)
    {
       timer1.Enabled = false;
       XYChartNETCtl1.Trend.Enable = false;
       XYChartNETCtl1.Refresh();
    }
    else
    {
       XYChartNETCtl1.ClearChartData();
       XYChartNETCtl1.Trend.Enable = true;
       XYChartNETCtl1.Trend.DisplayLength = 50;
       XYChartNETCtl1.Refresh();

       TrendSample = 1;

       timer1.Enabled = true;
       timer1.Interval = 100;
    }
}
           
//timer1 - timer control
private void timer1_Tick(object sender, System.EventArgs e)
{
    double [,] NewData = new double [1, 2];

    NewData[0, 0] = TrendSample;
    NewData[0, 1] = 30 * rnd.NextDouble() + 70;

    // Add new trend data to chart array
    XYChartNETCtl1.Trend.AddData(1, NewData, XYChartNet.XYChartNETCtl.AppendOpts.aoAppendToEnd);
    XYChartNETCtl1.Refresh();

    TrendSample += 1;
}
// XYChartNETCtl1 is the name of the XY Chart NET control instance placed on the form.

private: int TrendSample;

//Trend - command button control
//Trending commences upon first click; trending stops upon second click.
private: System::Void Trend_Click(System::Object *  sender, System::EventArgs *  e)
    {
        if (timer1->Enabled)
        {
           timer1->Enabled = false;
           XYChartNETCtl1->Trend->Enable = false;
           XYChartNETCtl1->Refresh();
        }
        else
        {
           XYChartNETCtl1->ClearChartData();
           XYChartNETCtl1->Trend->Enable = true;
           XYChartNETCtl1->Trend->DisplayLength = 50;
           XYChartNETCtl1->Refresh();
              
           TrendSample = 1;
              
           timer1->Interval = 100;
           timer1->Enabled = true;
        }       
    }

//timer1 - timer control
private: System::Void timer1_Tick(System::Object *  sender, System::EventArgs *  e)
    {
        double NewData __gc[,]  = new double __gc[1, 2];

        NewData[0, 0] = TrendSample;
        NewData[0, 1] = 30 * rnd->NextDouble() + 70;

        // Add new trend data to chart array
        XYChartNETCtl1->Trend->AddData(1, NewData, XYChartNETCtl::AppendOpts::aoAppendToEnd);
        XYChartNETCtl1->Refresh();

        TrendSample += 1;
    }
See Also

 

 


© 2003 - 2013 ControlEng Corporation. All rights reserved.