Avoid the DateTimeAxis.ToDouble() result in the tooltip

Oystein Bjorke 4 years ago 0
This discussion was imported from CodePlex

maxambrogi wrote at 2013-04-28 00:59:

Hi, using financial series (as Y values) and date time (as X values) I need to use the DateTimeAxis.ToDouble to convert the date time value in the HighLowItem costructor.

This works fine but the tooltip on the chart show the result of the DateTimeAxis.ToDouble method.

There's a way in order to show the date in tooltip using financial series?

Best regards

MaxAmbrogi

objo wrote at 2013-04-29 13:18:

this sounds like a bug in the HighLowSeries.GetNearestPoint method. Added to https://oxyplot.codeplex.com/workitem/10044
It is possible the code should be refactored to let the axes do the formatting of the x and y values!

maxambrogi wrote at 2013-04-29 18:27:

objo wrote:
this sounds like a bug in the HighLowSeries.GetNearestPoint method. Added to https://oxyplot.codeplex.com/workitem/10044
It is possible the code should be refactored to let the axes do the formatting of the x and y values!
Seeing the source code thru browser, probably two actions are required:
  1. new constructor and properties in HighLowItem.cs named xAsStringForTooltip (the date as desired string)
  2. refactor the HighLowSeries.GetNearestPoint method in order to manage the presence the above xAsStringForTooltip property
    I'm right and can I support you?
    Best regards
    MaxAmbrogi

objo wrote at 2013-05-06 10:23:

I have checked in a change that converts the x values to DateTime values before formatting the text of the tooltip. Use the TrackerFormatString in the series to control the format of the date (see examples). My comment about letting the axes do the formatting was not a good idea - the formatting of the dates on the axes may be different.

maxambrogi wrote at 2013-05-29 15:27:

Perfect Objo, many thanks for this!
Best regards
MaxAmbrogi
CodePlex