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

Range Selector Label Formatting

2 Answers 42 Views
RangeSelector
This is a migrated thread and some comments may be shown as answers.
Craig
Top achievements
Rank 1
Craig asked on 28 Jan 2014, 03:50 AM
I have just started using the Range Selector linked to a Chart View with a Date Time Categorical axis. My issue is that I cannot seem to find the formatting setting for the date label in the Range Selector. 

Can you please help?

2 Answers, 1 is accepted

Sort by
0
Craig
Top achievements
Rank 1
answered on 28 Jan 2014, 03:55 AM
Also, how do I synchronise the palette between the Chart View and the Range Selector?
0
Stefan
Telerik team
answered on 30 Jan 2014, 01:13 PM
Hi Craig,

Thank you for writing. 

You can use the LabelInitializing event of the AssociatedElement to access and format the labels:
((RangeSelectorViewElement)radRangeSelector1.RangeSelectorElement.AssociatedElement).LabelInitializing += new LabelInitializingEventHandler(RangeSelectorViewElement_LabelInitializing);
 
private void RangeSelectorViewElement_LabelInitializing(object sender, LabelInitializingEventArgs e)
{
    DateTime date = DateTime.Parse(e.LabelElement.Text);
    e.LabelElement.Text = string.Format("{0:MM yyyy}", date);
    e.LabelElement.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
    e.LabelElement.AngleTransform = 45;
}

As to the palette, here is how to access the chart element in RadRangeSelector and set its palette. The best place to do that is the Form.Load event:
protected override void OnLoad(EventArgs e)
{
    base.OnLoad(e);
 
    RangeSelectorViewElement rangeChart = ((RangeSelectorViewElement)radRangeSelector1.RangeSelectorElement.AssociatedElement);
    rangeChart.View.Series[0].Palette = KnownPalette.Metro.GlobalEntries[0];
}

I hope this helps. 

Regards,
Stefan
Telerik
TRY TELERIK'S NEWEST PRODUCT - APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
RangeSelector
Asked by
Craig
Top achievements
Rank 1
Answers by
Craig
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or