MS chart - Dynamically setting the height on the basis of the number of records returned.

Hello there,

I have an MS chart control, a range bar chart which displays a set of names on the X axis and Dates on the Y axis. The chart displays the data properly to a certain number of records but when the data retrieved is too large It is not at all possible to read the data because it is too tiny.

Is there a way I can increase the height of the control on the basis of the records retrieved and also, is it possible to fix the height of the series manually.

Thanks,

CPM
virtualmenonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ericathomeCommented:
Here is a reference to properties on the MS Chart Control:
http://msdn.microsoft.com/en-us/library/5xeba95d(VS.71).aspx

You can set the Maximum property if you desire to the MAX(value) of the range of values being placed in the chart. However, assigning a value to Maximum changes the ValueScale property Auto to False. See the web page at the link above (Maximum and ValueScale links) for more details.

Here is a link to an example working with the AxisScale object: http://msdn.microsoft.com/en-us/library/2cz3ktky(v=VS.71).aspx 

Let me know if you need more detail.

Thanks, Eric
0
virtualmenonAuthor Commented:
hello eric,

Could you give me a simple example where I can fix the series height to be a certain percentage of the chart height..

thanks,
cpm
0
virtualmenonAuthor Commented:
Can i set the height of the chart area dynamically..??
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

EspavoCommented:
Here's some VB as to how I manage the size of my Charts in an app... (This is a Bar Graph)
Espavo

Dim Chart1 As New Chart
Chart1.IsMapEnabled = "False"
Chart1.ImageStorageMode = ImageStorageMode.UseImageLocation
Chart1.ImageLocation = "~/temp/ChartPic_#SEQ(300,10)" 
 

'Calculate the height, based on the number Chart Points (+ Legend)
'cZ is the count of the number of items on the chart
Dim cHeight As Int32 = ((cZ + 1) * 22) + 80
Chart1.Height = Unit.Pixel(cHeight)

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ericathomeCommented:
Espavo, thanks for adding a great example.
VirtualMenon, if by dynamically you mean in the code behind, the answer demonstrated above is yes. Espavo provided a good example, let us know if you need anything else to finish the solution.
Eric
 
0
virtualmenonAuthor Commented:
Awesome example Espavo. Thanks a lot mate...Worked like a gem.

Thanks,

CPM
0
virtualmenonAuthor Commented:
Excellent
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.