Issue with DateTime Label/Axis and fixed interval

Hi,

I have related post in a wrong section (winForm). I create this one here to clarify my issue.

I need to display financial indicator on a WPF chart. It's a real time data with one new point every minute. I have 2 main requirements.

- I want to have the x-axis line/label every hour (at 9:00, 10:00, 11:00 ....).

- I want to have a dynamic range.  I want to always display all the data and keep the range as small as possible.   A normal chart has the first point at 8:50 and last one at 3:30.

So the chart should to start the day with something like 1H range and progressively extend to 9H range.

Actually I have used  the following settings and that works pretty well, but there is something wrong with  the X labels.

IsAutoSetRange="True"

PrimaryAxis.MinimumDateTimeInterval = new TimeSpan(1, 0, 0);

The issue is that the label display are not stable. It is continously oscillating between   XX:00 and XX:59 ( ex : 8:59 <-> 9:00).

I told my co-worker it is a "normal quantum mechanics issue" but look I need a better explanation.

There is a way to solve that issue.

I have attached a sample which simulate a day.

 

Also ideally, as the first point start 8:50, I want the chart to start at 8:50 but I want the first line at 9:00 and every plain hour (9:00 10:00, 11:00 ....).

There was DateTimeOffset property to solve that problem in WinForm chart. Do we have the same thing in WPF ??



ChartSample1_27c23a7a.zip

5 Replies

MK Muneesh Kumar G Syncfusion Team December 18, 2013 06:19 AM UTC

Hi Rodolphe,

Thanks for using Syncfusion products.

As per your requirement we have modified your sample. Please find the modified sample from the following location.

Sample: http://www.syncfusion.com/downloads/support/directtrac/117003/ChartSample992102953.zip

Please let us know if you have any queries.

Regards,

Muneesh Kumar G.



RB Rodolphe Billottet December 19, 2013 05:07 AM UTC

Hi Muneesh

Thanks, for your reply and code sample.

Basically the solution is not to use the "AutoSetRange" and to manage the range internally. I will use that solution.

 

What about the DateTimeOffset ?

Is there a way to add an Offset between the begining of the chart and the first line/interval.

I have attached a image as sample of what I want.

 

Best regards,

Rodolphe



ChartIntervalWithOffset.png_7aff3d4b.zip


MK Muneesh Kumar G Syncfusion Team December 21, 2013 12:51 PM UTC

Hi Rodolphe,

Thanks for your update.

We can achieve label offset by setting IntervalOffset property as per the below code snippet.

Code Snippet [XAML]:

<syncfusion:ChartAxis x:Name="xaxis"  IntervalOffset="-0.2"

LabelTemplate="{StaticResource labelsTemplate}"  OpposedPosition="True" ValueType="DateTime"

LabelDateTimeFormat="HH:mm" EdgeLabelsDrawingMode="Shift" IsAutoSetRange="True" >

 

We have prepared a sample based on this and you can find the sample under the following location:

Please let us know if you have any queries.

Regards,

Muneesh Kumar G.

 



ChartSample_86450bc4.zip


RB Rodolphe Billottet January 8, 2014 10:02 AM UTC

Hi Muneesh,

 

Thanks for your reply.

For some reason, I can't access sample files.

So I have modified my code, adding   IntervalOffset="-0.2"  in the xaml code.

It is not exactly what I want; because now all the line are shifted by 12min

My first initial requirements is to have all x-axis line/label every hour (at 8:00 ,9:00, 10:00, 11:00 ....),

and I have 8:00 then 8:12, 9:12,  10:12,  11:12...

Maybe I have missed something.

Please let me know...

 

Regards,

Rodolphe

 

 



KV Karthikeyan V Syncfusion Team January 15, 2014 04:57 AM UTC

Hi Rodolphe,

 

Thanks for the update.

 

We have analysed the reported query and you can achieved your requirement by setting both IntervalOffset and MinimumDateTimeInterval properties.

 

Code snippet [XAML]:

 

  <syncfusion:ChartAxis x:Name="xaxis"  IntervalOffset="-0.2"                                              LabelTemplate="{StaticResource labelsTemplate}" MinimumDateTimeInterval="1:0:0"  OpposedPosition="True" ValueType="DateTime"  LabelDateTimeFormat="HH:mm" EdgeLabelsDrawingMode="Shift" IsAutoSetRange="True" >

 

We have prepared a sample based on this. Please find the sample under the following location.

 

Please let us know if you any query.

 

Thanks,

Karthikeyan V.



ChartSample_854681ad.zip

Loader.
Up arrow icon