Displaying annotation off-chart using primary datetimeaxis

Hi,

I have a chart with a DateTimeAxis as the x-axis, and NumericalAxis as the Y-axis.

My aim is to draw a ViewAnnotation off-chart and above a specified DateTime. See the mockup image below for what I'm trying to achieve - annotation is the label above X: "00:00".


graph_mockup.png


Here's my progress:

I've set the annotation's CoordinateUnit to pixels in order to draw it outside of the chart area. Which means I need to convert the DateTime value into a pixel value. I've tried using the ValueToPoint method on the chart, i.e:

annotation.X1 = chart.ValueToPoint(chart.PrimaryAxis, ??? );

But I can't seem to figure out how to convert my datetime to a double value, and OADate doesn't seem to give the correct value when I try using it.


Any help to build on my attempt or to suggest an entirely different solution would be great,

Thanks!


3 Replies

GM Gayathri Manickam Syncfusion Team January 28, 2022 03:52 PM UTC

HI Joe OShea, 
 
Currently we are validating the reported query and we will update you the complete details on 31st January 2022. 
 
Thanks, 
Gayathri M. 



JO Joe OShea January 31, 2022 09:13 AM UTC

Hi,

Just an update but I've managed to fix my issue, and I'm not entirely sure why! 

Using OADate & ValueToPoint seem to work as intended.

Thanks for looking into it anyway



GM Gayathri Manickam Syncfusion Team January 31, 2022 02:47 PM UTC

Hi Joe OShea,  
 
We are glad to hear that you have resolved the reported issue. Please let us know if you have any further assistance on this. 
 
Regards,  
Gayathri M 


Loader.
Up arrow icon