We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Issues with SfChart date time labels

Hi.  I am trying to use SfChart to produce a simple chart of pressure (weather pressure) from the last 6 hours with readings taken every 30 minutes.  My data collection has 13 rows .. being the opening reading (eg) at 11:30, then every 30 minutes up to 17:30 .. making 6 hours of data.

I cannot get sensible time labels on the primary axis, which is a DateTimeAxis.  I would like the times shown to be either hourly, 2 hourly or something useful - but instead I get 12:00, 14:24 and 16:48 for the above data.  To re-iterate, all my data is on 30 minute boundaries - there is no data at 14:24, 16:48.

 

I've tried just about every possible combination of DesiredIntervalsCount, etc to no avail.  I'm at wits end as this is not really OK for me to go live with. 

 

I've provided a link to a sample chart produced by SfChart, and the XAML used to produce this is below:

<Charts:SfChart >
  <Charts:SfChart.PrimaryAxis>
    <Charts:DateTimeAxis MajorGridLineStyle="{StaticResource MajorTickLineStyle}"
      MinorGridLineStyle="{StaticResource MinorTickLineStyle}"
      LabelsPosition="Outside"
      LabelFormat="HH:mm"
      SmallTicksPerInterval="5"
      DesiredIntervalsCount="4">
    </Charts:DateTimeAxis>
  </Charts:SfChart.PrimaryAxis>
  <Charts:SfChart.SecondaryAxis>
    <Charts:NumericalAxis DesiredIntervalsCount="5" />
  </Charts:SfChart.SecondaryAxis>
  <Charts:SplineAreaSeries XBindingPath="ObsTime"
    YBindingPath="Pressure"
    ItemsSource="{Binding List}"
    Interior="{StaticResource GraphForegroundBrush}">
  </Charts:SplineAreaSeries>
</Charts:SfChart>

 

Thanks ... in advance.

Gary Burgess


4 Replies

GB Gary Burgess March 21, 2013 06:57 AM UTC

Sorry .. the link to the sample chart is: http://www.burgess.com.au/dropbox/SampleChart.png



VK Vinoth Kumar J Syncfusion Team March 21, 2013 12:21 PM UTC

Hi Gary ,

Thanks for using syncfusion products.

While using DateTimeAxis, intervals are calculated automatically. We will work on improving the nice interval calculation for DateTimeAxis. Since interval of your data is fixed i.e., readings are taken every 30 minutes, we request you to use CategoryAxis with interval 1 (label will be placed for every 30 minutes) or 2 (1 hour interval) or 4 (2 hours interval). You can also format the label using LabelFormat property.

We have prepared a sample using CategoryAxis. Please find the sample from the following location.

CategoryAxis.WP8.zip
Thanks,



GB Gary Burgess March 27, 2013 06:24 AM UTC

Thanks for the reply Vinoth.

 

That worked beautifully!

Gary



VK Vinoth Kumar J Syncfusion Team June 11, 2013 05:44 AM UTC

Hi Garry,

We are glad to know your issue is fixed.

Thanks,
Vinoth Kumar J

Loader.
Live Chat Icon For mobile
Up arrow icon