Evaluate points on spline chart

First of all thanks a lot syncfusion for such a amazing library
I have successfully plotted the spline chart using my discrete points, But now I want values from graph. for eg. by giving the value of x, I can get value of y.
I have tried to find anything which can help me out in this case but failed.
So, Can you please help me ?
   

3 Replies 1 reply marked as answer

SK Sriram Kiran Senthilkumar Syncfusion Team October 22, 2020 04:29 PM UTC

Hi Harshit, 
  
Greetings from Syncfusion. We have analyzed on your scenario and we are not exactly sure of what you have proposed in this query (I want values from graph. for eg. by giving the value of x, I can get value of y). So, we kindly request you to share us with more information on your exact requirement in detail along with some examples so that it will helpful in further analysis for providing the solutions sooner. 
  
Regards, 
Sriram Kiran 
  
  



HA HARSHIT October 23, 2020 02:41 AM UTC

Thank you for such quick response
I have plotted my spline series using this dataset:

 final List<SalesData> chartData = [
      SalesData(00),
      SalesData(0.0000560.00079),
      SalesData(0.000140.00223),
      SalesData(0.000280.0062),
      SalesData(0.0004210.0107),
      SalesData(0.0008420.0259),
      SalesData(0.00140.0473),
      SalesData(0.001970.0685),
      SalesData(0.002970.104),
      SalesData(0.0040.16),
    ];
My code is similar to that which is given as example in Spline Series example

 Container(
              height: 500,
              child: SfCartesianChart(
                  zoomPanBehavior: ZoomPanBehavior(
                      // Enables pinch zooming
                      enablePinching: true),
                  // Enable tooltip
                  tooltipBehavior: TooltipBehavior(enable: true),
                  series: <CartesianSeries>[
                    SplineSeries<SalesDatadouble>(
                      dataSource: chartData,
                      xValueMapper: (SalesData sales, _) => sales.xcomp,
                      yValueMapper: (SalesData sales, _) => sales.sales,
                    ),
                  ]),
            ),

Everything is working fine, And Spline graph is also plotted.
But Now, I need points on this graph, I have 10 points of dataset but I need more points.
For eg. I need y axis value(named as sales here) for the value of xcomp like - 0.0001, 0.0002, 0.0003, 0.0004.....0.0040.
I think it's pretty clear what I need from Spline series.
Hoping for solution of my problem
Thanks a lot
Harshit
+91-8542040809




SK Sriram Kiran Senthilkumar Syncfusion Team October 23, 2020 02:54 PM UTC

Hi Harshit, 
  
We have analyzed your scenario with the provided information, and we are sorry that we do not have support to get the y-axis values from the chart series by providing x-axis values in the chart. As we render our chart series as segments from one point to another, and so it is not possible to obtain the other points of the series. This is the default behavior. 
However, we would like to share some information regarding the CrosshairBehavior feature available in the chart with which you can be able to view the respective y-axis values of for the provided x-axis value by doing user interaction in the chart which we think that it would be helpful. Please refer the code snippet below. 
SfCartesianChart( 
            primaryXAxis: NumericAxis( 
                interactiveTooltip: 
                    InteractiveTooltip(enable: true, decimalPlaces: 6)), 
            primaryYAxis: NumericAxis( 
                interactiveTooltip: 
                    InteractiveTooltip(enable: true, decimalPlaces: 6)), 
            // Enabled crosshair behavior for the chart 
            crosshairBehavior: CrosshairBehavior( 
              enable: true, 
            ), 
            series: <ChartSeries<_SalesData, double>>[ 
              SplineSeries<_SalesData, double>( 
                dataSource: chartData, 
                xValueMapper: (_SalesData sales, _) => sales.xComp, 
                yValueMapper: (_SalesData sales, _) => sales.sales, 
             
           
 
Screenshot: 
 
  
The sample for reference can be found below. 
  
Please check with the above-attached sample and revert us if you still have further concerns. 
  
For further reference on the CrosshairBehavior, please check the user guide below. 
  
Also, to mention that, we want to share a general information regarding a new feature we are currently working at our end regarding to provide support to convert tapped location to data points in Cartesian chart. We are planning to include this feature in our upcoming vol 4 main release which is expected to be rolled out by end of this year (December 2020). You can also track the status of the feature using the below feedback link. 
 
Please get in touch with us if you would require further assistance. 
 
Regards, 
Sriram Kiran 


Marked as answer
Loader.
Up arrow icon