2X faster development
The ultimate WinForms UI toolkit to boost your development speed.
TrendLines is used to draw lines in the ChartArea. The Trend Line can be added into the chart by using TrendLineAdder class. Using Mouse Events we can draw trend lines. We use utility class to listen to mouse events and convert them into trend lines. We can draw any number of trend lines and we can set the different colors to differentiate. C#// Creating CustomPoints ChartPoint ptStart = this.chart.ChartArea.GetValueByPoint(start); ChartPoint ptEnd = this.chart.ChartArea.GetValueByPoint(end); ChartSeries tseries = this.chart.Model.NewSeries("TrendLine", ChartSeriesType.Line); tseries.Points.Add(ptStart); tseries.Points.Add(ptEnd); this.chart.Series.Add(tseries); tseries.LegendItem.Visible = false; // Specify the color for the lines tseries.Style.Interior = new Syncfusion.Drawing.BrushInfo(ptStart.YValues[0] < ptEnd.YValues[0] ? Color.DarkGreen : Color.Red); VB' Creating CustomPoints Dim tlineAdder As TrendLineAdder Dim ptStart As ChartPoint = Me.chart.ChartArea.GetValueByPoint(start) Dim ptEnd As ChartPoint = Me.chart.ChartArea.GetValueByPoint(end_Renamed) Dim tseries As ChartSeries = Me.chart.Model.NewSeries("TrendLine", ChartSeriesType.Line) tseries.Points.Add(ptStart) tseries.Points.Add(ptEnd) Me.chart.Series.Add(tseries) tseries.LegendItem.Visible = False ' Specify the color for the lines If ptStart.YValues(0) < ptEnd.YValues(0) Then tseries.Style.Interior = New Syncfusion.Drawing.BrushInfo(Color.DarkGreen) Else tseries.Style.Interior = New Syncfusion.Drawing.BrushInfo(Color.Red) End If |
2X faster development
The ultimate WinForms UI toolkit to boost your development speed.
This page will automatically be redirected to the sign-in page in 10 seconds.