We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Custom marker widget on SfCartesianChart

I have a SfCartesianChart with a TrackballBehavior. I would like to have a custom marker, put a widget instead.

From what I tested you can update some parameters (size, border, shape, ...), but you can't pass a completely custom widget.The onMarkerRender does not return a widget either, it returns void.

An example of what I would like (see attachment).

example custom marker.png


By doing something like this :

onMarkerRender: (MarkerRenderArgs markerArgs) {
Measure measure = listMeasuresSelected[markerArgs.seriesIndex];
return Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(
color: AppColors.mapMeasureBorderColor[measure],
width: 1
),
),
child: Padding(
padding: EdgeInsets.all(10),
child: Container(
width: 12,
height: 12,
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(
color: AppColors.mapMeasureBorderColor[measure],
width: 2
)
),
),
),
);
},


Did I miss something? Would it be possible to integrate it in the near future?

Thanks in advance


3 Replies

YG Yuvaraj Gajaraj Syncfusion Team March 9, 2023 02:35 PM UTC

Hi Bouttier,


The requirement can be achieved with the help of a ValueNotifier and CustomPainter widget, here we have rendered a custom marker at the trackball enabled position and hidden it when the trackball gets disappeared. We have created the sample and shared it below for your reference, you can modify it as per your requirement.





Regards,

Yuvaraj.



Attachment: f180987_72a60ebf.zip


BO Bouttier March 9, 2023 03:29 PM UTC

Perfect, like every time. Thank you



YG Yuvaraj Gajaraj Syncfusion Team March 10, 2023 10:32 AM UTC

Most Welcome. Kindly get back to us if you have further queries. We are always happy to assist you.



Loader.
Live Chat Icon For mobile
Up arrow icon