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

AxisX custom date label

4 Answers 71 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Cameron
Top achievements
Rank 1
Cameron asked on 06 Jul 2011, 03:19 PM

Hi All,

I need to show dates on AxisX but in addition to dates I also need to show week or quarter numbers those dates fall into. For example 
"07/07/2011 - Q1",  "02/03/2010 - Q3".  
In other words, the AxisX should show not only the dates but also the corresponding quarters (the Q1 and Q3  refer to fiscal calandars). Is it possible to do so?

Thanks,

Cameron    

4 Answers, 1 is accepted

Sort by
0
Cameron
Top achievements
Rank 1
answered on 07 Jul 2011, 12:55 PM

 I know that I can customize the date display on x-axis via a converter. The one issue that I need to resolve is how to pass additional info to the convert method

public

 

 

object Convert(object value, Type targetType, object parameter, CultureInfo culture)

 


How can I pass an instance of some class via the "parameter" of the Convert method? 

Can it be done via the xaml?

 

 

 

<TextBlock Style="{TemplateBinding ItemLabelStyle}

    Text

 

 

="{Binding Converter={StaticResource DateConverter},??????????}

Thanks,

Cameron

0
Accepted
Yavor
Telerik team
answered on 11 Jul 2011, 08:21 AM
Hi Cameron,

Presently, you cannot pass this data to the converter. The converting method has to be able to retrieve the additional information, based on the value. Another option, would be to determine the text, when the data is initialized. This may resemble a setup, similar to this one:

http://www.telerik.com/help/silverlight/radchart-howto-set-custom-fill-for-pointmarks-depending-on-condition.html

Thus, you can have a simple field for the text of the label(s), which field will be initialized as needed initially.
I hope this information helps.

All the best,
Yavor
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Cameron
Top achievements
Rank 1
answered on 11 Jul 2011, 05:27 PM

Hi Yavor,

Thank you for taking the time to reply.

So you confirmed that at the present there is no way to pass runtime data via the "parameter" of the Convert method. I wish multibinding was available for SL as well.

I don't get the relevance of the link you have inculded in your response. I need to customize tickpoint labels. In other words, I need to customize the labels as they appear on the x axis ticks not the chart itself. 

Thanks,

Cameron  
0
Yavor
Telerik team
answered on 12 Jul 2011, 08:59 AM
Hello Cameron,

The link provided earlier aimed to demonstrate the initialization of the additional data, when the datasource itself is initialized. Since you cannot pass the additional data into the converter, as a parameter, you may need to populate the field to which the TextBlock is bound, with sufficient data, to determine the quarter. Thus, when the converter is invoked, based on this data, you can parse the original value, or format it accordingly.
Naturally, the most straightforward approach would be to populate the field initially, and pass it as a datasource for the TextBlock, without using a converter. This will be closer to the approach outlined in the resource sent earlier - based on the original data, you construct a field, to which you bind.
Let me know how this logic meets your requirements.

Regards,
Yavor
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Chart
Asked by
Cameron
Top achievements
Rank 1
Answers by
Cameron
Top achievements
Rank 1
Yavor
Telerik team
Share this question
or