Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
575
XamChart in a DockPanel
posted

Hi,

I've a DockPanel width some Labels and with one XamChart.

 

 

 

 

 

 

 

<

 

 

DockPanel Grid.Row="1" Name="dockPanel1">
<Label Content="Label 1" Name="label1" Background="Lime" DockPanel.Dock ="Top" />
<Label Content="Label 2" Name="label2" Background="Red" DockPanel.Dock="Top" />
<Label Background="#FFFF00E8" Content="Label 3" Name="label3" DockPanel.Dock="Top" />
<igCA:XamChart Name="xamChart1" DockPanel.Dock="Top" Height="79" />
<Label Background="Yellow" Content="Label 4" Name="label4" DockPanel.Dock="Top"/>
<Label Background="Blue" Content="Label 5" Name="label5" />
</DockPanel>

The problem is, if I change the Height of the Chart to Auto the Chart fills the whole bottom-area. Why did the chart this? The Labels has also Height set to Auto, and they behavior is right, in my opinion. Or am I wrong?

I will place a Label below the Chart and want that the Chart resizes hinmself, if the Window resizes. How can I resolve this?

Thanks...
Marco

  • 30692
    Verified Answer
    Offline posted

    The chart's sizing behavior is a bit different from the labels in that it has no concept of a minimum acceptable size, much like a Canvas does not. A canvas solves this problem by requesting no size at all, but the xamChart solves this by promiscuously requesting all the space made available to it.

    Your best strategies, if you dont want the chart to take all the space, might be to set a maximum width/height on the chart, update the size of the chart as the window size changes, or bind its width/height to some other value that changes as the window size changes.

    We use a slightly different strategy with the xamDataChart in that you can specify a minimum size for the chart's plot area, and it will auto size accordingly. If you would like to see us apply a different sizing strategy to the xamChart, you could make a feature request.

    -Graham