Controlling the size and location of charts, legends etc in WPF


Author
Message
Richard Eustace
Richard Eustace
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: 5, Visits: 17
I have been going around in circles trying to size charts within panels using WPF!  There is a general lack of proper examples and documentation.
I have a chart control in a window
<Wpf:NChartControl x:Name="nChartControl1" Margin="5,0,0,5" Width="800" Height="500" HorizontalAlignment="Left" VerticalAlignment="Top"/>
I have a CartesianChart and a legend within that.  So, for example, how do I locate the legend on the right hand side half way up centered around the vertical mid point of the control.  There should be fixed gap between the right hand edge of the legend and the right hand edge of the chartcontrol.  The chart should be 50% of the height of the chart control and 80% of the width, again located around midpoint of the height but a fixed distance from the lefthand edge of the control? 
Thanks
Rich
Reply
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hi Rich,

Yes, it's the aspect control that you need to turn off - just set:

chart.BoundsMode = BoundsMode.Stretch;

and this should fix the problem. The following WinForm example shows how to control the aspect/stretch:
Panels \ Chart \ Aspect \ Aspect 2D.

Regarding middle right - yes, that is the correct setting - it means right relative to the specified Location  check out the following topic:
http://helpdotnetvision.nevron.com/#UsersGuide_Layout_Content_Panels.html
It shows how ContentAlignment aligns the panel relative to the location.

We hope this helps – let us know if you meet any problems or have any questions.


Best Regards,
Nevron Support Team


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