This is a migrated thread and some comments may be shown as answers.

Time based Series X-Axis labels format

4 Answers 202 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Erez
Top achievements
Rank 1
Erez asked on 01 Mar 2012, 05:12 PM
Hi,

My data is a time based series with a single value for each hour. The series period is 1 year so the total number of points is ~8600 (12*30*24).
I want to display my series in a chart where the X-Axis labels will be presented with gaps and in two lines like it is in the Financial ChartView example (Screenshot attached).
In the Financial example (screenshot attached) the Axis year’s labels are hard coded TextBlock controls and the month’s labels gaps format is specific determined. This is OK when the chart period is static, however in my application the user need to be able to select the start time and end time (with a separate control, maybe a TimeBar control) and also can do zooming to the X-Axis.

How can I get the Financial example time based labeling display when the data time period is known only at runtime? 

Thanks,
Erez.

4 Answers, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 06 Mar 2012, 02:53 PM
Hi Erez,

Please, find attached an updated version of the user control, holding the chart in question. Note, that due to a pending change, the value converter contains dual implementation. Currently, the data context of the label is a string value, so you need to parse it in order to retrieve the DateTime value and format it as required. This will be updated and the context will be the DateTime value, so you will be able to remove the call to  String.Parse after 2012 Q1 SP1 is released.

Best regards,
Ves
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Erez
Top achievements
Rank 1
answered on 07 Mar 2012, 10:46 AM
Hi,

This is helpful, however what about the hardcoded date label gaps (MajorStep="3" MajorStepUnit="Month").
Can it be dynamic calculate according to the chart time period? Otherwise the time labels are drawn one on top of the other.

Thanks,
Erez.
0
Ves
Telerik team
answered on 12 Mar 2012, 10:19 AM
Hi Erez,

Please, find attached another version of MainView.xaml. Note, that this one uses DateTimeCategoricalAxis, so this example actually assumes there is an item for every month within the plotted period. Hope this helps.

Best regards,
Ves
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Steven
Top achievements
Rank 1
answered on 28 Sep 2012, 12:08 AM
I created a version of this code whereby the new month might occur on a weekend, but the first business day / data point is on a Monday.  I hoped to be able to use XamlReader.Loader to bind dynamically to the resource that I added to a ResourceDictionary at run-time.  

Is this possible?  
Tags
ChartView
Asked by
Erez
Top achievements
Rank 1
Answers by
Ves
Telerik team
Erez
Top achievements
Rank 1
Steven
Top achievements
Rank 1
Share this question
or