Index: Core/Components/src/Core.Components.OxyPlot.Forms/BaseChart.cs =================================================================== diff -u -ra70fac40e34e16bed007b1d0d4e437d91c89d0cb -rec36de61b0eb813fedd9616e5113bd695470935c --- Core/Components/src/Core.Components.OxyPlot.Forms/BaseChart.cs (.../BaseChart.cs) (revision a70fac40e34e16bed007b1d0d4e437d91c89d0cb) +++ Core/Components/src/Core.Components.OxyPlot.Forms/BaseChart.cs (.../BaseChart.cs) (revision ec36de61b0eb813fedd9616e5113bd695470935c) @@ -1,41 +1,49 @@ using System; +using System.Collections.Generic; +using System.Windows.Forms; using Core.Components.OxyPlot.Data; using Core.Components.OxyPlot.Properties; using OxyPlot; using OxyPlot.Axes; -using OxyPlot.Series; using OxyPlot.WindowsForms; +using TickStyle = OxyPlot.Axes.TickStyle; namespace Core.Components.OxyPlot.Forms { /// /// This class describes a plot view with configured representation of axes. /// - public sealed class BaseChart : PlotView + public sealed class BaseChart : Control { - private LinearAxis xAxis; - private LinearAxis yAxis; - + private PlotView view; + + public ICollection Series { get; private set; } + /// /// Creates a new instance of . /// public BaseChart() { - Model = new PlotModel(); - InitializeAxes(); - + InitializePlotView(); + Series = new List(); MinimumSize = new System.Drawing.Size(50, 75); } - /// - /// Sets up default axes representations. - /// - private void InitializeAxes() + private void InitializePlotView() { - xAxis = CreateAxis(Resources.BaseChart_XAxisTitle, AxisPosition.Bottom); - yAxis = CreateAxis(Resources.BaseChart_YAxisTitle, AxisPosition.Left); - Model.Axes.Add(xAxis); - Model.Axes.Add(yAxis); + view = new PlotView + { + Dock = DockStyle.Fill, + Model = new PlotModel + { + Axes = + { + CreateAxis(Resources.BaseChart_XAxisTitle, AxisPosition.Bottom), + CreateAxis(Resources.BaseChart_YAxisTitle, AxisPosition.Left) + } + } + }; + Controls.Add(view); } /// @@ -70,29 +78,39 @@ { throw new ArgumentNullException("data", "Cannot add null data to the chart."); } - data.AddTo(Model); + Series.Add(data); + UpdateTree(); } /// /// Remove all the that has been added to the . /// public void ClearData() { - Model.Series.Clear(); + Series.Clear(); + UpdateTree(); } + private void UpdateTree() + { + view.Model.Series.Clear(); + foreach (var data in Series) + { + view.Model.Series.Add(((ISeries)data).Series); + } + } + /// /// Sets the visibility of a series in this . /// /// The to set the visibility for. /// A boolean value representing the new visibility of the . public void SetVisibility(IChartData series, bool visibility) { - var chartData = series as Series; - if (chartData != null) + if (series != null) { - chartData.IsVisible = visibility; - Invalidate(); + series.IsVisible = visibility; + view.Invalidate(); } else { Index: Core/Components/src/Core.Components.OxyPlot.Forms/Properties/AssemblyInfo.cs =================================================================== diff -u -r570101d9648e296b96c7e624c4d4f6bfad8d41b6 -rec36de61b0eb813fedd9616e5113bd695470935c --- Core/Components/src/Core.Components.OxyPlot.Forms/Properties/AssemblyInfo.cs (.../AssemblyInfo.cs) (revision 570101d9648e296b96c7e624c4d4f6bfad8d41b6) +++ Core/Components/src/Core.Components.OxyPlot.Forms/Properties/AssemblyInfo.cs (.../AssemblyInfo.cs) (revision ec36de61b0eb813fedd9616e5113bd695470935c) @@ -1,6 +1,8 @@ using System.Reflection; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Core.Components.OxyPlot.Forms")] [assembly: AssemblyProduct("Core.Components.OxyPlot.Forms")] -[assembly: Guid("9b055a22-085f-40fb-89e6-38a9edc8b4c0")] \ No newline at end of file +[assembly: Guid("9b055a22-085f-40fb-89e6-38a9edc8b4c0")] +[assembly: InternalsVisibleTo("Core.Components.OxyPlot.Forms.Test")] \ No newline at end of file Index: Core/Components/src/Core.Components.OxyPlot/Core.Components.OxyPlot.csproj =================================================================== diff -u -r570101d9648e296b96c7e624c4d4f6bfad8d41b6 -rec36de61b0eb813fedd9616e5113bd695470935c --- Core/Components/src/Core.Components.OxyPlot/Core.Components.OxyPlot.csproj (.../Core.Components.OxyPlot.csproj) (revision 570101d9648e296b96c7e624c4d4f6bfad8d41b6) +++ Core/Components/src/Core.Components.OxyPlot/Core.Components.OxyPlot.csproj (.../Core.Components.OxyPlot.csproj) (revision ec36de61b0eb813fedd9616e5113bd695470935c) @@ -49,7 +49,7 @@ Properties\GlobalAssembly.cs - + Index: Core/Components/src/Core.Components.OxyPlot/Data/AreaData.cs =================================================================== diff -u -r5a98830aee77b1ee0158c11ba5cccffc656226e0 -rec36de61b0eb813fedd9616e5113bd695470935c --- Core/Components/src/Core.Components.OxyPlot/Data/AreaData.cs (.../AreaData.cs) (revision 5a98830aee77b1ee0158c11ba5cccffc656226e0) +++ Core/Components/src/Core.Components.OxyPlot/Data/AreaData.cs (.../AreaData.cs) (revision ec36de61b0eb813fedd9616e5113bd695470935c) @@ -9,8 +9,10 @@ /// /// This class represents data which is represented as an area on . /// - public class AreaData : AreaSeries, IChartData + public class AreaData : ISeries { + private AreaSeries series = new AreaSeries(); + /// /// Creates a new instance of . /// @@ -25,11 +27,11 @@ } foreach (var p in points) { - Points.Add(TupleToDataPoint(p)); + series.Points.Add(TupleToDataPoint(p)); } if (points.Count > 0) { - Points2.Add(TupleToDataPoint(points.First())); + series.Points2.Add(TupleToDataPoint(points.First())); } } @@ -38,18 +40,24 @@ return new DataPoint(point.Item1, 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) + public Series Series { - if (model == null) + get { - throw new ArgumentNullException("model", "A model is required to add points to."); + return series; } - model.Series.Add(this); } + + public bool IsVisible + { + get + { + return series.IsVisible; + } + set + { + series.IsVisible = value; + } + } } } \ No newline at end of file Fisheye: Tag ec36de61b0eb813fedd9616e5113bd695470935c refers to a dead (removed) revision in file `Core/Components/src/Core.Components.OxyPlot/Data/CollectionData.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Components/src/Core.Components.OxyPlot/Data/IChartData.cs =================================================================== diff -u -r4ea1323ca52ee52133113dbc01bae0429946d0d4 -rec36de61b0eb813fedd9616e5113bd695470935c --- Core/Components/src/Core.Components.OxyPlot/Data/IChartData.cs (.../IChartData.cs) (revision 4ea1323ca52ee52133113dbc01bae0429946d0d4) +++ Core/Components/src/Core.Components.OxyPlot/Data/IChartData.cs (.../IChartData.cs) (revision ec36de61b0eb813fedd9616e5113bd695470935c) @@ -1,18 +1,9 @@ -using System; -using OxyPlot; - -namespace Core.Components.OxyPlot.Data +namespace Core.Components.OxyPlot.Data { /// - /// This interface describes the data which can be added to the . + /// This interface describes the chart data. /// public interface IChartData { - - /// - /// Adds the information in the as a series of the . - /// - /// The to add a series to. - /// Thrown when is null. - void AddTo(PlotModel model); + bool IsVisible { get; set; } } } \ No newline at end of file Index: Core/Components/src/Core.Components.OxyPlot/Data/ISeries.cs =================================================================== diff -u --- Core/Components/src/Core.Components.OxyPlot/Data/ISeries.cs (revision 0) +++ Core/Components/src/Core.Components.OxyPlot/Data/ISeries.cs (revision ec36de61b0eb813fedd9616e5113bd695470935c) @@ -0,0 +1,11 @@ +using OxyPlot.Series; + +namespace Core.Components.OxyPlot.Data +{ + internal interface ISeries : IChartData { + Series Series + { + get; + } + } +} \ No newline at end of file Index: Core/Components/src/Core.Components.OxyPlot/Data/LineData.cs =================================================================== diff -u -r5a98830aee77b1ee0158c11ba5cccffc656226e0 -rec36de61b0eb813fedd9616e5113bd695470935c --- Core/Components/src/Core.Components.OxyPlot/Data/LineData.cs (.../LineData.cs) (revision 5a98830aee77b1ee0158c11ba5cccffc656226e0) +++ Core/Components/src/Core.Components.OxyPlot/Data/LineData.cs (.../LineData.cs) (revision ec36de61b0eb813fedd9616e5113bd695470935c) @@ -8,8 +8,9 @@ /// /// This class represents data which is represented as a line on . /// - public class LineData : LineSeries, IChartData + public class LineData : ISeries { + private LineSeries series = new LineSeries(); /// /// Creates a new instance of . @@ -23,8 +24,8 @@ { throw new ArgumentNullException("points", "A point collection is required when creating ChartData."); } - ItemsSource = points; - Mapping = TupleToDataPoint; + series.ItemsSource = points; + series.Mapping = TupleToDataPoint; } private DataPoint TupleToDataPoint(object obj) @@ -33,18 +34,24 @@ return new DataPoint(point.Item1, 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) + public Series Series { - if (model == null) + get { - throw new ArgumentNullException("model", "A model is required to add points to."); + return series; } - model.Series.Add(this); } + + public bool IsVisible + { + get + { + return series.IsVisible; + } + set + { + series.IsVisible = value; + } + } } } \ No newline at end of file Index: Core/Components/src/Core.Components.OxyPlot/Data/PointData.cs =================================================================== diff -u -r5a98830aee77b1ee0158c11ba5cccffc656226e0 -rec36de61b0eb813fedd9616e5113bd695470935c --- Core/Components/src/Core.Components.OxyPlot/Data/PointData.cs (.../PointData.cs) (revision 5a98830aee77b1ee0158c11ba5cccffc656226e0) +++ Core/Components/src/Core.Components.OxyPlot/Data/PointData.cs (.../PointData.cs) (revision ec36de61b0eb813fedd9616e5113bd695470935c) @@ -8,8 +8,10 @@ /// /// This class represents data which is represented as points on . /// - public class PointData : LineSeries, IChartData + public class PointData : ISeries { + private LineSeries series = new LineSeries(); + /// /// Creates a new instance of . /// @@ -21,10 +23,10 @@ { throw new ArgumentNullException("points", "A point collection is required when creating ChartData."); } - ItemsSource = points; - Mapping = TupleToDataPoint; - LineStyle = LineStyle.None; - MarkerType = MarkerType.Circle; + series.ItemsSource = points; + series.Mapping = TupleToDataPoint; + series.LineStyle = LineStyle.None; + series.MarkerType = MarkerType.Circle; } private DataPoint TupleToDataPoint(object obj) @@ -33,18 +35,24 @@ return new DataPoint(point.Item1, 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) + public Series Series { - if (model == null) + get { - throw new ArgumentNullException("model", "A model is required to add points to."); + return series; } - model.Series.Add(this); } + + public bool IsVisible + { + get + { + return series.IsVisible; + } + set + { + series.IsVisible = value; + } + } } } \ No newline at end of file Index: Core/Components/src/Core.Components.OxyPlot/Properties/AssemblyInfo.cs =================================================================== diff -u -r3d4b98ca16e7a608e4db4ba639c028ce81bd440f -rec36de61b0eb813fedd9616e5113bd695470935c --- Core/Components/src/Core.Components.OxyPlot/Properties/AssemblyInfo.cs (.../AssemblyInfo.cs) (revision 3d4b98ca16e7a608e4db4ba639c028ce81bd440f) +++ Core/Components/src/Core.Components.OxyPlot/Properties/AssemblyInfo.cs (.../AssemblyInfo.cs) (revision ec36de61b0eb813fedd9616e5113bd695470935c) @@ -1,6 +1,10 @@ using System.Reflection; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Core.Components.OxyPlot")] [assembly: AssemblyProduct("Core.Components.OxyPlot")] [assembly: Guid("05a1a16f-6f4f-4ebb-9540-b09a94bfded0")] +[assembly: InternalsVisibleTo("Core.Components.OxyPlot.Forms")] +[assembly: InternalsVisibleTo("Core.Components.OxyPlot.Forms.Test")] +[assembly: InternalsVisibleTo("Core.Components.OxyPlot.Test")] \ No newline at end of file Index: Core/Components/test/Core.Components.OxyPlot.Forms.Test/BaseChartTest.cs =================================================================== diff -u -r570101d9648e296b96c7e624c4d4f6bfad8d41b6 -rec36de61b0eb813fedd9616e5113bd695470935c --- Core/Components/test/Core.Components.OxyPlot.Forms.Test/BaseChartTest.cs (.../BaseChartTest.cs) (revision 570101d9648e296b96c7e624c4d4f6bfad8d41b6) +++ Core/Components/test/Core.Components.OxyPlot.Forms.Test/BaseChartTest.cs (.../BaseChartTest.cs) (revision ec36de61b0eb813fedd9616e5113bd695470935c) @@ -1,11 +1,10 @@ using System; using System.Collections.ObjectModel; using System.Linq; +using System.Windows.Forms; using Core.Components.OxyPlot.Data; using NUnit.Framework; -using OxyPlot; using OxyPlot.Series; -using OxyPlot.WindowsForms; using Rhino.Mocks; namespace Core.Components.OxyPlot.Forms.Test @@ -20,11 +19,7 @@ var chart = new BaseChart(); // Assert - Assert.IsInstanceOf(chart); - Assert.IsInstanceOf(chart.Model); - Assert.IsNull(chart.Controller); - Assert.AreEqual(2, chart.Model.Axes.Count); - + Assert.IsInstanceOf(chart); Assert.AreEqual(75, chart.MinimumSize.Height); Assert.AreEqual(50, chart.MinimumSize.Width); } @@ -43,31 +38,12 @@ } [Test] - public void AddData_WithIChartData_Added() - { - // Setup - var mocks = new MockRepository(); - var chart = new BaseChart(); - var dataMock = mocks.StrictMock(); - dataMock.Expect(d => d.AddTo(chart.Model)); - - mocks.ReplayAll(); - - // Call - chart.AddData(dataMock); - - // Assert - mocks.VerifyAll(); - } - - [Test] public void ClearData_Always_RemovesSeriesFromModel() { // Setup var mocks = new MockRepository(); var chart = new BaseChart(); - var dataMock = mocks.StrictMock(); - dataMock.Expect(d => d.AddTo(chart.Model)); + var dataMock = new TestChartData(mocks.Stub()); mocks.ReplayAll(); chart.AddData(dataMock); @@ -76,73 +52,42 @@ chart.ClearData(); // Assert - Assert.IsEmpty(chart.Model.Series); + Assert.IsEmpty(chart.Series); mocks.VerifyAll(); } [Test] - public void GivenBaseChart_WhenPointDataAdded_ThenSeriesHasPointStyle() + public void AddData_Always_AddsToSeries() { // Given + var mocks = new MockRepository(); var chart = new BaseChart(); - var pointData = new PointData(new Collection>()); + var dataMock = new TestChartData(mocks.Stub()); // When - chart.AddData(pointData); + chart.AddData(dataMock); // Then - var pointSeries = (LineSeries)chart.Model.Series.First(); - Assert.AreEqual(LineStyle.None, pointSeries.LineStyle); - Assert.AreEqual(MarkerType.Circle, pointSeries.MarkerType); + Assert.IsInstanceOf(chart.Series.First()); } + } - [Test] - public void GivenBaseChart_WhenLineDataAdded_ThenSeriesIsLineSeries() - { - // Given - var chart = new BaseChart(); - var pointData = new LineData(new Collection>()); + public class TestChartData : ISeries { + private Series series; - // When - chart.AddData(pointData); - - // Then - Assert.IsInstanceOf(chart.Model.Series.First()); - } - - [Test] - public void GivenBaseChart_WhenAreaDataAdded_ThenSeriesIsAreaSeries() + public TestChartData(Series series) { - // Given - var chart = new BaseChart(); - var pointData = new AreaData(new Collection>()); - - // When - chart.AddData(pointData); - - // Then - Assert.IsInstanceOf(chart.Model.Series.First()); + this.series = series; } - [Test] - [TestCase(0)] - [TestCase(1)] - [TestCase(11)] - public void GivenANumberOfChartData_WhenAddedToChart_AddsSameNumberOfSeriesToModel(int numberOfSeries) + public bool IsVisible { get; set; } + + public Series Series { - // Given - var chart = new BaseChart(); - var data = new CollectionData(); - for (int i = 0; i < numberOfSeries; i++) + get { - data.Add(new LineData(new Collection>())); + return series; } - - // When - chart.AddData(data); - - // Assert - Assert.AreEqual(numberOfSeries, chart.Model.Series.Count); } } } \ No newline at end of file Index: Core/Components/test/Core.Components.OxyPlot.Forms.Test/Core.Components.OxyPlot.Forms.Test.csproj =================================================================== diff -u -r570101d9648e296b96c7e624c4d4f6bfad8d41b6 -rec36de61b0eb813fedd9616e5113bd695470935c --- Core/Components/test/Core.Components.OxyPlot.Forms.Test/Core.Components.OxyPlot.Forms.Test.csproj (.../Core.Components.OxyPlot.Forms.Test.csproj) (revision 570101d9648e296b96c7e624c4d4f6bfad8d41b6) +++ Core/Components/test/Core.Components.OxyPlot.Forms.Test/Core.Components.OxyPlot.Forms.Test.csproj (.../Core.Components.OxyPlot.Forms.Test.csproj) (revision ec36de61b0eb813fedd9616e5113bd695470935c) @@ -65,6 +65,10 @@ + + {45EF3071-5C30-40AA-8B99-CE174DCEEE48} + Core.Plugins.OxyPlot.Test + {dadaa0a5-288c-49cb-9f08-337f16832c86} Core.Components.OxyPlot.Forms Index: Core/Components/test/Core.Components.OxyPlot.Test/Core.Components.OxyPlot.Test.csproj =================================================================== diff -u -r570101d9648e296b96c7e624c4d4f6bfad8d41b6 -rec36de61b0eb813fedd9616e5113bd695470935c --- Core/Components/test/Core.Components.OxyPlot.Test/Core.Components.OxyPlot.Test.csproj (.../Core.Components.OxyPlot.Test.csproj) (revision 570101d9648e296b96c7e624c4d4f6bfad8d41b6) +++ Core/Components/test/Core.Components.OxyPlot.Test/Core.Components.OxyPlot.Test.csproj (.../Core.Components.OxyPlot.Test.csproj) (revision ec36de61b0eb813fedd9616e5113bd695470935c) @@ -50,7 +50,6 @@ - Index: Core/Components/test/Core.Components.OxyPlot.Test/Data/AreaDataTest.cs =================================================================== diff -u -r570101d9648e296b96c7e624c4d4f6bfad8d41b6 -rec36de61b0eb813fedd9616e5113bd695470935c --- Core/Components/test/Core.Components.OxyPlot.Test/Data/AreaDataTest.cs (.../AreaDataTest.cs) (revision 570101d9648e296b96c7e624c4d4f6bfad8d41b6) +++ Core/Components/test/Core.Components.OxyPlot.Test/Data/AreaDataTest.cs (.../AreaDataTest.cs) (revision ec36de61b0eb813fedd9616e5113bd695470935c) @@ -47,41 +47,6 @@ Assert.IsInstanceOf(data); } - [Test] - public void AddTo_NoModel_ThrowsArgumentNullException() - { - // Setup - var points = CreateTestPoints(); - var testData = new AreaData(points); - - // Call - TestDelegate test = () => testData.AddTo(null); - - // Assert - Assert.Throws(test); - } - - [Test] - public void AddTo_Model_DataAddedToModelAsSeries() - { - // Setup - var points = CreateTestPoints(); - var testData = new AreaData(points); - var model = new PlotModel(); - - // Call - testData.AddTo(model); - - // Assert - Assert.AreEqual(1, model.Series.Count); - Assert.IsInstanceOf(model.Series.First()); - - var series = (AreaSeries)model.Series.First(); - var equivalentPoints = points.Select(p => new DataPoint(p.Item1, p.Item2)).ToArray(); - CollectionAssert.AreEquivalent(equivalentPoints, series.Points); - CollectionAssert.AreEquivalent(Arrays.CopyOf(equivalentPoints,1), series.Points2); - } - private Collection> CreateTestPoints() { return new Collection> Fisheye: Tag ec36de61b0eb813fedd9616e5113bd695470935c refers to a dead (removed) revision in file `Core/Components/test/Core.Components.OxyPlot.Test/Data/CollectionDataTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Components/test/Core.Components.OxyPlot.Test/Data/LineDataTest.cs =================================================================== diff -u -r570101d9648e296b96c7e624c4d4f6bfad8d41b6 -rec36de61b0eb813fedd9616e5113bd695470935c --- Core/Components/test/Core.Components.OxyPlot.Test/Data/LineDataTest.cs (.../LineDataTest.cs) (revision 570101d9648e296b96c7e624c4d4f6bfad8d41b6) +++ Core/Components/test/Core.Components.OxyPlot.Test/Data/LineDataTest.cs (.../LineDataTest.cs) (revision ec36de61b0eb813fedd9616e5113bd695470935c) @@ -47,39 +47,6 @@ Assert.IsInstanceOf(data); } - [Test] - public void AddTo_NoModel_ThrowsArgumentNullException() - { - // Setup - var points = CreateTestPoints(); - var testData = new LineData(points); - - // Call - TestDelegate test = () => testData.AddTo(null); - - // Assert - Assert.Throws(test); - } - - [Test] - public void AddTo_Model_DataAddedToModelAsSeries() - { - // Setup - var points = CreateTestPoints(); - var testData = new LineData(points); - var model = new PlotModel(); - - // Call - testData.AddTo(model); - - // Assert - Assert.AreEqual(1, model.Series.Count); - Assert.IsInstanceOf(model.Series.First()); - - var series = (LineSeries)model.Series.First(); - Assert.AreSame(points, series.ItemsSource); - } - private Collection> CreateTestPoints() { return new Collection> Index: Core/Components/test/Core.Components.OxyPlot.Test/Data/PointDataTest.cs =================================================================== diff -u -r570101d9648e296b96c7e624c4d4f6bfad8d41b6 -rec36de61b0eb813fedd9616e5113bd695470935c --- Core/Components/test/Core.Components.OxyPlot.Test/Data/PointDataTest.cs (.../PointDataTest.cs) (revision 570101d9648e296b96c7e624c4d4f6bfad8d41b6) +++ Core/Components/test/Core.Components.OxyPlot.Test/Data/PointDataTest.cs (.../PointDataTest.cs) (revision ec36de61b0eb813fedd9616e5113bd695470935c) @@ -47,39 +47,6 @@ Assert.IsInstanceOf(data); } - [Test] - public void AddTo_NoModel_ThrowsArgumentNullException() - { - // Setup - var points = CreateTestPoints(); - var testData = new PointData(points); - - // Call - TestDelegate test = () => testData.AddTo(null); - - // Assert - Assert.Throws(test); - } - - [Test] - public void AddTo_Model_DataAddedToModelAsSeries() - { - // Setup - var points = CreateTestPoints(); - var testData = new PointData(points); - var model = new PlotModel(); - - // Call - testData.AddTo(model); - - // Assert - Assert.AreEqual(1, model.Series.Count); - Assert.IsInstanceOf(model.Series.First()); - - var series = (LineSeries)model.Series.First(); - Assert.AreSame(points, series.ItemsSource); - } - private Collection> CreateTestPoints() { return new Collection> Index: Core/Plugins/src/Core.Plugins.OxyPlot/Commands/OpenChartViewCommand.cs =================================================================== diff -u -ra70fac40e34e16bed007b1d0d4e437d91c89d0cb -rec36de61b0eb813fedd9616e5113bd695470935c --- Core/Plugins/src/Core.Plugins.OxyPlot/Commands/OpenChartViewCommand.cs (.../OpenChartViewCommand.cs) (revision a70fac40e34e16bed007b1d0d4e437d91c89d0cb) +++ Core/Plugins/src/Core.Plugins.OxyPlot/Commands/OpenChartViewCommand.cs (.../OpenChartViewCommand.cs) (revision ec36de61b0eb813fedd9616e5113bd695470935c) @@ -3,7 +3,6 @@ using Core.Common.Gui; using Core.Components.OxyPlot.Data; using Core.Plugins.OxyPlot.Forms; -using OxyPlot; namespace Core.Plugins.OxyPlot.Commands { @@ -54,19 +53,13 @@ new Tuple(1.0, 1.0), new Tuple(0.5, 0.5) }); - clearArea.Fill = OxyColor.FromArgb(255,255,255,255); var points = new PointData(new Collection> { new Tuple(0.0, 1.1), new Tuple(0.5, 1.6), new Tuple(1.0, 2.1) }); - var data = new CollectionData(); - data.Add(area); - data.Add(clearArea); - data.Add(line); - data.Add(points); - Gui.DocumentViewsResolver.OpenViewForData(data); + Gui.DocumentViewsResolver.OpenViewForData(new Collection() { area, clearArea, line, points }); } } } \ No newline at end of file Index: Core/Plugins/src/Core.Plugins.OxyPlot/Forms/ChartDataView.cs =================================================================== diff -u -r570101d9648e296b96c7e624c4d4f6bfad8d41b6 -rec36de61b0eb813fedd9616e5113bd695470935c --- Core/Plugins/src/Core.Plugins.OxyPlot/Forms/ChartDataView.cs (.../ChartDataView.cs) (revision 570101d9648e296b96c7e624c4d4f6bfad8d41b6) +++ Core/Plugins/src/Core.Plugins.OxyPlot/Forms/ChartDataView.cs (.../ChartDataView.cs) (revision ec36de61b0eb813fedd9616e5113bd695470935c) @@ -1,6 +1,9 @@ -using System.Windows.Forms; +using System.Collections.Generic; +using System.Windows.Controls; +using System.Windows.Forms; using Core.Components.OxyPlot.Data; using Core.Components.OxyPlot.Forms; +using UserControl = System.Windows.Forms.UserControl; namespace Core.Plugins.OxyPlot.Forms { @@ -10,7 +13,7 @@ public class ChartDataView : UserControl, IChartView { private readonly BaseChart baseChart; - private IChartData data; + private ICollection data; /// /// Creates an instance of with just a on it. @@ -33,10 +36,13 @@ set { baseChart.ClearData(); - data = (IChartData) value; + data = (ICollection) value; if (data != null) { - baseChart.AddData(data); + foreach (var series in data) + { + baseChart.AddData(series); + } } } } Index: Core/Plugins/src/Core.Plugins.OxyPlot/Legend/ChartNodePresenter.cs =================================================================== diff -u -r10a16f2a08c6a50176351ae46c9a23a37ab92e28 -rec36de61b0eb813fedd9616e5113bd695470935c --- Core/Plugins/src/Core.Plugins.OxyPlot/Legend/ChartNodePresenter.cs (.../ChartNodePresenter.cs) (revision 10a16f2a08c6a50176351ae46c9a23a37ab92e28) +++ Core/Plugins/src/Core.Plugins.OxyPlot/Legend/ChartNodePresenter.cs (.../ChartNodePresenter.cs) (revision ec36de61b0eb813fedd9616e5113bd695470935c) @@ -18,7 +18,7 @@ public override IEnumerable GetChildNodeObjects(BaseChart parentNodeData) { - return parentNodeData.Model.Series; + return parentNodeData.Series; } } } \ No newline at end of file Index: Core/Plugins/src/Core.Plugins.OxyPlot/OxyPlotGuiPlugin.cs =================================================================== diff -u -ra70fac40e34e16bed007b1d0d4e437d91c89d0cb -rec36de61b0eb813fedd9616e5113bd695470935c --- Core/Plugins/src/Core.Plugins.OxyPlot/OxyPlotGuiPlugin.cs (.../OxyPlotGuiPlugin.cs) (revision a70fac40e34e16bed007b1d0d4e437d91c89d0cb) +++ Core/Plugins/src/Core.Plugins.OxyPlot/OxyPlotGuiPlugin.cs (.../OxyPlotGuiPlugin.cs) (revision ec36de61b0eb813fedd9616e5113bd695470935c) @@ -39,7 +39,7 @@ public override IEnumerable GetViewInfoObjects() { - yield return new ViewInfo + yield return new ViewInfo, ChartDataView> { Image = Resources.ChartIcon, GetViewName = (v, o) => "Diagram" Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Forms/ChartDataViewTest.cs =================================================================== diff -u -r10a16f2a08c6a50176351ae46c9a23a37ab92e28 -rec36de61b0eb813fedd9616e5113bd695470935c --- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Forms/ChartDataViewTest.cs (.../ChartDataViewTest.cs) (revision 10a16f2a08c6a50176351ae46c9a23a37ab92e28) +++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Forms/ChartDataViewTest.cs (.../ChartDataViewTest.cs) (revision ec36de61b0eb813fedd9616e5113bd695470935c) @@ -38,29 +38,10 @@ chartView.Data = null; // Assert - Assert.IsEmpty(chart.Model.Series); + Assert.IsEmpty(chart.Series); } [Test] - public void Data_SetToIChartData_ChartDataAdded() - { - // Setup - var mocks = new MockRepository(); - var chartView = new ChartDataView(); - var chart = (BaseChart)chartView.Controls[0]; - var chartData = mocks.StrictMock(); - chartData.Expect(d => d.AddTo(chart.Model)); - mocks.ReplayAll(); - - // Call - chartView.Data = chartData; - - // Assert - Assert.AreSame(chartData, chartView.Data); - mocks.VerifyAll(); - } - - [Test] public void Data_SetToObject_InvalidCastException() { // Setup Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartDataNodePresenterTest.cs =================================================================== diff -u -ra70fac40e34e16bed007b1d0d4e437d91c89d0cb -rec36de61b0eb813fedd9616e5113bd695470935c --- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartDataNodePresenterTest.cs (.../ChartDataNodePresenterTest.cs) (revision a70fac40e34e16bed007b1d0d4e437d91c89d0cb) +++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartDataNodePresenterTest.cs (.../ChartDataNodePresenterTest.cs) (revision ec36de61b0eb813fedd9616e5113bd695470935c) @@ -91,9 +91,6 @@ } public class TestChartData : IChartData { - public void AddTo(PlotModel model) - { - throw new NotImplementedException(); - } + public bool IsVisible { get; set; } } } \ No newline at end of file Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartNodePresenterTest.cs =================================================================== diff -u -ra70fac40e34e16bed007b1d0d4e437d91c89d0cb -rec36de61b0eb813fedd9616e5113bd695470935c --- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartNodePresenterTest.cs (.../ChartNodePresenterTest.cs) (revision a70fac40e34e16bed007b1d0d4e437d91c89d0cb) +++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartNodePresenterTest.cs (.../ChartNodePresenterTest.cs) (revision ec36de61b0eb813fedd9616e5113bd695470935c) @@ -50,7 +50,7 @@ var result = nodePresenter.GetChildNodeObjects(chart); // Assert - CollectionAssert.AreEquivalent(chart.Model.Series, result); + CollectionAssert.AreEquivalent(chart.Series, result); } } } \ No newline at end of file Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/OxyPlotGuiPluginTest.cs =================================================================== diff -u -ra70fac40e34e16bed007b1d0d4e437d91c89d0cb -rec36de61b0eb813fedd9616e5113bd695470935c --- Core/Plugins/test/Core.Plugins.OxyPlot.Test/OxyPlotGuiPluginTest.cs (.../OxyPlotGuiPluginTest.cs) (revision a70fac40e34e16bed007b1d0d4e437d91c89d0cb) +++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/OxyPlotGuiPluginTest.cs (.../OxyPlotGuiPluginTest.cs) (revision ec36de61b0eb813fedd9616e5113bd695470935c) @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Linq; using System.Windows; using System.Windows.Forms; @@ -92,7 +93,7 @@ // Assert Assert.AreEqual(1, views.Length); - Assert.AreEqual(typeof(IChartData), views[0].DataType); + Assert.AreEqual(typeof(ICollection), views[0].DataType); Assert.AreEqual(typeof(ChartDataView), views[0].ViewType); Assert.AreEqual("Diagram", views[0].GetViewName(view, null)); } Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Properties/AssemblyInfo.cs =================================================================== diff -u -r3d4b98ca16e7a608e4db4ba639c028ce81bd440f -rec36de61b0eb813fedd9616e5113bd695470935c --- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Properties/AssemblyInfo.cs (.../AssemblyInfo.cs) (revision 3d4b98ca16e7a608e4db4ba639c028ce81bd440f) +++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Properties/AssemblyInfo.cs (.../AssemblyInfo.cs) (revision ec36de61b0eb813fedd9616e5113bd695470935c) @@ -1,18 +1,8 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. [assembly: AssemblyTitle("Core.Plugins.OxyPlot.Test")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Core.Plugins.OxyPlot.Test")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2016")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from @@ -21,16 +11,3 @@ // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("5b5d3afc-316c-44e9-90ba-4b55cfa074f8")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")]