How to dynamically set chart size based on parent container


Author
Message
Randy Michak
Randy Michak
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)
Group: Forum Members
Posts: 2, Visits: 1

I'm looking for an example or some ideas on how I can determine the chart size based on the parent container.  I really want a way to set a chart as 100% and 100% height.  However, I understand that since this is an image, this is not built in.  Seems like a common task a developer would want to do.  Is there an example floating around for how to do this?

Thanks, Randy


Blagovest Milanov
Blagovest Milanov
Supreme Being (148 reputation)Supreme Being (148 reputation)Supreme Being (148 reputation)Supreme Being (148 reputation)Supreme Being (148 reputation)Supreme Being (148 reputation)Supreme Being (148 reputation)Supreme Being (148 reputation)Supreme Being (148 reputation)
Group: Forum Members
Posts: 154, Visits: 15

Hi Randy,

There are two ways to set the chart size to 100% of its parent panel:

1. By using docking:

NChart chart = nChartControl1.Charts[0];
chart.BoundsMode =
BoundsMode.Stretch;
chart.Dock =
DockStyle.Fill;

(that is provided that there are no other panels using docking before the chart panel in it's container)

2. By using Location/Size

NChart chart = nChartControl1.Charts[0];
chart.BoundsMode =
BoundsMode.Stretch;
chart.Size =
new NSizeL(new NLength(100, NRelativeUnit.ParentPercentage),
new NLength(100, NRelativeUnit.ParentPercentage));
chart.Size = new NPointL(new NLength(0),new NLength(0));

Hope I helped - let me know if you have any questions or comments.

Best regards,
Bob


Randy Michak
Randy Michak
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)
Group: Forum Members
Posts: 2, Visits: 1

This binds it to 100% of the chart control.  How can I set the size of the ChartControl itself to take up 100% of the area on the webpage?   Assuming this is in a html table that is set 100%, can I have the parent ChartControl take the entire area and then bind an individual chart inside to also be 100%? 

 

Randy


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search