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

Applying Attribute Width="100%" shrinks the Chart

2 Answers 195 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Pivetal
Top achievements
Rank 1
Pivetal asked on 17 May 2008, 07:13 PM
Hi,

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"
    Width="100%">
        <PlotArea>
            <XAxis MaxValue="5" MinValue="1" Step="1">
            </XAxis>
            <YAxis MaxValue="3" Step="0.5" AxisMode="Extended">
            </YAxis>
            <YAxis2 MaxValue="5" MinValue="1" Step="1">
            </YAxis2>
        </PlotArea>
        <Series>
            <telerik:ChartSeries Name="Series 1" Type="Line">
                <Items>
                    <telerik:ChartSeriesItem YValue="1" Name="Item 20">
                    </telerik:ChartSeriesItem>
                    <telerik:ChartSeriesItem YValue="2" Name="Item 100">
                    </telerik:ChartSeriesItem>
                    <telerik:ChartSeriesItem YValue="1" Name="Item 100">
                    </telerik:ChartSeriesItem>
                    <telerik:ChartSeriesItem YValue="3" Name="Item 20">
                    </telerik:ChartSeriesItem>
                </Items>
            </telerik:ChartSeries>
            <telerik:ChartSeries Name="Series 2" Type="Line">
                <Items>
                    <telerik:ChartSeriesItem YValue="3" Name="Item 80">
                    </telerik:ChartSeriesItem>
                    <telerik:ChartSeriesItem YValue="1" Name="Item 10">
                    </telerik:ChartSeriesItem>
                    <telerik:ChartSeriesItem YValue="3" Name="Item 10">
                    </telerik:ChartSeriesItem>
                    <telerik:ChartSeriesItem YValue="1" Name="Item 80">
                    </telerik:ChartSeriesItem>
                </Items>
            </telerik:ChartSeries>
        </Series>
    </telerik:RadChart>
</div>

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

Thanks
Bleddyn

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 19 May 2008, 11:08 AM
Hi,

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

Shinu.
0
Accepted
Ves
Telerik team
answered on 19 May 2008, 04:06 PM
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,
Ves
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Chart (Obsolete)
Asked by
Pivetal
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Ves
Telerik team
Share this question
or