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

Dynamic height increase

5 Answers 98 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Nileshkumar
Top achievements
Rank 1
Nileshkumar asked on 25 Aug 2011, 11:20 AM
Hello,
I have RadChart in my application. In X axis there is description & Y axis it displays only positive value related that description. I have set height & width of RadChart. Currently there is only 15 different types of description in X-axis & some value is related to that description. Now my problem is that, Value of x axis is dynamic so that when it increases, related number displays in Y-axis gets overlapped.
How to solve this problem? Is there any way to set height & width dynamically based on number of record?

5 Answers, 1 is accepted

Sort by
0
Tsvetie
Telerik team
answered on 30 Aug 2011, 12:11 PM
Hello Nileshkumar,
In short, no, there is no way to set the Width and Height of the chart, relative to the number of items in the x and y axes. I can suggest two things in your case:
  • You can use the LabelAppearance settings to rotate the labels of the axes.
  • You can calculate the Width and Height values for the chart dynamically, based on the generated number of axis items. You can use the PrePaint event of the chart to do this.

All the best,
Tsvetie
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Tsvetie
Telerik team
answered on 30 Aug 2011, 12:22 PM
Hello Nileshkumar,
Just a quick followup. Regarding my first suggestion - please refer to this online demo, it will give a quick overview of the label rotation feature.

Regards,
Tsvetie
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Razak
Top achievements
Rank 2
answered on 31 May 2013, 07:02 PM
Regarding your second suggestion, unfortunately in the PrePaint event, changing the RadChart height won't affect the PlotArea.

Dim plotAreaHeight As Integer = XItemCount * 25
 
plotAreaHeight += RadChart1.Chart.Appearance.Dimensions.Margins.Top.Value
plotAreaHeight += RadChart1.Chart.Appearance.Dimensions.Margins.Bottom.Value
plotAreaHeight += RadChart1.Chart.Appearance.Dimensions.Paddings.Top.Value
plotAreaHeight += RadChart1.Chart.Appearance.Dimensions.Paddings.Bottom.Value
 
plotAreaHeight += RadChart1.Chart.ChartTitle.Appearance.Dimensions.Margins.Top.Value
plotAreaHeight += RadChart1.Chart.ChartTitle.Appearance.Dimensions.Margins.Bottom.Value
plotAreaHeight += RadChart1.Chart.ChartTitle.Appearance.Dimensions.Paddings.Top.Value
plotAreaHeight += RadChart1.Chart.ChartTitle.Appearance.Dimensions.Paddings.Bottom.Value
 
plotAreaHeight += RadChart1.Chart.PlotArea.Appearance.Dimensions.Margins.Top.Value
plotAreaHeight += RadChart1.Chart.PlotArea.Appearance.Dimensions.Margins.Bottom.Value
plotAreaHeight += RadChart1.Chart.PlotArea.Appearance.Dimensions.Paddings.Top.Value
plotAreaHeight += RadChart1.Chart.PlotArea.Appearance.Dimensions.Paddings.Bottom.Value
 
plotAreaHeight += RadChart1.Chart.ChartTitle.Appearance.Dimensions.Height.Value
RadChart1.Height = Unit.Pixel(plotAreaHeight)


Attached is a sample output:

0
Tsvetie
Telerik team
answered on 05 Jun 2013, 11:17 AM
Hi Abdul Razak,

Indeed, you are correct. You can use the PrePaint event to get the calculated margin, padding and title height values, but you cannot change the height of the chart control at this point in the lifecycle. You can use the DataBound or PreRender events to change the height of the chart, based on the number of items. However, please note, at this point the margin, padding and title height values are not calculated yet. You can use a fixed value for these and calculate the height of the chart based on that fixed value and the number of items in the chart.

Regards,
Tsvetie
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Razak
Top achievements
Rank 2
answered on 08 Jun 2013, 04:32 AM
I used fixed values for paddings & margins for ChartTitle, PlotArea but still, the plotarea is rendered differently.

I have created a thread asking for help on this matter here:

http://www.telerik.com/community/forums/aspnet-ajax/chart/controlling-the-chart-appearance.aspx
Tags
Chart (Obsolete)
Asked by
Nileshkumar
Top achievements
Rank 1
Answers by
Tsvetie
Telerik team
Razak
Top achievements
Rank 2
Share this question
or