I am trying to use the Library WPF Metro UI Charts, which is derivated from Modern UI Charts. However i'm having trouble with ClusteredColumnChart when i try to use use charts inside a Page instead of a Window. The graph always show negative axis in Y, even when there is no negative value. When i use the class Window it works properlly. The graph generated looks like this:
My XAML is this:
<GAChart:ClusteredColumnChart Style="{StaticResource MinimalChartStyle}"
ChartTitle="{Binding Titulo}"
ChartSubTitle="{Binding SubTitulo}"
SelectedItem="{Binding selectedItem, Mode=TwoWay}"
Width="400" Height="400"
>
<GAChart:ClusteredColumnChart.Series>
<GAChart:ChartSeries
SeriesTitle="{Binding Dados.seriesDisplayName}"
DisplayMember="date"
ItemsSource="{Binding Dados.Items}"
ValueMember="amount" />
</GAChart:ClusteredColumnChart.Series>
</GAChart:ClusteredColumnChart>
The codebehind is exactly the sample code provided in https://gamandelkowcharts.codeplex.com/.
Anyone knows a way to solve this?
I think the problem is because by the time your page is creating your user control, it does not have the size of the window yet.
Try this, in your user control Sub New().
Public Sub RefreshUC()
Try
Me.Measure(New Size(400, 400))
Me.Arrange(New Rect(New Size(400, 400)))
Dim GD As Grid = Me.Parent
Dim KP As Page = GD.Parent
KP.Content = New BarGraph
KP.Measure(New Size(400, 400))
KP.Arrange(New Rect(New Size(400, 400)))
Catch ex As Exception
End Try
End Sub