.NET Framework Developer Center >
.NET Development Forums
>
Chart Controls for .NET Framework
>
how to calculate size of chart and ChartArea control
how to calculate size of chart and ChartArea control
- C#, Winforms
scenario : how to set the size of chart control dynamically, and fixing the size of multiple chartareas?
when number of chartareas increases the chart control's size also should increase!
which event and how to implement ?
any suggestion?
Hems
Answers
- this is what i have done.
[ in loop ]
chartArea[i].Position.Auto =true;
chartArea[i].AlignmentOrientation = AreaAlignmentOrientations.Vertical;
if (i == 0)
chartArea[i].AlignWithChartArea = chartArea[i].Name;
else
chartArea[i].AlignWithChartArea = chartArea[i - 1].Name;
now even if i increase the height of chart control all chartareas getting big size but it is not allowing more chart areas, and if i remove " chartArea[i].AlignWithChartArea" property setting, charareas are coming but if more than 3 chartarea then 2nd column likewise...
my exact requirement is to get all the chartareas in single column only with scrollbar, irrespective of number of chartareas.
Hems- Marked As Answer byAlex GorevMSFT, OwnerThursday, November 19, 2009 4:18 PM
All Replies
- The ChartArea's points automatically gets their proper height based on Chart Control's height.
So, try setting Chart's height as there is no Height property for ChartArea - coz there can be multiple series/chartareas in single Chart Control.
Dhruv Patel
[ Email : mail2dhruv@rocketmail.com ]
Please Mark As Answer if you think the answer was correct. - this is what i have done.
[ in loop ]
chartArea[i].Position.Auto =true;
chartArea[i].AlignmentOrientation = AreaAlignmentOrientations.Vertical;
if (i == 0)
chartArea[i].AlignWithChartArea = chartArea[i].Name;
else
chartArea[i].AlignWithChartArea = chartArea[i - 1].Name;
now even if i increase the height of chart control all chartareas getting big size but it is not allowing more chart areas, and if i remove " chartArea[i].AlignWithChartArea" property setting, charareas are coming but if more than 3 chartarea then 2nd column likewise...
my exact requirement is to get all the chartareas in single column only with scrollbar, irrespective of number of chartareas.
Hems- Marked As Answer byAlex GorevMSFT, OwnerThursday, November 19, 2009 4:18 PM
- Explicitly set the position of each chart area the way you want using ChartArea.Position . You have to manually increase the size of the chart using Chart.Height each time you add a chart area if this is what you want.
This thread already has the answer you want along with an example.


