Index: Core/Components/src/Core.Components.Charting/Data/ChartPointData.cs
===================================================================
diff -u -r67284323e2785c651633d9c52049ba12a9c70e6a -r8616c7f9f5791dff264dc5fe8ce598dbfe6ecb03
--- Core/Components/src/Core.Components.Charting/Data/ChartPointData.cs (.../ChartPointData.cs) (revision 67284323e2785c651633d9c52049ba12a9c70e6a)
+++ Core/Components/src/Core.Components.Charting/Data/ChartPointData.cs (.../ChartPointData.cs) (revision 8616c7f9f5791dff264dc5fe8ce598dbfe6ecb03)
@@ -20,6 +20,7 @@
// All rights reserved.
using System;
+using System.Drawing;
using Core.Components.Charting.Styles;
namespace Core.Components.Charting.Data
@@ -30,16 +31,35 @@
public class ChartPointData : PointBasedChartData
{
///
+ /// Creates a new instance of with default styling.
+ ///
+ /// The name of the .
+ /// Thrown when is
+ /// null or only whitespace.
+ public ChartPointData(string name)
+ : this(name, new ChartPointStyle(Color.Black, 2, Color.Black, 1, ChartPointSymbol.Square)) {}
+
+ ///
/// Creates a new instance of .
///
/// The name of the .
+ /// The style of the data.
/// Thrown when is
/// null or only whitespace.
- public ChartPointData(string name) : base(name) {}
+ /// Thrown when
+ /// is null.
+ public ChartPointData(string name, ChartPointStyle style) : base(name)
+ {
+ if (style == null)
+ {
+ throw new ArgumentNullException(nameof(style));
+ }
+ Style = style;
+ }
///
- /// Gets or sets the style of the points.
+ /// Gets the style of the points.
///
- public ChartPointStyle Style { get; set; }
+ public ChartPointStyle Style { get; }
}
}
\ No newline at end of file
Index: Core/Components/src/Core.Components.OxyPlot/Converter/ChartPointDataConverter.cs
===================================================================
diff -u -r2d704a409d762d8fb54d2f8be285246861019ea0 -r8616c7f9f5791dff264dc5fe8ce598dbfe6ecb03
--- Core/Components/src/Core.Components.OxyPlot/Converter/ChartPointDataConverter.cs (.../ChartPointDataConverter.cs) (revision 2d704a409d762d8fb54d2f8be285246861019ea0)
+++ Core/Components/src/Core.Components.OxyPlot/Converter/ChartPointDataConverter.cs (.../ChartPointDataConverter.cs) (revision 8616c7f9f5791dff264dc5fe8ce598dbfe6ecb03)
@@ -39,15 +39,11 @@
protected override void SetSeriesStyle(ChartPointData data, LineSeries series)
{
series.LineStyle = LineStyle.None;
-
- if (data.Style != null)
- {
- series.MarkerFill = ChartDataHelper.Convert(data.Style.Color);
- series.MarkerSize = data.Style.Size;
- series.MarkerType = ChartDataHelper.Convert(data.Style.Symbol);
- series.MarkerStroke = ChartDataHelper.Convert(data.Style.StrokeColor);
- series.MarkerStrokeThickness = data.Style.StrokeThickness;
- }
+ series.MarkerFill = ChartDataHelper.Convert(data.Style.Color);
+ series.MarkerSize = data.Style.Size;
+ series.MarkerType = ChartDataHelper.Convert(data.Style.Symbol);
+ series.MarkerStroke = ChartDataHelper.Convert(data.Style.StrokeColor);
+ series.MarkerStrokeThickness = data.Style.StrokeThickness;
}
}
}
\ No newline at end of file
Index: Core/Components/test/Core.Components.Charting.Test/Data/ChartPointDataTest.cs
===================================================================
diff -u -r67284323e2785c651633d9c52049ba12a9c70e6a -r8616c7f9f5791dff264dc5fe8ce598dbfe6ecb03
--- Core/Components/test/Core.Components.Charting.Test/Data/ChartPointDataTest.cs (.../ChartPointDataTest.cs) (revision 67284323e2785c651633d9c52049ba12a9c70e6a)
+++ Core/Components/test/Core.Components.Charting.Test/Data/ChartPointDataTest.cs (.../ChartPointDataTest.cs) (revision 8616c7f9f5791dff264dc5fe8ce598dbfe6ecb03)
@@ -20,8 +20,10 @@
// All rights reserved.
using System;
+using System.Drawing;
using Core.Common.TestUtil;
using Core.Components.Charting.Data;
+using Core.Components.Charting.Styles;
using NUnit.Framework;
namespace Core.Components.Charting.Test.Data
@@ -39,6 +41,11 @@
Assert.AreEqual("test data", data.Name);
Assert.IsEmpty(data.Points);
Assert.IsInstanceOf(data);
+ Assert.AreEqual(Color.Black, data.Style.Color);
+ Assert.AreEqual(2, data.Style.Size);
+ Assert.AreEqual(ChartPointSymbol.Square, data.Style.Symbol);
+ Assert.AreEqual(Color.Black, data.Style.StrokeColor);
+ Assert.AreEqual(1, data.Style.StrokeThickness);
}
[Test]
@@ -54,5 +61,32 @@
const string expectedMessage = "A name must be set to the chart data.";
TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
}
+
+ [Test]
+ public void Constructor_StyleNull_ThrowArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => new ChartPointData("test data", null);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("style", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_WithStyle_ExpectedValue()
+ {
+ // Setup
+ var style = new ChartPointStyle(Color.Red, 2, Color.Blue, 2, ChartPointSymbol.Circle);
+
+ // Call
+ var data = new ChartPointData("test data", style);
+
+ // Assert
+ Assert.AreEqual("test data", data.Name);
+ Assert.IsEmpty(data.Points);
+ Assert.IsInstanceOf(data);
+ Assert.AreSame(style, data.Style);
+ }
}
}
\ No newline at end of file
Index: Core/Components/test/Core.Components.OxyPlot.Test/Converter/ChartPointDataConverterTest.cs
===================================================================
diff -u -r2d704a409d762d8fb54d2f8be285246861019ea0 -r8616c7f9f5791dff264dc5fe8ce598dbfe6ecb03
--- Core/Components/test/Core.Components.OxyPlot.Test/Converter/ChartPointDataConverterTest.cs (.../ChartPointDataConverterTest.cs) (revision 2d704a409d762d8fb54d2f8be285246861019ea0)
+++ Core/Components/test/Core.Components.OxyPlot.Test/Converter/ChartPointDataConverterTest.cs (.../ChartPointDataConverterTest.cs) (revision 8616c7f9f5791dff264dc5fe8ce598dbfe6ecb03)
@@ -84,10 +84,7 @@
var converter = new ChartPointDataConverter();
var lineSeries = new LineSeries();
Color expectedColor = Color.FromKnownColor(color);
- var data = new ChartPointData("test")
- {
- Style = new ChartPointStyle(expectedColor, 3, Color.Red, 2, ChartPointSymbol.Circle)
- };
+ var data = new ChartPointData("test", new ChartPointStyle(expectedColor, 3, Color.Red, 2, ChartPointSymbol.Circle));
// Call
converter.ConvertSeriesProperties(data, lineSeries);
@@ -106,10 +103,7 @@
var converter = new ChartPointDataConverter();
var lineSeries = new LineSeries();
Color expectedColor = Color.FromKnownColor(color);
- var data = new ChartPointData("test")
- {
- Style = new ChartPointStyle(Color.Red, 3, expectedColor, 2, ChartPointSymbol.Circle)
- };
+ var data = new ChartPointData("test", new ChartPointStyle(Color.Red, 3, expectedColor, 2, ChartPointSymbol.Circle));
// Call
converter.ConvertSeriesProperties(data, lineSeries);
@@ -127,10 +121,7 @@
// Setup
var converter = new ChartPointDataConverter();
var lineSeries = new LineSeries();
- var data = new ChartPointData("test")
- {
- Style = new ChartPointStyle(Color.Red, width, Color.Red, 2, ChartPointSymbol.Circle)
- };
+ var data = new ChartPointData("test", new ChartPointStyle(Color.Red, width, Color.Red, 2, ChartPointSymbol.Circle));
// Call
converter.ConvertSeriesProperties(data, lineSeries);
@@ -148,10 +139,7 @@
// Setup
var converter = new ChartPointDataConverter();
var lineSeries = new LineSeries();
- var data = new ChartPointData("test")
- {
- Style = new ChartPointStyle(Color.Red, 3, Color.Red, strokeThickness, ChartPointSymbol.Circle)
- };
+ var data = new ChartPointData("test", new ChartPointStyle(Color.Red, 3, Color.Red, strokeThickness, ChartPointSymbol.Circle));
// Call
converter.ConvertSeriesProperties(data, lineSeries);
@@ -171,10 +159,7 @@
// Setup
var converter = new ChartPointDataConverter();
var lineSeries = new LineSeries();
- var data = new ChartPointData("test")
- {
- Style = new ChartPointStyle(Color.Red, 3, Color.Red, 2, symbol)
- };
+ var data = new ChartPointData("test", new ChartPointStyle(Color.Red, 3, Color.Red, 2, symbol));
// Call
converter.ConvertSeriesProperties(data, lineSeries);
Index: Core/Components/test/Core.Components.OxyPlot.Test/DataSeries/ChartPointDataSeriesTest.cs
===================================================================
diff -u -r271bd5ffd4d61da4324eb50957f062b14c4c6958 -r8616c7f9f5791dff264dc5fe8ce598dbfe6ecb03
--- Core/Components/test/Core.Components.OxyPlot.Test/DataSeries/ChartPointDataSeriesTest.cs (.../ChartPointDataSeriesTest.cs) (revision 271bd5ffd4d61da4324eb50957f062b14c4c6958)
+++ Core/Components/test/Core.Components.OxyPlot.Test/DataSeries/ChartPointDataSeriesTest.cs (.../ChartPointDataSeriesTest.cs) (revision 8616c7f9f5791dff264dc5fe8ce598dbfe6ecb03)
@@ -51,7 +51,7 @@
public void Constructor_ChartPointDataWithTestProperties_ChartPointDataSeriesCreatedAccordingly()
{
// Setup
- var chartPointData = new ChartPointData("Test name");
+ var chartPointData = new ChartPointData("Test name", new ChartPointStyle(Color.Red, 4, Color.Blue, 2, ChartPointSymbol.Circle));
SetChartPointDataTestProperties(chartPointData);
@@ -68,7 +68,7 @@
public void Update_ChartPointDataWithTestProperties_ChartPointDataSeriesUpdatedAccordingly()
{
// Setup
- var chartPointData = new ChartPointData("Test name");
+ var chartPointData = new ChartPointData("Test name", new ChartPointStyle(Color.Red, 4, Color.Blue, 2, ChartPointSymbol.Circle));
var chartPointDataSeries = new ChartPointDataSeries(chartPointData);
SetChartPointDataTestProperties(chartPointData);
@@ -135,7 +135,6 @@
{
chartPointData.Name = "Another name";
chartPointData.IsVisible = false;
- chartPointData.Style = new ChartPointStyle(Color.Red, 4, Color.Blue, 2, ChartPointSymbol.Circle);
chartPointData.Points = new[]
{
new Point2D(1.1, 2.2)
@@ -161,11 +160,11 @@
Assert.AreEqual("Test name", chartPointDataSeries.Title);
Assert.IsTrue(chartPointDataSeries.IsVisible);
- Assert.AreEqual(3, chartPointDataSeries.MarkerSize);
- Assert.AreEqual(OxyColor.FromArgb(0, 0, 0, 1), chartPointDataSeries.MarkerFill);
- Assert.AreEqual(OxyColor.FromArgb(0, 0, 0, 1), chartPointDataSeries.MarkerStroke);
- Assert.AreEqual(1, chartPointDataSeries.MarkerStrokeThickness);
- Assert.AreEqual(MarkerType.None, chartPointDataSeries.MarkerType);
+ Assert.AreEqual(4, chartPointDataSeries.MarkerSize);
+ Assert.AreEqual(OxyColor.FromArgb(Color.Red.A, Color.Red.R, Color.Red.G, Color.Red.B), chartPointDataSeries.MarkerFill);
+ Assert.AreEqual(OxyColor.FromArgb(Color.Blue.A, Color.Blue.R, Color.Blue.G, Color.Blue.B), chartPointDataSeries.MarkerStroke);
+ Assert.AreEqual(2, chartPointDataSeries.MarkerStrokeThickness);
+ Assert.AreEqual(MarkerType.Circle, chartPointDataSeries.MarkerType);
Assert.AreEqual(0, chartPointDataSeries.ItemsSource.Cast().Count());
}
Index: Demo/Ringtoets/src/Demo.Ringtoets/Commands/OpenChartViewCommand.cs
===================================================================
diff -u -rf4b3f19758b8929693ad8653bbc3c906a75d2983 -r8616c7f9f5791dff264dc5fe8ce598dbfe6ecb03
--- Demo/Ringtoets/src/Demo.Ringtoets/Commands/OpenChartViewCommand.cs (.../OpenChartViewCommand.cs) (revision f4b3f19758b8929693ad8653bbc3c906a75d2983)
+++ Demo/Ringtoets/src/Demo.Ringtoets/Commands/OpenChartViewCommand.cs (.../OpenChartViewCommand.cs) (revision 8616c7f9f5791dff264dc5fe8ce598dbfe6ecb03)
@@ -204,9 +204,9 @@
}
};
- var points1 = new ChartPointData(Resources.OpenChartViewCommand_Execute_Points_one)
+ var points1 = new ChartPointData(Resources.OpenChartViewCommand_Execute_Points_one,
+ new ChartPointStyle(Color.Crimson, 6, Color.AntiqueWhite, 3, ChartPointSymbol.Circle))
{
- Style = new ChartPointStyle(Color.Crimson, 6, Color.AntiqueWhite, 3, ChartPointSymbol.Circle),
Points = new[]
{
new Point2D(0.2, 0.892 + 0.04),
@@ -220,9 +220,9 @@
}
};
- var points2 = new ChartPointData(Resources.OpenChartViewCommand_Execute_Points_two)
+ var points2 = new ChartPointData(Resources.OpenChartViewCommand_Execute_Points_two,
+ new ChartPointStyle(Color.FromArgb(190, Color.Gold), 7, Color.DeepSkyBlue, 2, ChartPointSymbol.Diamond))
{
- Style = new ChartPointStyle(Color.FromArgb(190, Color.Gold), 7, Color.DeepSkyBlue, 2, ChartPointSymbol.Diamond),
Points = new[]
{
new Point2D(0.0, 0.800 + 0.01),
Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Factories/PipingChartDataFactory.cs
===================================================================
diff -u -r12dbf9394aec78889af2c835f9d37237603e8af9 -r8616c7f9f5791dff264dc5fe8ce598dbfe6ecb03
--- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Factories/PipingChartDataFactory.cs (.../PipingChartDataFactory.cs) (revision 12dbf9394aec78889af2c835f9d37237603e8af9)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Factories/PipingChartDataFactory.cs (.../PipingChartDataFactory.cs) (revision 8616c7f9f5791dff264dc5fe8ce598dbfe6ecb03)
@@ -54,10 +54,8 @@
/// The created .
public static ChartPointData CreateEntryPointChartData()
{
- return new ChartPointData(Resources.PipingInput_EntryPointL_DisplayName)
- {
- Style = GetGeneralPointStyle(Color.Gold)
- };
+ return new ChartPointData(Resources.PipingInput_EntryPointL_DisplayName,
+ GetGeneralPointStyle(Color.Gold));
}
///
@@ -66,10 +64,8 @@
/// The created .
public static ChartPointData CreateExitPointChartData()
{
- return new ChartPointData(Resources.PipingInput_ExitPointL_DisplayName)
- {
- Style = GetGeneralPointStyle(Color.Tomato)
- };
+ return new ChartPointData(Resources.PipingInput_ExitPointL_DisplayName,
+ GetGeneralPointStyle(Color.Tomato));
}
///
@@ -78,10 +74,8 @@
/// The created .
public static ChartPointData CreateDitchPolderSideChartData()
{
- return new ChartPointData(PipingDataResources.CharacteristicPoint_DitchPolderSide)
- {
- Style = GetCharacteristicPointStyle(Color.IndianRed)
- };
+ return new ChartPointData(PipingDataResources.CharacteristicPoint_DitchPolderSide,
+ GetCharacteristicPointStyle(Color.IndianRed));
}
///
@@ -90,10 +84,8 @@
/// The created .
public static ChartPointData CreateBottomDitchPolderSideChartData()
{
- return new ChartPointData(PipingDataResources.CharacteristicPoint_BottomDitchPolderSide)
- {
- Style = GetCharacteristicPointStyle(Color.Teal)
- };
+ return new ChartPointData(PipingDataResources.CharacteristicPoint_BottomDitchPolderSide,
+ GetCharacteristicPointStyle(Color.Teal));
}
///
@@ -102,10 +94,8 @@
/// The created .
public static ChartPointData CreateBottomDitchDikeSideChartData()
{
- return new ChartPointData(PipingDataResources.CharacteristicPoint_BottomDitchDikeSide)
- {
- Style = GetCharacteristicPointStyle(Color.DarkSeaGreen)
- };
+ return new ChartPointData(PipingDataResources.CharacteristicPoint_BottomDitchDikeSide,
+ GetCharacteristicPointStyle(Color.DarkSeaGreen));
}
///
@@ -114,10 +104,8 @@
/// The created .
public static ChartPointData CreateDitchDikeSideChartData()
{
- return new ChartPointData(PipingDataResources.CharacteristicPoint_DitchDikeSide)
- {
- Style = GetCharacteristicPointStyle(Color.MediumPurple)
- };
+ return new ChartPointData(PipingDataResources.CharacteristicPoint_DitchDikeSide,
+ GetCharacteristicPointStyle(Color.MediumPurple));
}
///
@@ -126,10 +114,8 @@
/// The created .
public static ChartPointData CreateDikeToeAtRiverChartData()
{
- return new ChartPointData(PipingDataResources.CharacteristicPoint_DikeToeAtRiver)
- {
- Style = GetCharacteristicPointStyle(Color.DarkBlue)
- };
+ return new ChartPointData(PipingDataResources.CharacteristicPoint_DikeToeAtRiver,
+ GetCharacteristicPointStyle(Color.DarkBlue));
}
///
@@ -138,10 +124,8 @@
/// The created .
public static ChartPointData CreateDikeToeAtPolderChartData()
{
- return new ChartPointData(PipingDataResources.CharacteristicPoint_DikeToeAtPolder)
- {
- Style = GetCharacteristicPointStyle(Color.SlateGray)
- };
+ return new ChartPointData(PipingDataResources.CharacteristicPoint_DikeToeAtPolder,
+ GetCharacteristicPointStyle(Color.SlateGray));
}
///
@@ -175,7 +159,7 @@
PipingSoilLayer soilLayer = soilProfile.Layers.ElementAt(soilLayerIndex);
- return new ChartMultipleAreaData(string.Format("{0} {1}", soilLayerIndex + 1, soilLayer.MaterialName))
+ return new ChartMultipleAreaData($"{soilLayerIndex + 1} {soilLayer.MaterialName}")
{
Style = new ChartAreaStyle(soilLayer.Color, Color.Black, 1)
};