Index: Core/Components/src/Core.Components.OxyPlot.Forms/CategoryPlotView.cs =================================================================== diff -u -r44c53e8ad9342f1b23ce2524c9fa69b92045bf53 -r9d6009f11b5c63518c693e3d3be199ca9279015d --- Core/Components/src/Core.Components.OxyPlot.Forms/CategoryPlotView.cs (.../CategoryPlotView.cs) (revision 44c53e8ad9342f1b23ce2524c9fa69b92045bf53) +++ Core/Components/src/Core.Components.OxyPlot.Forms/CategoryPlotView.cs (.../CategoryPlotView.cs) (revision 9d6009f11b5c63518c693e3d3be199ca9279015d) @@ -34,13 +34,15 @@ internal sealed class CategoryPlotView : PlotView { private readonly CategoryAxis categoryAxis; + private readonly LinearAxis linearAxis; /// /// Creates a new . /// public CategoryPlotView() { Dock = DockStyle.Fill; + categoryAxis = new CategoryAxis { MinorStep = 1, @@ -50,20 +52,22 @@ IsZoomEnabled = false }; + linearAxis = new LinearAxis + { + AbsoluteMinimum = 0, + AbsoluteMaximum = 1, + MaximumPadding = 0.06, + MinimumPadding = 0, + IsPanEnabled = false, + IsZoomEnabled = false + }; + Model = new PlotModel { Axes = { categoryAxis, - new LinearAxis - { - AbsoluteMinimum = 0, - AbsoluteMaximum = 1, - MaximumPadding = 0.06, - MinimumPadding = 0, - IsPanEnabled = false, - IsZoomEnabled = false - } + linearAxis }, LegendBorderThickness = 0, LegendOrientation = LegendOrientation.Horizontal, @@ -89,6 +93,22 @@ } /// + /// Gets or sets the title of the vertical axis of the plot view. + /// + public string VerticalAxisTitle + { + get + { + return linearAxis.Title; + } + set + { + linearAxis.Title = value; + InvalidatePlot(false); + } + } + + /// /// Adds labels to the /// /// The labels to add. Index: Core/Components/src/Core.Components.OxyPlot.Forms/StackChartControl.cs =================================================================== diff -u -r605c8d2b21b073e783a46ca6d0cf2393def8620c -r9d6009f11b5c63518c693e3d3be199ca9279015d --- Core/Components/src/Core.Components.OxyPlot.Forms/StackChartControl.cs (.../StackChartControl.cs) (revision 605c8d2b21b073e783a46ca6d0cf2393def8620c) +++ Core/Components/src/Core.Components.OxyPlot.Forms/StackChartControl.cs (.../StackChartControl.cs) (revision 9d6009f11b5c63518c693e3d3be199ca9279015d) @@ -93,6 +93,18 @@ } } + public string VerticalAxisTitle + { + get + { + return plotView.VerticalAxisTitle; + } + set + { + plotView.VerticalAxisTitle = value; + } + } + protected override void Dispose(bool disposing) { plotView.Dispose(); Index: Core/Components/test/Core.Components.OxyPlot.Forms.Test/CategoryPlotViewTest.cs =================================================================== diff -u -r82beae540257b0a91094838c1a020d043431a93a -r9d6009f11b5c63518c693e3d3be199ca9279015d --- Core/Components/test/Core.Components.OxyPlot.Forms.Test/CategoryPlotViewTest.cs (.../CategoryPlotViewTest.cs) (revision 82beae540257b0a91094838c1a020d043431a93a) +++ Core/Components/test/Core.Components.OxyPlot.Forms.Test/CategoryPlotViewTest.cs (.../CategoryPlotViewTest.cs) (revision 9d6009f11b5c63518c693e3d3be199ca9279015d) @@ -42,23 +42,27 @@ Assert.IsInstanceOf(plotView); Assert.AreEqual(DockStyle.Fill, plotView.Dock); + Assert.IsNull(plotView.ModelTitle); + Assert.IsNull(plotView.VerticalAxisTitle); + PlotModel plotModel = plotView.Model; ElementCollection axes = plotModel.Axes; Assert.AreEqual(2, axes.Count); - CategoryAxis categoryAxis = axes.OfType().First(); + Axis categoryAxis = axes.First(ax => ax.GetType() == typeof(CategoryAxis)); Assert.AreEqual(1, categoryAxis.MinorStep); Assert.AreEqual(90, categoryAxis.Angle); Assert.AreEqual(-0.5, categoryAxis.AbsoluteMinimum); Assert.IsFalse(categoryAxis.IsPanEnabled); Assert.IsFalse(categoryAxis.IsZoomEnabled); - LinearAxis linearAxis = axes.OfType().First(); + Axis linearAxis = axes.First(ax => ax.GetType() == typeof(LinearAxis)); Assert.AreEqual(0, linearAxis.MinimumPadding); Assert.IsFalse(linearAxis.IsPanEnabled); Assert.IsFalse(linearAxis.IsZoomEnabled); + Assert.IsNull(linearAxis.Title); Assert.AreEqual(0, plotModel.LegendBorderThickness); Assert.AreEqual(LegendOrientation.Horizontal, plotModel.LegendOrientation); @@ -87,12 +91,42 @@ view.ModelTitle = newTitle; // Assert - Assert.AreEqual(view.ModelTitle, newTitle); + Assert.AreEqual(newTitle, view.Model.Title); Assert.AreEqual(1, invalidated); } } [Test] + [TestCase("Title")] + [TestCase("")] + [TestCase(null)] + [TestCase(" ")] + public void VerticalAxisTitle_AlwaysSetsNewVerticalAxisTitleToModelAndInvalidatesView(string newTitle) + { + // Setup + using (var form = new Form()) + using (var view = new CategoryPlotView()) + { + form.Controls.Add(view); + var invalidated = 0; + view.Invalidated += (sender, args) => invalidated++; + + form.Show(); + + // Call + view.VerticalAxisTitle = newTitle; + + // Assert + PlotModel plotModel = view.Model; + + ElementCollection axes = plotModel.Axes; + var categoryAxis = (LinearAxis) axes.First(ax => ax.GetType() == typeof(LinearAxis)); + Assert.AreEqual(newTitle, categoryAxis.Title); + Assert.AreEqual(1, invalidated); + } + } + + [Test] public void AddLabels_LabelsNull_ThrowsArgumentNullException() { // Setup Index: Core/Components/test/Core.Components.OxyPlot.Forms.Test/StackChartControlTest.cs =================================================================== diff -u -r605c8d2b21b073e783a46ca6d0cf2393def8620c -r9d6009f11b5c63518c693e3d3be199ca9279015d --- Core/Components/test/Core.Components.OxyPlot.Forms.Test/StackChartControlTest.cs (.../StackChartControlTest.cs) (revision 605c8d2b21b073e783a46ca6d0cf2393def8620c) +++ Core/Components/test/Core.Components.OxyPlot.Forms.Test/StackChartControlTest.cs (.../StackChartControlTest.cs) (revision 9d6009f11b5c63518c693e3d3be199ca9279015d) @@ -261,11 +261,39 @@ chart.ChartTitle = newTitle; // Assert - Assert.AreEqual(chart.ChartTitle, newTitle); + Assert.AreEqual(newTitle, view.ModelTitle); Assert.AreEqual(1, invalidated); } } + [Test] + [TestCase("Title")] + [TestCase(null)] + [TestCase("")] + [TestCase(" ")] + public void SetVerticalAxisTitle_Always_SetsVerticalAxisTitleToModelAndViewInvalidated(string newTitle) + { + // Setup + using (var form = new Form()) + { + var chart = new StackChartControl(); + CategoryPlotView view = chart.Controls.OfType().Single(); + form.Controls.Add(chart); + + form.Show(); + + var invalidated = 0; + view.Invalidated += (sender, args) => invalidated++; + + // Call + chart.VerticalAxisTitle = newTitle; + + // Assert + Assert.AreEqual(newTitle, view.VerticalAxisTitle); + Assert.AreEqual(1, invalidated); + } + } + private static void AssertSeries(IList expectedSeriesTitles, CategoryPlotView plotView) { ElementCollection series = plotView.Model.Series; Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r5a4e3ce4a8088c1fbb043a029f8081abb4cf1021 -r9d6009f11b5c63518c693e3d3be199ca9279015d --- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 5a4e3ce4a8088c1fbb043a029f8081abb4cf1021) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 9d6009f11b5c63518c693e3d3be199ca9279015d) @@ -1863,6 +1863,15 @@ } /// + /// Looks up a localized string similar to Alpha^2. + /// + public static string IllustrationPointsChartControl_StackChartControl_VerticalAxisTitle { + get { + return ResourceManager.GetString("IllustrationPointsChartControl_StackChartControl_VerticalAxisTitle", resourceCulture); + } + } + + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// public static System.Drawing.Bitmap InputFolderIcon { Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx =================================================================== diff -u -r5a4e3ce4a8088c1fbb043a029f8081abb4cf1021 -r9d6009f11b5c63518c693e3d3be199ca9279015d --- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision 5a4e3ce4a8088c1fbb043a029f8081abb4cf1021) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision 9d6009f11b5c63518c693e3d3be199ca9279015d) @@ -1134,4 +1134,7 @@ Waarden in het illustratiepunt + + Alpha^2 + \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/IllustrationPointsChartControl.Designer.cs =================================================================== diff -u -r6eae633a7798d66e78e7bde85e8bd2e16ba98980 -r9d6009f11b5c63518c693e3d3be199ca9279015d --- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/IllustrationPointsChartControl.Designer.cs (.../IllustrationPointsChartControl.Designer.cs) (revision 6eae633a7798d66e78e7bde85e8bd2e16ba98980) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/IllustrationPointsChartControl.Designer.cs (.../IllustrationPointsChartControl.Designer.cs) (revision 9d6009f11b5c63518c693e3d3be199ca9279015d) @@ -20,6 +20,7 @@ // All rights reserved. using System.Windows.Forms; +using Ringtoets.Common.Forms.Properties; namespace Ringtoets.Common.Forms.Views { @@ -57,6 +58,7 @@ // stackChartControl // this.stackChartControl.ChartTitle = null; + this.stackChartControl.VerticalAxisTitle = Resources.IllustrationPointsChartControl_StackChartControl_VerticalAxisTitle; this.stackChartControl.Data = null; this.stackChartControl.Dock = System.Windows.Forms.DockStyle.Fill; this.stackChartControl.Location = new System.Drawing.Point(0, 0); Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj =================================================================== diff -u -rc072c430cf3193c3ada31a81bd0cd4e75f4a068a -r9d6009f11b5c63518c693e3d3be199ca9279015d --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision c072c430cf3193c3ada31a81bd0cd4e75f4a068a) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 9d6009f11b5c63518c693e3d3be199ca9279015d) @@ -192,6 +192,10 @@ {318BA582-88C9-4816-A54A-A7E431461DE3} Core.Components.Gis + + {DADAA0A5-288C-49CB-9F08-337F16832C86} + Core.Components.OxyPlot.Forms + {72109e33-6518-4632-accf-6cbf2a312711} Core.Components.Stack.Forms Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/IllustrationPointsChartControlTest.cs =================================================================== diff -u -rf288f9ccb9ac465f017170a59279909d8431fdc7 -r9d6009f11b5c63518c693e3d3be199ca9279015d --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/IllustrationPointsChartControlTest.cs (.../IllustrationPointsChartControlTest.cs) (revision f288f9ccb9ac465f017170a59279909d8431fdc7) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/IllustrationPointsChartControlTest.cs (.../IllustrationPointsChartControlTest.cs) (revision 9d6009f11b5c63518c693e3d3be199ca9279015d) @@ -26,8 +26,10 @@ using System.Windows.Forms; using Core.Common.Base.Data; using Core.Common.TestUtil; +using Core.Components.OxyPlot.Forms; using Core.Components.Stack.Data; using Core.Components.Stack.Forms; +using NUnit.Extensions.Forms; using NUnit.Framework; using Ringtoets.Common.Data.IllustrationPoints; using Ringtoets.Common.Data.TestUtil.IllustrationPoints; @@ -55,12 +57,30 @@ } [Test] - public void GivenStackChartControlWithoutData_WhenDataNotNull_ThenStackChartControlUpdated() + public void IllustrationPointsControl_Always_SetsCorrectVerticalAxisTitle() { + // Setup + using (var form = new Form()) + using (var illustrationPointsControl = new IllustrationPointsControl()) + { + form.Controls.Add(illustrationPointsControl); + + // Call + form.Show(); + + // Assert + var stackChartControl = (StackChartControl) new ControlTester("stackChartControl").TheObject; + Assert.AreEqual("Alpha^2", stackChartControl.VerticalAxisTitle); + } + } + + [Test] + public void GivenIllustrationPointsChartControlWithoutData_WhenDataNotNull_ThenStackChartControlUpdated() + { // Given var chartControl = new IllustrationPointsChartControl(); IllustrationPointControlItem[] illustrationPointControlItems = GetControlItems().ToArray(); - + // When chartControl.Data = illustrationPointControlItems; @@ -103,7 +123,7 @@ } [Test] - public void GivenStackChartControlWithData_WhenClosingSituationsAreDifferent_StackChartControlDisplaysClosingSituation() + public void GivenIllustrationPointsChartControlWithData_WhenClosingSituationsAreDifferent_StackChartControlDisplaysClosingSituation() { // Given var chartControl = new IllustrationPointsChartControl(); @@ -112,17 +132,17 @@ const string closingSituationRegular = "Regular"; const string closingSituationOpen = "Open"; - var controlItems =new [] + var controlItems = new[] { - new IllustrationPointControlItem(new TestTopLevelIllustrationPoint(), + new IllustrationPointControlItem(new TestTopLevelIllustrationPoint(), "SE", closingSituationOpen, - Enumerable.Empty(), + Enumerable.Empty(), random.NextRoundedDouble()), new IllustrationPointControlItem(new TestTopLevelIllustrationPoint(), "NE", closingSituationRegular, - Enumerable.Empty(), + Enumerable.Empty(), random.NextRoundedDouble()) }; @@ -142,7 +162,7 @@ } [Test] - public void GivenStackChartControlWithData_WhenDataSetToNull_ThenStackChartControlUpdated() + public void GivenIllustrationPointsChartControlWithData_WhenDataSetToNull_ThenStackChartControlUpdated() { // Given var chartControl = new IllustrationPointsChartControl @@ -160,7 +180,7 @@ } [Test] - public void GivenStackChartControlWithData_WhenDataSetToOther_ThenStackChartControlUpdated() + public void GivenIllustrationPointsChartControlWithData_WhenDataSetToOther_ThenStackChartControlUpdated() { // Given var chartControl = new IllustrationPointsChartControl