xyzzer / WinRTXamlToolkit

WinRT XAML Toolkit
Other
282 stars 67 forks source link

Sequence contains no elements #18

Closed alexeygritsenko closed 8 years ago

alexeygritsenko commented 8 years ago

(LineChart.Series[0] as LineSeries).ItemsSource = financialStuffList; Error

"System.InvalidOperationException: Sequence contains no elements\r\n at System.Linq.Enumerable.Min(IEnumerable`1 source)\r\n at WinRTXamlToolkit.Controls.DataVisualization.Charting.OrientedPanel.MeasureOverride(Size availableSize)\r\n at Windows.UI.Xaml.FrameworkElement.MeasureOverride(Size availableSize)\r\n at WinRTXamlToolkit.Controls.DataVisualization.Charting.DisplayAxis.MeasureOverride(Size availableSize)\r\n at Windows.UI.Xaml.UIElement.Measure(Size availableSize)\r\n at WinRTXamlToolkit.Controls.Data"

But financialStuffList contains 5 correct items!

marcin-g commented 8 years ago

https://winrtxamltoolkit.codeplex.com/discussions/575754 It looks like problem with scalling a chart after change of content. There is workaround for this issue. You just have to determine the size of chart by setting fixed value of height/width or putting chart in container e.g. Grid, DockPanel.

alexeygritsenko commented 8 years ago

wow, interesting solution but it is very harmful! I'm working on uwp where fixed sizes are not acceptable, because the application is adapted to the different screens and windows.

gpeipman commented 8 years ago

I'm also working on UWA that targets multiple screen sizes and this error is making me crazy. It doesn't happen always - it sometimes happens and sometimes not. I agree with alexeygritsenko - this error currently doesn't allow devs to release their applications to live as we have no control over the error.

gardnerjr commented 8 years ago

explicitly setting width & height doesn't seem to work around the issue. i'm explicitly setting them and still running into this issue.

<charting:Chart Width="245" Height="210"> <charting:BarSeries ItemsSource="{Binding Path=Stats}" IndependentValueBinding="{Binding Category}" DependentValueBinding="{Binding Number}" IsSelectionEnabled="False" /> </charting:Chart>

i've also tried wrapping them with explicitly sized grids, also doesn't work.

xyzzer commented 8 years ago

Great job figuring it out, @gardnerjr !

gardnerjr commented 8 years ago

are you going to push a new nuget release with this fix? i'm content with using my own build, since i already have that done, but some of the others above might want a nuget package with this fix if it is crashing them?

xyzzer commented 8 years ago

I'll try to get that out tonight.

On Wed, Mar 2, 2016 at 10:34 AM, John Gardner notifications@github.com wrote:

are you going to push a new nuget release with this fix? i'm content with using my own build, since i already have that done, but some of the others above might want a nuget package with this fix if it is crashing them?

— Reply to this email directly or view it on GitHub https://github.com/xyzzer/WinRTXamlToolkit/issues/18#issuecomment-191363094 .