Hi Benyamin,
Greetings from Syncfusion. We have analyzed your scenario at our end and for your case, we recommend that you can use the PlotBand feature available in our chart widget to render horizontal line for y-points in the chart. We have also attached a simple chart sample below in which have rendered a horizontal line in the chart using the PlotBand feature.
|
SfCartesianChart(
primaryXAxis: DateTimeAxis(),
primaryYAxis: NumericAxis(
plotBands: [
PlotBand(
start: 32, // y-point for with the horizontal line needs to be drawn.
end: 32,
borderColor: Colors.red,
borderWidth: 2, // set the border width for the horizontal line.
associatedAxisStart: DateTime(2002) // set the required value for assicoated x-axis start property
)
]
),
) |
For further reference on the Plotband feature, please check the user guide below.
Please check with attached sample and revert us if you still have further concerns on this.
Also, to mention that, if you require to render the line on tapping on the chart, you can use the on PixelToPoint method to achieve it. Please find the sample link below for further reference.
Regards,
Sriram Kiran.