Index: Core/Components/src/Core.Components.OxyPlot.Forms/CategoryPlotView.cs =================================================================== diff -u -r095b567e3a7a0e61dd92b0e68fc6f5db883ebcdd -r44c53e8ad9342f1b23ce2524c9fa69b92045bf53 --- Core/Components/src/Core.Components.OxyPlot.Forms/CategoryPlotView.cs (.../CategoryPlotView.cs) (revision 095b567e3a7a0e61dd92b0e68fc6f5db883ebcdd) +++ Core/Components/src/Core.Components.OxyPlot.Forms/CategoryPlotView.cs (.../CategoryPlotView.cs) (revision 44c53e8ad9342f1b23ce2524c9fa69b92045bf53) @@ -103,7 +103,9 @@ categoryAxis.Labels.AddRange(labels); - categoryAxis.AbsoluteMaximum = categoryAxis.Labels.Count - 0.5; + categoryAxis.AbsoluteMaximum = categoryAxis.Labels.Count > 0 + ? categoryAxis.Labels.Count - 0.5 + : 0; } /// Index: Core/Components/src/Core.Components.OxyPlot.Forms/StackChartControl.cs =================================================================== diff -u -r095b567e3a7a0e61dd92b0e68fc6f5db883ebcdd -r44c53e8ad9342f1b23ce2524c9fa69b92045bf53 --- Core/Components/src/Core.Components.OxyPlot.Forms/StackChartControl.cs (.../StackChartControl.cs) (revision 095b567e3a7a0e61dd92b0e68fc6f5db883ebcdd) +++ Core/Components/src/Core.Components.OxyPlot.Forms/StackChartControl.cs (.../StackChartControl.cs) (revision 44c53e8ad9342f1b23ce2524c9fa69b92045bf53) @@ -77,7 +77,6 @@ if (data != null) { DrawPlot(); - plotView.InvalidatePlot(true); } } } @@ -112,6 +111,8 @@ { DrawLabels(); DrawColumns(); + + plotView.InvalidatePlot(true); } private void ClearPlot() Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Factories/RingtoetsStackChartDataFactory.cs =================================================================== diff -u -r3748f21da69e2c5a0f5d59168ed1d00807bedf00 -r44c53e8ad9342f1b23ce2524c9fa69b92045bf53 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Factories/RingtoetsStackChartDataFactory.cs (.../RingtoetsStackChartDataFactory.cs) (revision 3748f21da69e2c5a0f5d59168ed1d00807bedf00) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Factories/RingtoetsStackChartDataFactory.cs (.../RingtoetsStackChartDataFactory.cs) (revision 44c53e8ad9342f1b23ce2524c9fa69b92045bf53) @@ -156,7 +156,7 @@ if (remainingStochasts.Any()) { stackChartData.AddRow(Resources.RingtoetsStackChartDataFactory_RemainingRow_DisplayName, - CreateRemainingRow(remainingStochasts), + GetValuesForRemainingRow(remainingStochasts), Color.Gray); } } @@ -166,7 +166,7 @@ return stochast.Value.Any(v => v < minAlphaSquared); } - private static double[] CreateRemainingRow(IDictionary> stochasts) + private static double[] GetValuesForRemainingRow(IDictionary> stochasts) { var values = new double[stochasts.First().Value.Count]; var index = 0; Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/IllustrationPointsChartControl.cs =================================================================== diff -u -r3748f21da69e2c5a0f5d59168ed1d00807bedf00 -r44c53e8ad9342f1b23ce2524c9fa69b92045bf53 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/IllustrationPointsChartControl.cs (.../IllustrationPointsChartControl.cs) (revision 3748f21da69e2c5a0f5d59168ed1d00807bedf00) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/IllustrationPointsChartControl.cs (.../IllustrationPointsChartControl.cs) (revision 44c53e8ad9342f1b23ce2524c9fa69b92045bf53) @@ -36,7 +36,7 @@ { private GeneralResult data; - private StackChartData chartData; + private readonly StackChartData chartData; /// /// Creates a new instance of . @@ -65,6 +65,11 @@ { SetChartData(); } + else + { + chartData.Clear(); + chartData.NotifyObservers(); + } } } Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/IllustrationPointsChartControlTest.cs =================================================================== diff -u -r3748f21da69e2c5a0f5d59168ed1d00807bedf00 -r44c53e8ad9342f1b23ce2524c9fa69b92045bf53 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/IllustrationPointsChartControlTest.cs (.../IllustrationPointsChartControlTest.cs) (revision 3748f21da69e2c5a0f5d59168ed1d00807bedf00) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/IllustrationPointsChartControlTest.cs (.../IllustrationPointsChartControlTest.cs) (revision 44c53e8ad9342f1b23ce2524c9fa69b92045bf53) @@ -51,13 +51,13 @@ [Test] public void GivenStackChartControlWithoutData_WhenDataNotNull_ThenStackChartControlUpdated() { - // Setup + // Given var chartControl = new IllustrationPointsChartControl(); - // Call + // When chartControl.Data = GetGerenalResult(); - // Assert + // Then IStackChartControl chart = chartControl.Controls.OfType().Single(); string[] columns = chart.Data.Columns.ToArray(); RowChartData[] rows = chart.Data.Rows.ToArray(); @@ -95,6 +95,24 @@ Assert.AreEqual(Color.Gray, rows[2].Color); } + [Test] + public void GivenStackChartCotnrolWithData_WhenDataSetToNull_ThenStackChartControlUpdated() + { + // Given + var chartControl = new IllustrationPointsChartControl + { + Data = GetGerenalResult() + }; + + // When + chartControl.Data = null; + + // Then + IStackChartControl chart = chartControl.Controls.OfType().Single(); + CollectionAssert.IsEmpty(chart.Data.Columns); + CollectionAssert.IsEmpty(chart.Data.Rows); + } + private static GeneralResult GetGerenalResult() { return new GeneralResult(