Dynamic height increase

Thread is closed for posting
6 posts, 0 answers
  1. Nileshkumar
    Nileshkumar avatar
    18 posts
    Member since:
    May 2011

    Posted 25 Aug 2011 Link to this post

    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?
  2. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 30 Aug 2011 Link to this post

    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 >>

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 30 Aug 2011 Link to this post

    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 >>

  5. Razak
    Razak avatar
    20 posts
    Member since:
    Oct 2011

    Posted 31 May 2013 Link to this post

    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:

  6. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 05 Jun 2013 Link to this post

    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.
  7. Razak
    Razak avatar
    20 posts
    Member since:
    Oct 2011

    Posted 07 Jun 2013 Link to this post

    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017