overriding methods on CrosshairBehaviorRenderer

Hey, I would like to override the onTouchDown, onTouchMove, etc... methods of the CrosshairBehaviorRenderer class, but how would I go about doing that since I only supply a CrosshairBehavior to the SfCartesianChart.


Thank you in advance!


4 Replies

SK Sriram Kiran Senthilkumar Syncfusion Team September 21, 2021 03:56 PM UTC

Hi Luca, 
  
Greetings from Syncfusion. We have analyzed your query at our end and currently, we have not provided support to override the methods of CrosshairBehaviorRenderer class in our chart widget. However, we kindly request you to share with more details on your requirement or what you are trying to achieve by overriding those methods in your application. So that it will be helpful for further analysis at our end to consider this a new feature request or if any possible workarounds can be done in order to achieve the required behavior. 
  
Regards, 
Sriram Kiran 



LU Luca September 21, 2021 04:11 PM UTC

 I wish to override the methods of the CrosshairBehaviorRenderer such that I can make it so the crosshair can be moved along a single axis at a time (so when touching the vertical line of the crosshair, only the x value will change, and the y-value will remain the same). We need this for our application as we are using the crosshair for the user to graphically input data into the graph, but the y-value must be able to stay the same, if the user only wants to change the x-value.


I was trying to do this by overriding the onTouchDown to check if it is near the x or y line from the crosshair, and then setting a "selectionMode" (kind of like zoomMode) to a single axis so SelectionMode.x or SelectionMode.y or SelectionMode.xy or SelectionMode.none (if not near the crosshair)


After that, I override the onTouchMove method so that if selectionMode is set to x for example, then only the x-value will change, etc.


I have uploaded a sample extension class that showcases this.


Kind regards, Luca


Attachment: crosshair_selection_behavior.dart_ee412f8b.zip


LU Luca September 21, 2021 04:14 PM UTC

I am aware that I might be able to use the chart interaction callbacks, and I've tried this solution, but it turns out to be very buggy in combination with the onCrosshairPositionChanging callback.



SK Sriram Kiran Senthilkumar Syncfusion Team September 22, 2021 02:10 PM UTC

Hi Luca, 
  
Thanks for the update. We have analyzed your requirement at our end, and as mentioned earlier, currently, we do not have support to override the methods of interaction behaviors in the chart. However, we will consider this as a feature request and have logged feedback for in our feedback portal regarding to provide support to override the methods of interaction behaviors in cartesian chart. We will plan and include the requested feature in any of our upcoming releases yet to come. You can also track the status of the feature using the below feedback link. 
  
  
Regards,
Sriram Kiran 


Loader.
Up arrow icon