Index: Core/Components/src/Core.Components.OxyPlot/BaseChart.cs =================================================================== diff -u --- Core/Components/src/Core.Components.OxyPlot/BaseChart.cs (revision 0) +++ Core/Components/src/Core.Components.OxyPlot/BaseChart.cs (revision bc5cd9c379afef6f6f3fc02f8a890f240fd3fe65) @@ -0,0 +1,71 @@ +using Core.Components.OxyPlot.Properties; +using OxyPlot; +using OxyPlot.Axes; +using OxyPlot.WindowsForms; + +namespace Core.Components.OxyPlot +{ + public class BaseChart : PlotView + { + private LinearAxis xAxis; + private LinearAxis yAxis; + + /// + /// Creates a new instance of . + /// + public BaseChart() + { + Model = new PlotModel(); + InitializeAxes(); + InitializeDefaultStyle(); + } + + /// + /// Sets the default look and feel of the + /// + private void InitializeDefaultStyle() + { + xAxis.MajorGridlineStyle = LineStyle.Solid; + xAxis.MinorGridlineStyle = LineStyle.Dot; + yAxis.MajorGridlineStyle = LineStyle.Solid; + yAxis.MinorGridlineStyle = LineStyle.Dot; + } + + /// + /// Sets up default axes representations. + /// + private void InitializeAxes() + { + xAxis = new LinearAxis + { + Title = Resources.BaseChart_XAxisTitle, + Position = AxisPosition.Bottom, + TickStyle = TickStyle.None + }; + yAxis = new LinearAxis + { + Title = Resources.BaseChart_YAxisTitle, + TickStyle = TickStyle.None + }; + Model.Axes.Add(xAxis); + Model.Axes.Add(yAxis); + } + + /// + /// Add to the . + /// + /// + public void AddData(ChartData data) + { + data.AddTo(Model); + } + + /// + /// Remove all the that has been added to the . + /// + public void ClearData() + { + Model.Series.Clear(); + } + } +} \ No newline at end of file Index: Core/Components/src/Core.Components.OxyPlot/ChartData.cs =================================================================== diff -u -rb7ca402d4388054a86a27c5f76fc81d53afc2461 -rbc5cd9c379afef6f6f3fc02f8a890f240fd3fe65 --- Core/Components/src/Core.Components.OxyPlot/ChartData.cs (.../ChartData.cs) (revision b7ca402d4388054a86a27c5f76fc81d53afc2461) +++ Core/Components/src/Core.Components.OxyPlot/ChartData.cs (.../ChartData.cs) (revision bc5cd9c379afef6f6f3fc02f8a890f240fd3fe65) @@ -1,4 +1,44 @@ -namespace Core.Components.OxyPlot +using System; +using System.Collections.ObjectModel; +using OxyPlot; +using OxyPlot.Series; + +namespace Core.Components.OxyPlot { - public class ChartData {} + public class ChartData + { + private LineSeries series; + + /// + /// Creates a new instance of . + /// + /// A of which represent points on a line. + /// Thrown when is null. + public ChartData(Collection> points) + { + if (points == null) + { + throw new ArgumentNullException("points", "A point collection is required when creating ChartData."); + } + series = new LineSeries + { + ItemsSource = points, + Mapping = point => new DataPoint(((Tuple)point).Item1, ((Tuple)point).Item2) + }; + } + + /// + /// Adds the information in the as a series of the . + /// + /// The to add a series to. + /// Thrown when is null. + public void AddTo(PlotModel model) + { + if (model == null) + { + throw new ArgumentNullException("model", "A model is required to add points to."); + } + model.Series.Add(series); + } + } } \ No newline at end of file Index: Core/Components/src/Core.Components.OxyPlot/Core.Components.OxyPlot.csproj =================================================================== diff -u -rb7ca402d4388054a86a27c5f76fc81d53afc2461 -rbc5cd9c379afef6f6f3fc02f8a890f240fd3fe65 --- Core/Components/src/Core.Components.OxyPlot/Core.Components.OxyPlot.csproj (.../Core.Components.OxyPlot.csproj) (revision b7ca402d4388054a86a27c5f76fc81d53afc2461) +++ Core/Components/src/Core.Components.OxyPlot/Core.Components.OxyPlot.csproj (.../Core.Components.OxyPlot.csproj) (revision bc5cd9c379afef6f6f3fc02f8a890f240fd3fe65) @@ -46,6 +46,7 @@ + @@ -56,12 +57,27 @@ Properties\GlobalAssembly.cs + + Component + + + True + True + Resources.resx + + + + PublicResXFileCodeGenerator + Designer + Resources.Designer.cs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + L + + + Hoogte + + + \ No newline at end of file Index: Core/Components/test/Core.Components.OxyPlot.Test/BaseChartTest.cs =================================================================== diff -u --- Core/Components/test/Core.Components.OxyPlot.Test/BaseChartTest.cs (revision 0) +++ Core/Components/test/Core.Components.OxyPlot.Test/BaseChartTest.cs (revision bc5cd9c379afef6f6f3fc02f8a890f240fd3fe65) @@ -0,0 +1,23 @@ +using NUnit.Framework; +using OxyPlot; +using OxyPlot.WindowsForms; + +namespace Core.Components.OxyPlot.Test +{ + [TestFixture] + public class BaseChartTest + { + [Test] + public void DefaultConstructor_PropertiesSet() + { + // Call + var chart = new BaseChart(); + + // Assert + Assert.IsInstanceOf(chart); + Assert.IsInstanceOf(chart.Model); + Assert.IsNull(chart.Controller); + Assert.AreEqual(2, chart.Model.Axes.Count); + } + } +} \ No newline at end of file Index: Core/Components/test/Core.Components.OxyPlot.Test/ChartDataTest.cs =================================================================== diff -u --- Core/Components/test/Core.Components.OxyPlot.Test/ChartDataTest.cs (revision 0) +++ Core/Components/test/Core.Components.OxyPlot.Test/ChartDataTest.cs (revision bc5cd9c379afef6f6f3fc02f8a890f240fd3fe65) @@ -0,0 +1,86 @@ +using System; +using System.Collections.ObjectModel; +using NUnit.Framework; +using OxyPlot; + +namespace Core.Components.OxyPlot.Test +{ + [TestFixture] + public class ChartDataTest + { + [Test] + public void Constructor_NullPoints_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => new ChartData(null); + + // Assert + Assert.Throws(test); + } + + [Test] + public void Constructor_WithEmptyPoints_DoesNotThrow() + { + // Setup + var points = new Collection>(); + + // Call + TestDelegate test = () => new ChartData(points); + + // Assert + Assert.DoesNotThrow(test); + } + + [Test] + public void Constructor_WithPoints_DoesNotThrow() + { + // Setup + var points = CreateTestPoints(); + + // Call + TestDelegate test = () => new ChartData(points); + + // Assert + Assert.DoesNotThrow(test); + } + + [Test] + public void AddTo_NoModel_ThrowsArgumentNullException() + { + // Setup + var points = CreateTestPoints(); + var testData = new ChartData(points); + + // Call + TestDelegate test = () => testData.AddTo(null); + + // Assert + Assert.Throws(test); + } + + [Test] + public void AddTo_Model_DataAddedToModelAsSeries() + { + // Setup + var points = CreateTestPoints(); + var testData = new ChartData(points); + var model = new PlotModel(); + + // Call + testData.AddTo(model); + + // Assert + Assert.AreEqual(1, model.Series.Count); + } + + private Collection> CreateTestPoints() + { + return new Collection> + { + new Tuple(0.0, 1.1), + new Tuple(1.0, 2.1), + new Tuple(1.6, 1.6) + }; + } + } +} \ No newline at end of file Index: Core/Components/test/Core.Components.OxyPlot.Test/Core.Components.OxyPlot.Test.csproj =================================================================== diff -u -r3d4b98ca16e7a608e4db4ba639c028ce81bd440f -rbc5cd9c379afef6f6f3fc02f8a890f240fd3fe65 --- Core/Components/test/Core.Components.OxyPlot.Test/Core.Components.OxyPlot.Test.csproj (.../Core.Components.OxyPlot.Test.csproj) (revision 3d4b98ca16e7a608e4db4ba639c028ce81bd440f) +++ Core/Components/test/Core.Components.OxyPlot.Test/Core.Components.OxyPlot.Test.csproj (.../Core.Components.OxyPlot.Test.csproj) (revision bc5cd9c379afef6f6f3fc02f8a890f240fd3fe65) @@ -39,17 +39,39 @@ MinimumRecommendedRules.ruleset + + ..\..\..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll + + + ..\..\..\..\packages\OxyPlot.Core.1.0.0-unstable1953\lib\net40\OxyPlot.dll + + + False + ..\..\..\..\packages\OxyPlot.WindowsForms.1.0.0-unstable1953\lib\net40\OxyPlot.WindowsForms.dll + + + + + + + + + + {2344A7BD-7E25-4A1A-982E-6C674AF5167A} + Core.Components.OxyPlot + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file Index: Core/Plugins/src/Core.Plugins.OxyPlot/OpenChartViewCommand.cs =================================================================== diff -u -rb7ca402d4388054a86a27c5f76fc81d53afc2461 -rbc5cd9c379afef6f6f3fc02f8a890f240fd3fe65 --- Core/Plugins/src/Core.Plugins.OxyPlot/OpenChartViewCommand.cs (.../OpenChartViewCommand.cs) (revision b7ca402d4388054a86a27c5f76fc81d53afc2461) +++ Core/Plugins/src/Core.Plugins.OxyPlot/OpenChartViewCommand.cs (.../OpenChartViewCommand.cs) (revision bc5cd9c379afef6f6f3fc02f8a890f240fd3fe65) @@ -1,4 +1,6 @@ -using Core.Common.Gui; +using System; +using System.Collections.ObjectModel; +using Core.Common.Gui; using Core.Components.OxyPlot; namespace Core.Plugins.OxyPlot @@ -24,7 +26,13 @@ public void Execute(params object[] arguments) { - Gui.DocumentViewsResolver.OpenViewForData(new ChartData()); + ChartData line = new ChartData(new Collection> + { + new Tuple(0.0, 1.1), + new Tuple(1.0, 2.1), + new Tuple(1.6, 1.6) + }); + Gui.DocumentViewsResolver.OpenViewForData(line); } } } \ No newline at end of file Index: Core/Plugins/src/Core.Plugins.OxyPlot/packages.config =================================================================== diff -u --- Core/Plugins/src/Core.Plugins.OxyPlot/packages.config (revision 0) +++ Core/Plugins/src/Core.Plugins.OxyPlot/packages.config (revision bc5cd9c379afef6f6f3fc02f8a890f240fd3fe65) @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file Index: packages/repositories.config =================================================================== diff -u -rbbb0ff8397bcb1097043adeed8f78710a9779fb5 -rbc5cd9c379afef6f6f3fc02f8a890f240fd3fe65 --- packages/repositories.config (.../repositories.config) (revision bbb0ff8397bcb1097043adeed8f78710a9779fb5) +++ packages/repositories.config (.../repositories.config) (revision bc5cd9c379afef6f6f3fc02f8a890f240fd3fe65) @@ -24,6 +24,7 @@ + @@ -34,6 +35,7 @@ +