Applying Attribute Width="100%" shrinks the Chart

Thread is closed for posting
3 posts, 2 answers
  1. Pivetal
    Pivetal avatar
    12 posts
    Member since:
    Apr 2007

    Posted 17 May 2008 Link to this post


    When I apply Width="100%" to the RadChart, it shrinks the chart rather than filling the div for example:

    <div id="chartPlaceholder" style="width:100%;" >
        <telerik:RadChart ID="RadChart2" SkinsOverrideStyles="true" runat="server"
                <XAxis MaxValue="5" MinValue="1" Step="1">
                <YAxis MaxValue="3" Step="0.5" AxisMode="Extended">
                <YAxis2 MaxValue="5" MinValue="1" Step="1">
                <telerik:ChartSeries Name="Series 1" Type="Line">
                        <telerik:ChartSeriesItem YValue="1" Name="Item 20">
                        <telerik:ChartSeriesItem YValue="2" Name="Item 100">
                        <telerik:ChartSeriesItem YValue="1" Name="Item 100">
                        <telerik:ChartSeriesItem YValue="3" Name="Item 20">
                <telerik:ChartSeries Name="Series 2" Type="Line">
                        <telerik:ChartSeriesItem YValue="3" Name="Item 80">
                        <telerik:ChartSeriesItem YValue="1" Name="Item 10">
                        <telerik:ChartSeriesItem YValue="3" Name="Item 10">
                        <telerik:ChartSeriesItem YValue="1" Name="Item 80">

    Is there a way where I can get the chart to fill the containing DIV tag.

  2. Answer
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 19 May 2008 Link to this post


    Go through the following forum link which discusses a similar scenario.
    Set Chart Width to 100% of Zone

  3. Answer
    Ves avatar
    2926 posts

    Posted 19 May 2008 Link to this post

    Hi Bleddyn,

    RadChart does not support width in percent. It is rendered as image and it should have its size calculated at render time and unfortunately this is not possible if its dimensions are provided in percents as the actual size may vary, depending on various client-side conditions.

    In addition to Shinu's suggestion, you can check the approach shown in this code library entry. You will find projects for sever-side and for client-side resize. Basically, the main idea of server-side implementation is to find out the with of the chart container and set chart's width in pixels.

    I hope this helps.

    All the best,
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top