Click here to Skip to main content
12,443,996 members (42,904 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# ASP.NET Chart
Hi all

I am new to chart Control.
I build a chart control successfully with two ChartArea.

My Problem:
When i run the page it is dividing the charts into 2 areas each 50%.
But i want to fix that ChartAreas Height.
Means:I want to fix the height of the 1 Chart Area as 30% and 2nd Chart Area as 70%.
By default it is taking 50% for chart area 1 and 50% for Chart Area 2.

Please Help to Fix the Problem.

Thanks In Advance
Posted 21-Aug-12 3:44am
Mac123341.1K
Updated 21-Aug-12 19:30pm
v2

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Chart Control adjusts the chart area heights itself. ChartArea does not posses Height property to set the height.
http://msdn.microsoft.com/en-us/library/dd456621.aspx
So alternate way to achieve it is to have 2 different Chart objects.
  Permalink  
Comments
MAC123456 22-Aug-12 2:30am
   
I already tried using two chart control it is showing problem.
I have Share that problem in below link
http://www.codeproject.com/Questions/441619/Chart-control-problem

So I tried using one chart control with two chartarea its working fine but need to fix the height problem.
pramodhegde88 22-Aug-12 8:25am
   
Hi,
Have you tried like this,

<div style="height:150px;">
<div style="height:100px;">
<asp:Chart ID="Chart1" runat="server">

<asp:Series Name="Series1">



<asp:ChartArea AlignWithChartArea="NotSet" Name="ChartArea1" BorderColor="Red" AlignmentStyle="PlotPosition">



</div>
<div style="height:50px;">
<asp:Chart ID="Chart2" runat="server">

<asp:Series Name="Series2">



<asp:ChartArea AlignWithChartArea="NotSet" Name="ChartArea2" BorderColor="Red" AlignmentStyle="PlotPosition">



</div>
</div>

I have tried and this works perfectly fine.
MAC123456 23-Aug-12 9:03am
   
http://msdn.microsoft.com/en-us/library/dd456621.aspx
in the above url given by you can set the height and width of chartarea.
No need to use div .

Thanks for your valuable solution.
Thanks a ton.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160811.3 | Last Updated 22 Aug 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100