How can I get Trendline's value?

스크린샷 2024-03-27 165000.png


I want to get the trendline's value.

And I want to get the diffrence the 3500 and trendline.


How can I get the trendline value at that point.


3 Replies

DR Dhanaraj Rajendran Syncfusion Team March 29, 2024 05:48 AM UTC

Hi Lee,

 

We have validated your query and would like to inform you that the trend line displays the data point trends. Therefore, tooltips are not displayed for SfChart trendlines.

 

Alternatively, we recommend using the crosshair support, which displays the x and y values when mouse hovering over the SfChart. Please refer to the following documentation:

 

Documentation Link: Crosshair Documentation

 

We hope this meets your requirements. Please let us know if you need further assistance.

 

Regards,

Dhanaraj Rajendran.



IL I Lee March 29, 2024 07:30 AM UTC

답변 감사합니다.


보고서를 작성해야 하므로 값이 필요합니다.

따라서 C# 코드의 모든 X 포인트 값이 필요합니다.

이것을 어떻게 얻을 수 있나요?



DR Dhanaraj Rajendran Syncfusion Team April 1, 2024 04:08 PM UTC

Hi Lee,


We have examined your query. As we mentioned previously that we do not have direct support to get the points from the trendline. However, we can get the points using the mouse move event by line series with trendline. We can show the Y value to the Label content.

If you need to get the difference between the trendvalue and graph’s Y value, you can get the value from mouse move event of series.

Here we attached the sample for your reference. You can also refer to the below provided code snippet to get the Y value.

private void LineSeries_MouseMove(object sender, MouseEventArgs e)

{

    var series = sender as ChartSeries;

 

    Point mousePoint = new Point

    {

        X = e.GetPosition(series).X,

        Y = e.GetPosition(series).Y

    };

 

    double yValue = this.myChart.PointToValue(this.myChart.SecondaryAxis, mousePoint);

 

    chartLabel.Content = yValue.ToString();

}


Output:


We hope this meets your requirements. Let me know if you need further assistance.


Regards,

Dhanaraj Rajendran.


Attachment: SF_F187456_6425dccf.zip

Loader.
Up arrow icon