Hi, the value of my datapoints are ticks. i would like to convert them to DateTime format for showing them in the chart. Can i apply a IValueConverter or does anybody know another solution? i am using a stacked bar chart.
Thanks a lot.
k.
Rainer,
You can use IValueConverter, and one of the overloads on DateTime is passing Ticks as long integer. Here is an example in IValueConverter:
long ticks = System.Convert.ToInt64(parameter); // parameter is a tick value (633026088592552384)DateTime temp = new DateTime(ticks); return System.Convert.ToDateTime(temp);
Let me know if you have any question.
Sam
Hi and thanks for your hints. The problem is i do not know where to apply the IValueConverter. On the axis? Which property? Do i need a template for datapoints? On a series property?
Thanks a lot. k.
Reiner,
X axis lables on StackedBar chart do not associate with DataPoints. They simply represent text, marked on the axis, like tick marks.
Have you considered using TimeLine control? Take a look at the following link and see if it may deliver what you are looking for:
http://help.infragistics.com/NetAdvantage/WPFDV/2010.2/CLR4.0/?page=SL_DV_Developers_Guide_xamWebTimeline.html
Hi, thanks for your help but it does not solve my issue.
The problem is i have a stacked bar chart, not a scatter chart, so i cannot have DateTime datapoints. I do not need to convert between my values and a datapoint. I need to convert between a datapoint and its visualisation on the x-axis in the chart. So that a datapoint with 633011240000000000 ticks is showing in date format on the x-axis. And that in a stacked bar chart.
Is this possible at all?
thanks a lot. r.
The DataPoints have to be set to the returned value from IValueConverter.
I am attaching a sample that demonstrates it. The Unit of the Min/Max may be a little tricky depending on Ticks you are suplying to the converter. The sample is using an arbitrary date to demonstrate it.
Please test it and let me know if you have any question.