Get the Axis value from radRangeSelector

1 Answer 86 Views
ChartView RangeSelector
Omar
Top achievements
Rank 3
Iron
Iron
Iron
Omar asked on 28 Aug 2022, 09:45 AM

Hi,

I have chartview and radRangeSelector.

The question is: how can I get the Axis label values for from radRangeSelector for the start and end zoom.

Hope I can get help soon.

/Omar

1 Answer, 1 is accepted

Sort by
1
Accepted
Maria
Telerik team
answered on 30 Aug 2022, 10:19 AM

Hi Omar,

Thank you for your question.

Generally speaking there isn't an easy way to get the labels in the range area. You could use the StartRange and EndRange properties. The values of these properties are of type double and between 0% and 100%. From the photo you sent I see that you use ChartView with the ScatterLine series. Correct me if I am wrong. In this case, you can get the last label in the RangeSelector control and calculate the start and end of the range area. For example:

private void RadRangeSelector1_SelectionChanged(object sender, EventArgs e)
{
    var element = this.radRangeSelector1.RangeSelectorElement;
    var lastLabel = (element.BottomRightScales[0] as RangeSelectorChartScaleContainerElement).Children.Last() as RangeSelectorChartScaleLabelElement;
    int lastValue = int.Parse(lastLabel.Text);
    this.radLabel1.Text = lastValue * (this.radRangeSelector1.StartRange / 100) + " ";
    this.radLabel2.Text = lastValue * (this.radRangeSelector1.EndRange / 100)+ " ";
}

Keep in mind that the above approach is a custom one and it is not fully tested it. However, you can extend it so that it covers all your scenarios. Give it a try and let me know if this works for your case.

Regards,
Maria
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Omar
Top achievements
Rank 3
Iron
Iron
Iron
commented on 04 Sep 2022, 08:23 PM

It's not a perfect solution, but it does the job.

Thanks,

Omar

Tags
ChartView RangeSelector
Asked by
Omar
Top achievements
Rank 3
Iron
Iron
Iron
Answers by
Maria
Telerik team
Share this question
or