Profile Picture

How to dynamically set chart size based on parent container

Posted By Randy Michak 15 Years Ago

How to dynamically set chart size based on parent container

Author
Message
Randy Michak
Posted 15 Years Ago
View Quick Profile
Forum Newbie

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
Last Active: 15 Years Ago
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



bob milanov
Posted 15 Years Ago
View Quick Profile
Supreme Being

Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)

Group: Forum Members
Last Active: 6 Months Ago
Posts: 153, Visits: 11

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
Posted 15 Years Ago
View Quick Profile
Forum Newbie

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
Last Active: 15 Years Ago
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





Similar Topics


Reading This Topic