Annotation position

Hi,

I'm trying to put annotations on const position (only x) my y is DateTime and X is double, as shown in the picture:

I using 

LineSeries<GetSymbolChartRespItemDto, DateTime> lineChart()

Is it possible to achieve this?


1 Reply

NR Natrayan Ramalingam Syncfusion Team February 7, 2023 01:26 PM UTC

Hi Bar,


Your requirement can be achieved with the help of the axisLabelFormatter callback which is available in the axis and also you can customize the text from the callback argument by using the textStyle and return it as ChartAxisLabel. Please refer to the following code snippet.


primaryYAxis: NumericAxis(

   axisLabelFormatter: (args) {

       return ChartAxisLabel(

              args.text,

              args.text == "79.72" || args.text == "79.74"

                  ? const TextStyle(

                      backgroundColor: Colors.black,

                      color: Colors.white,

                    )

                  : args.textStyle,

      );

   },

)


Screenshot:

Chart, line chart

Description automatically generated


For more details, refer to the UG:

https://help.syncfusion.com/flutter/cartesian-charts/callbacks#axislabelformatter


Regards,

Natrayan


Loader.
Up arrow icon