Index: Core/Components/src/Core.Components.OxyPlot/Core.Components.OxyPlot.csproj =================================================================== diff -u -rad5276a3de54e0a3b0eac0ef112932f12893bb1d -rb289035f9dc849df937a2d1049da17b28c689e02 --- Core/Components/src/Core.Components.OxyPlot/Core.Components.OxyPlot.csproj (.../Core.Components.OxyPlot.csproj) (revision ad5276a3de54e0a3b0eac0ef112932f12893bb1d) +++ Core/Components/src/Core.Components.OxyPlot/Core.Components.OxyPlot.csproj (.../Core.Components.OxyPlot.csproj) (revision b289035f9dc849df937a2d1049da17b28c689e02) @@ -62,8 +62,8 @@ - - + + Index: Core/Components/src/Core.Components.OxyPlot/DataSeries/Stack/RowChartDataSeries.cs =================================================================== diff -u --- Core/Components/src/Core.Components.OxyPlot/DataSeries/Stack/RowChartDataSeries.cs (revision 0) +++ Core/Components/src/Core.Components.OxyPlot/DataSeries/Stack/RowChartDataSeries.cs (revision b289035f9dc849df937a2d1049da17b28c689e02) @@ -0,0 +1,71 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using Core.Components.OxyPlot.Converter.Stack; +using Core.Components.Stack.Data; +using OxyPlot.Series; + +namespace Core.Components.OxyPlot.DataSeries.Stack +{ + /// + /// A based on and updated according to the wrapped . + /// + public class RowChartDataSeries : ColumnSeries, IChartDataSeries + { + private readonly RowChartData rowChartData; + + private List drawnValues; + + /// + /// Creates a new instance of . + /// + /// The which the series is based upon. + /// Thrown when is null. + public RowChartDataSeries(RowChartData rowChartData) + { + if (rowChartData == null) + { + throw new ArgumentNullException(nameof(rowChartData)); + } + + this.rowChartData = rowChartData; + + IsStacked = true; + StrokeThickness = 1; + + Update(); + } + + public void Update() + { + if (!ReferenceEquals(rowChartData.Values, drawnValues)) + { + RowChartDataConverter.ConvertSeriesData(rowChartData, this); + + drawnValues = rowChartData.Values; + } + + RowChartDataConverter.ConvertSeriesProperties(rowChartData, this); + } + } +} \ No newline at end of file Index: Core/Components/src/Core.Components.OxyPlot/DataSeries/Stack/RowChartDataSeriesFactory.cs =================================================================== diff -u --- Core/Components/src/Core.Components.OxyPlot/DataSeries/Stack/RowChartDataSeriesFactory.cs (revision 0) +++ Core/Components/src/Core.Components.OxyPlot/DataSeries/Stack/RowChartDataSeriesFactory.cs (revision b289035f9dc849df937a2d1049da17b28c689e02) @@ -0,0 +1,52 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using Core.Components.Stack.Data; + +namespace Core.Components.OxyPlot.DataSeries.Stack +{ + /// + /// A factory to create based on . + /// + internal static class RowChartDataSeriesFactory + { + /// + /// Creates a based on . + /// + /// The to create from. + /// An of . + /// Thrown when is null. + public static IEnumerable Create(StackChartData data) + { + if (data == null) + { + throw new ArgumentNullException(nameof(data)); + } + + foreach (RowChartData row in data.Rows) + { + yield return new RowChartDataSeries(row); + } + } + } +} \ No newline at end of file Fisheye: Tag b289035f9dc849df937a2d1049da17b28c689e02 refers to a dead (removed) revision in file `Core/Components/src/Core.Components.OxyPlot/DataSeries/Stack/StackChartDataSeries.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag b289035f9dc849df937a2d1049da17b28c689e02 refers to a dead (removed) revision in file `Core/Components/src/Core.Components.OxyPlot/DataSeries/Stack/StackChartDataSeriesFactory.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Components/test/Core.Components.OxyPlot.Test/Core.Components.OxyPlot.Test.csproj =================================================================== diff -u -rad5276a3de54e0a3b0eac0ef112932f12893bb1d -rb289035f9dc849df937a2d1049da17b28c689e02 --- Core/Components/test/Core.Components.OxyPlot.Test/Core.Components.OxyPlot.Test.csproj (.../Core.Components.OxyPlot.Test.csproj) (revision ad5276a3de54e0a3b0eac0ef112932f12893bb1d) +++ Core/Components/test/Core.Components.OxyPlot.Test/Core.Components.OxyPlot.Test.csproj (.../Core.Components.OxyPlot.Test.csproj) (revision b289035f9dc849df937a2d1049da17b28c689e02) @@ -73,8 +73,8 @@ - - + + Index: Core/Components/test/Core.Components.OxyPlot.Test/DataSeries/Stack/RowChartDataSeriesFactoryTest.cs =================================================================== diff -u --- Core/Components/test/Core.Components.OxyPlot.Test/DataSeries/Stack/RowChartDataSeriesFactoryTest.cs (revision 0) +++ Core/Components/test/Core.Components.OxyPlot.Test/DataSeries/Stack/RowChartDataSeriesFactoryTest.cs (revision b289035f9dc849df937a2d1049da17b28c689e02) @@ -0,0 +1,76 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; +using Core.Components.OxyPlot.DataSeries.Stack; +using Core.Components.Stack.Data; +using NUnit.Framework; + +namespace Core.Components.OxyPlot.Test.DataSeries.Stack +{ + [TestFixture] + public class RowChartDataSeriesFactoryTest + { + [Test] + public void Create_DataNull_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => RowChartDataSeriesFactory.Create(null).ToList(); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("data", exception.ParamName); + } + + [Test] + public void Create_EmptyStackChartData_ReturnEmptyEnumerable() + { + // Call + IEnumerable series = RowChartDataSeriesFactory.Create(new StackChartData()); + + // Assert + CollectionAssert.IsEmpty(series); + } + + [Test] + public void Create_CompleteStackChartData_ReturnChartDataSeriesForRows() + { + // Setup + var data = new StackChartData(); + data.AddColumn("Column 1"); + data.AddColumn("Column 2"); + + data.AddRow("Row 1", new List + { + 0.1, + 0.9 + }); + + // Call + IEnumerable series = RowChartDataSeriesFactory.Create(data); + + // Assert + Assert.AreEqual(data.Rows.Count(), series.Count()); + } + } +} \ No newline at end of file Index: Core/Components/test/Core.Components.OxyPlot.Test/DataSeries/Stack/RowChartDataSeriesTest.cs =================================================================== diff -u --- Core/Components/test/Core.Components.OxyPlot.Test/DataSeries/Stack/RowChartDataSeriesTest.cs (revision 0) +++ Core/Components/test/Core.Components.OxyPlot.Test/DataSeries/Stack/RowChartDataSeriesTest.cs (revision b289035f9dc849df937a2d1049da17b28c689e02) @@ -0,0 +1,73 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using Core.Components.OxyPlot.DataSeries; +using Core.Components.OxyPlot.DataSeries.Stack; +using Core.Components.Stack.Data; +using NUnit.Framework; +using OxyPlot; +using OxyPlot.Series; + +namespace Core.Components.OxyPlot.Test.DataSeries.Stack +{ + [TestFixture] + public class RowChartDataSeriesTest + { + [Test] + public void Constructor_RowChartDataNull_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => new RowChartDataSeries(null); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("rowChartData", exception.ParamName); + } + + [Test] + public void Constructor_ExpectedValues() + { + // Setup + Color color = Color.Blue; + var values = new List + { + 0.3, + 0.5, + 0.2 + }; + + // Call + var series = new RowChartDataSeries(new RowChartData("data", values, color)); + + // Assert + Assert.IsInstanceOf(series); + Assert.IsInstanceOf(series); + Assert.IsTrue(series.IsStacked); + Assert.AreEqual(1, series.StrokeThickness); + Assert.AreEqual(OxyColor.FromArgb(color.A, color.R, color.G, color.B), series.FillColor); + CollectionAssert.AreEqual(values, series.Items.Select(i => i.Value)); + } + } +} \ No newline at end of file Fisheye: Tag b289035f9dc849df937a2d1049da17b28c689e02 refers to a dead (removed) revision in file `Core/Components/test/Core.Components.OxyPlot.Test/DataSeries/Stack/StackChartDataSeriesFactoryTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag b289035f9dc849df937a2d1049da17b28c689e02 refers to a dead (removed) revision in file `Core/Components/test/Core.Components.OxyPlot.Test/DataSeries/Stack/StackChartDataSeriesTest.cs'. Fisheye: No comparison available. Pass `N' to diff?