Index: Core/Common/src/Core.Common.Controls.TreeView/TreeViewController.cs
===================================================================
diff -u -r1a5f2017961803c9e6aa963a573219d118cab7aa -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Common/src/Core.Common.Controls.TreeView/TreeViewController.cs (.../TreeViewController.cs) (revision 1a5f2017961803c9e6aa963a573219d118cab7aa)
+++ Core/Common/src/Core.Common.Controls.TreeView/TreeViewController.cs (.../TreeViewController.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -408,7 +408,7 @@
{
var message = String.Format(Resources.TreeViewController_UpdateNode_Can_t_find_INodePresenter_for_0_make_sure_you_added_it_to_Presenters_collection_of_a_TreeView, nodeData);
- throw new ArgumentNullException(message);
+ throw new ArgumentException(message);
}
node.Tag = nodeData;
Index: Core/Components/src/Core.Components.Charting/Core.Components.Charting.csproj
===================================================================
diff -u -r460ed7ba26498668b47780bf1abd8293db3baeff -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Components/src/Core.Components.Charting/Core.Components.Charting.csproj (.../Core.Components.Charting.csproj) (revision 460ed7ba26498668b47780bf1abd8293db3baeff)
+++ Core/Components/src/Core.Components.Charting/Core.Components.Charting.csproj (.../Core.Components.Charting.csproj) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -40,6 +40,7 @@
+
Index: Core/Components/src/Core.Components.Charting/Data/AreaData.cs
===================================================================
diff -u -race2d2aedcb70dbf614869b58145aec35d233c08 -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Components/src/Core.Components.Charting/Data/AreaData.cs (.../AreaData.cs) (revision ace2d2aedcb70dbf614869b58145aec35d233c08)
+++ Core/Components/src/Core.Components.Charting/Data/AreaData.cs (.../AreaData.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
+using System.Linq;
namespace Core.Components.Charting.Data
{
@@ -14,8 +15,24 @@
///
/// A of as (X,Y) points.
/// Thrown when is null.
- public AreaData(IEnumerable> points) : base(points)
+ public AreaData(IEnumerable> points)
{
+ if (points == null)
+ {
+ throw new ArgumentNullException("points", "A point collection is required when creating AreaData.");
+ }
+ Points = points.ToArray();
+ IsVisible = true;
}
+
+ ///
+ /// Gets or sets a value indicating whether the is visible.
+ ///
+ public bool IsVisible { get; set; }
+
+ ///
+ /// Gets the collection of points in 2D space.
+ ///
+ public IEnumerable> Points { get; private set; }
}
}
\ No newline at end of file
Index: Core/Components/src/Core.Components.Charting/Data/ChartData.cs
===================================================================
diff -u -reb44708823d5479991162f63376ae85dd944e513 -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Components/src/Core.Components.Charting/Data/ChartData.cs (.../ChartData.cs) (revision eb44708823d5479991162f63376ae85dd944e513)
+++ Core/Components/src/Core.Components.Charting/Data/ChartData.cs (.../ChartData.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -1,7 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Core.Common.Base;
+using Core.Common.Base;
namespace Core.Components.Charting.Data
{
@@ -13,26 +10,8 @@
///
/// Creates a new instance of .
///
- /// An of as (x,y) points.
- /// Thrown when is null.
- protected ChartData(IEnumerable> points)
+ protected ChartData()
{
- if (points == null)
- {
- throw new ArgumentNullException("points", "A point collection is required when creating AreaData.");
- }
- Points = points.ToArray();
- IsVisible = true;
}
-
- ///
- /// Gets or sets a value indicating whether the is visible.
- ///
- public bool IsVisible { get; set; }
-
- ///
- /// Gets the collection of points in 2D space.
- ///
- public IEnumerable> Points { get; private set; }
}
}
\ No newline at end of file
Index: Core/Components/src/Core.Components.Charting/Data/ChartDataCollection.cs
===================================================================
diff -u
--- Core/Components/src/Core.Components.Charting/Data/ChartDataCollection.cs (revision 0)
+++ Core/Components/src/Core.Components.Charting/Data/ChartDataCollection.cs (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using Core.Components.Charting.Data;
+
+namespace Core.Components.OxyPlot.Collection
+{
+ public class ChartDataCollection : ChartData
+ {
+ public ChartDataCollection(IList list)
+ {
+ if (list == null)
+ {
+ throw new ArgumentNullException("list", "A list collection is required when creating ChartDataCollection.");
+ }
+ List = list;
+ }
+
+ public IList List { get; private set; }
+ }
+}
\ No newline at end of file
Index: Core/Components/src/Core.Components.Charting/Data/LineData.cs
===================================================================
diff -u -race2d2aedcb70dbf614869b58145aec35d233c08 -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Components/src/Core.Components.Charting/Data/LineData.cs (.../LineData.cs) (revision ace2d2aedcb70dbf614869b58145aec35d233c08)
+++ Core/Components/src/Core.Components.Charting/Data/LineData.cs (.../LineData.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
+using System.Linq;
namespace Core.Components.Charting.Data
{
@@ -14,8 +15,25 @@
///
/// A of as (X,Y) points.
/// Thrown when is null.
- public LineData(IEnumerable> points) : base(points)
+ public LineData(IEnumerable> points)
{
+ if (points == null)
+ {
+ throw new ArgumentNullException("points", "A point collection is required when creating AreaData.");
+ }
+ Points = points.ToArray();
+ IsVisible = true;
+
}
+
+ ///
+ /// Gets or sets a value indicating whether the is visible.
+ ///
+ public bool IsVisible { get; set; }
+
+ ///
+ /// Gets the collection of points in 2D space.
+ ///
+ public IEnumerable> Points { get; private set; }
}
}
\ No newline at end of file
Index: Core/Components/src/Core.Components.Charting/Data/PointData.cs
===================================================================
diff -u -race2d2aedcb70dbf614869b58145aec35d233c08 -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Components/src/Core.Components.Charting/Data/PointData.cs (.../PointData.cs) (revision ace2d2aedcb70dbf614869b58145aec35d233c08)
+++ Core/Components/src/Core.Components.Charting/Data/PointData.cs (.../PointData.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
+using System.Linq;
namespace Core.Components.Charting.Data
{
@@ -14,8 +15,24 @@
///
/// A of as (X,Y) points.
/// Thrown when is null.
- public PointData(IEnumerable> points) : base(points)
+ public PointData(IEnumerable> points)
{
+ if (points == null)
+ {
+ throw new ArgumentNullException("points", "A point collection is required when creating AreaData.");
+ }
+ Points = points.ToArray();
+ IsVisible = true;
}
+
+ ///
+ /// Gets or sets a value indicating whether the is visible.
+ ///
+ public bool IsVisible { get; set; }
+
+ ///
+ /// Gets the collection of points in 2D space.
+ ///
+ public IEnumerable> Points { get; private set; }
}
}
\ No newline at end of file
Index: Core/Components/src/Core.Components.Charting/IChart.cs
===================================================================
diff -u -r460ed7ba26498668b47780bf1abd8293db3baeff -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Components/src/Core.Components.Charting/IChart.cs (.../IChart.cs) (revision 460ed7ba26498668b47780bf1abd8293db3baeff)
+++ Core/Components/src/Core.Components.Charting/IChart.cs (.../IChart.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -1,5 +1,3 @@
-using System;
-using System.Collections.Generic;
using Core.Common.Base;
using Core.Components.Charting.Data;
@@ -17,21 +15,12 @@
bool IsRectangleZoomingEnabled { get; }
///
- /// Gets the data to show in the .
+ /// Gets or sets the data to show in the .
///
/// The returned collection is a copy of the previously set data.
- ICollection Data { get; }
+ ChartData Data { get; set; }
///
- /// Sets the position of the amongst the other data of the .
- ///
- /// The to change the position for.
- /// The new position.
- /// Thrown when is null.
- /// Thrown when is out of range.
- void SetPosition(ChartData data, int position);
-
- ///
/// Toggles panning of the . Panning is invoked by clicking the left mouse-button.
///
void TogglePanning();
Index: Core/Components/src/Core.Components.OxyPlot.Forms/BaseChart.cs
===================================================================
diff -u -re5707ddea2c022c6330e93a37e3de89fe5539038 -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Components/src/Core.Components.OxyPlot.Forms/BaseChart.cs (.../BaseChart.cs) (revision e5707ddea2c022c6330e93a37e3de89fe5539038)
+++ Core/Components/src/Core.Components.OxyPlot.Forms/BaseChart.cs (.../BaseChart.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -1,15 +1,13 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using Core.Common.Base;
using Core.Components.Charting;
-using Core.Components.Charting.Collection;
using Core.Components.Charting.Data;
-using Core.Components.OxyPlot.Collection;
+using Core.Components.OxyPlot.Converter;
using OxyPlot.WindowsForms;
namespace Core.Components.OxyPlot.Forms
@@ -20,33 +18,22 @@
public sealed class BaseChart : Control, IObserver, IChart
{
private readonly ICollection observers = new Collection();
- private readonly ChartDataCollection series;
+ private ChartData data;
+
private LinearPlotView view;
private DynamicPlotController controller;
+ private SeriesFactory seriesFactory = new SeriesFactory();
///
/// Creates a new instance of .
///
public BaseChart()
{
InitializePlotView();
- series = new ChartDataCollection(view.Model.Series);
- series.OnChartDataRemoved += OnChartDataRemoved;
- series.OnChartDataAdded += OnChartDataAdded;
MinimumSize = new Size(50, 75);
}
- private void OnChartDataAdded(object sender, ChartDataCollectionEventArgs chartDataCollectionEventArgs)
- {
- chartDataCollectionEventArgs.Data.Attach(this);
- }
-
- private void OnChartDataRemoved(object sender, ChartDataCollectionEventArgs chartDataCollectionEventArgs)
- {
- chartDataCollectionEventArgs.Data.Detach(this);
- }
-
public bool IsPanningEnabled
{
get
@@ -64,27 +51,35 @@
}
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public ICollection Data
+ public ChartData Data
{
get
{
- return series;
+ return data;
}
+ set
+ {
+ DetachFromData();
+ data = value;
+ AttachToData();
+ DrawSeries();
+ }
}
- public void SetPosition(ChartData data, int position)
+ private void AttachToData()
{
- if (data == null)
+ if (data != null)
{
- throw new ArgumentNullException("data", "Cannot set index of a null serie.");
+ data.Attach(this);
}
- if (position < 0 || position >= Data.Count)
+ }
+
+ private void DetachFromData()
+ {
+ if (data != null)
{
- throw new ArgumentException(string.Format("Cannot set index outside of range [0,{0})", Data.Count), "position");
+ data.Detach(this);
}
- series.Remove(data);
- series.Insert(position, data);
- view.InvalidatePlot(true);
}
public void TogglePanning()
@@ -145,8 +140,17 @@
public void UpdateObserver()
{
- series.Update();
- Refresh();
+ DrawSeries();
+ view.InvalidatePlot(true);
}
+
+ private void DrawSeries()
+ {
+ view.Model.Series.Clear();
+ foreach (var series in seriesFactory.Create(data))
+ {
+ view.Model.Series.Add(series);
+ }
+ }
}
}
\ No newline at end of file
Index: Core/Components/src/Core.Components.OxyPlot.Forms/Core.Components.OxyPlot.Forms.csproj
===================================================================
diff -u -r9b19f753c055f426fcea7b6c01cdf43c8d9f2468 -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Components/src/Core.Components.OxyPlot.Forms/Core.Components.OxyPlot.Forms.csproj (.../Core.Components.OxyPlot.Forms.csproj) (revision 9b19f753c055f426fcea7b6c01cdf43c8d9f2468)
+++ Core/Components/src/Core.Components.OxyPlot.Forms/Core.Components.OxyPlot.Forms.csproj (.../Core.Components.OxyPlot.Forms.csproj) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -56,6 +56,7 @@
Component
+
Component
Index: Core/Components/src/Core.Components.OxyPlot.Forms/LinearPlotView.cs
===================================================================
diff -u -r9b19f753c055f426fcea7b6c01cdf43c8d9f2468 -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Components/src/Core.Components.OxyPlot.Forms/LinearPlotView.cs (.../LinearPlotView.cs) (revision 9b19f753c055f426fcea7b6c01cdf43c8d9f2468)
+++ Core/Components/src/Core.Components.OxyPlot.Forms/LinearPlotView.cs (.../LinearPlotView.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -51,7 +51,8 @@
///
public void ZoomToAll()
{
- Model.InvalidatePlot(true);
+ ActualModel.ResetAllAxes();
+ InvalidatePlot(false);
}
}
}
\ No newline at end of file
Fisheye: Tag fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8 refers to a dead (removed) revision in file `Core/Components/src/Core.Components.OxyPlot/BaseChart.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8 refers to a dead (removed) revision in file `Core/Components/src/Core.Components.OxyPlot/Collection/ChartDataCollection.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8 refers to a dead (removed) revision in file `Core/Components/src/Core.Components.OxyPlot/Collection/ChartDataCollectionEventArgs.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Core/Components/src/Core.Components.OxyPlot/Converter/AreaDataConverter.cs
===================================================================
diff -u -rd0f1bca0f6a4833a790ae7eba9fde30674a52ddb -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Components/src/Core.Components.OxyPlot/Converter/AreaDataConverter.cs (.../AreaDataConverter.cs) (revision d0f1bca0f6a4833a790ae7eba9fde30674a52ddb)
+++ Core/Components/src/Core.Components.OxyPlot/Converter/AreaDataConverter.cs (.../AreaDataConverter.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using Core.Components.Charting.Data;
using OxyPlot.Series;
@@ -17,18 +18,23 @@
}
}
- internal override Series Convert(ChartData data)
+ internal override IList Convert(ChartData data)
{
- var series = new AreaSeries();
- foreach (var p in data.Points)
+ var areaData = (AreaData) data;
+ var series = new AreaSeries
{
+ IsVisible = areaData.IsVisible,
+ Tag = data
+ };
+ foreach (var p in areaData.Points)
+ {
series.Points.Add(TupleToDataPoint(p));
}
if (series.Points.Count > 0)
{
series.Points2.Add(series.Points[0]);
}
- return series;
+ return new List { series };
}
}
}
\ No newline at end of file
Index: Core/Components/src/Core.Components.OxyPlot/Converter/ChartDataCollectionConverter.cs
===================================================================
diff -u
--- Core/Components/src/Core.Components.OxyPlot/Converter/ChartDataCollectionConverter.cs (revision 0)
+++ Core/Components/src/Core.Components.OxyPlot/Converter/ChartDataCollectionConverter.cs (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using Core.Components.Charting.Data;
+using Core.Components.OxyPlot.Collection;
+using OxyPlot.Series;
+
+namespace Core.Components.OxyPlot.Converter
+{
+ public class ChartDataCollectionConverter : ChartDataConverter
+ {
+ protected override Type SupportedType
+ {
+ get
+ {
+ return typeof(ChartDataCollection);
+ }
+ }
+
+ internal override IList Convert(ChartData data)
+ {
+ var factory = new SeriesFactory();
+ var seriesCollection = new List();
+ foreach(var series in ((ChartDataCollection)data).List)
+ {
+ seriesCollection.AddRange(factory.Create(series));
+ }
+ return seriesCollection;
+ }
+ }
+}
\ No newline at end of file
Index: Core/Components/src/Core.Components.OxyPlot/Converter/ChartDataConverter.cs
===================================================================
diff -u -rd0f1bca0f6a4833a790ae7eba9fde30674a52ddb -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Components/src/Core.Components.OxyPlot/Converter/ChartDataConverter.cs (.../ChartDataConverter.cs) (revision d0f1bca0f6a4833a790ae7eba9fde30674a52ddb)
+++ Core/Components/src/Core.Components.OxyPlot/Converter/ChartDataConverter.cs (.../ChartDataConverter.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using Core.Components.Charting.Data;
using OxyPlot;
using OxyPlot.Series;
@@ -43,10 +44,10 @@
}
///
- /// Creates a based on the that was given.
+ /// Creates one or more based on the that was given.
///
/// The data to transform into a .
- /// A new instance.
- internal abstract Series Convert(ChartData data);
+ /// A new of .
+ internal abstract IList Convert(ChartData data);
}
}
\ No newline at end of file
Index: Core/Components/src/Core.Components.OxyPlot/Converter/LineDataConverter.cs
===================================================================
diff -u -rd0f1bca0f6a4833a790ae7eba9fde30674a52ddb -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Components/src/Core.Components.OxyPlot/Converter/LineDataConverter.cs (.../LineDataConverter.cs) (revision d0f1bca0f6a4833a790ae7eba9fde30674a52ddb)
+++ Core/Components/src/Core.Components.OxyPlot/Converter/LineDataConverter.cs (.../LineDataConverter.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Linq;
using Core.Components.Charting.Data;
using OxyPlot.Series;
@@ -18,14 +19,17 @@
}
}
- internal override Series Convert(ChartData data)
+ internal override IList Convert(ChartData data)
{
+ var lineData = (LineData) data;
var series = new LineSeries
{
- ItemsSource = data.Points.ToArray(),
- Mapping = TupleToDataPoint
+ ItemsSource = lineData.Points.ToArray(),
+ Mapping = TupleToDataPoint,
+ IsVisible = lineData.IsVisible,
+ Tag = data
};
- return series;
+ return new List{ series };
}
}
}
\ No newline at end of file
Index: Core/Components/src/Core.Components.OxyPlot/Converter/PointDataConverter.cs
===================================================================
diff -u -rd0f1bca0f6a4833a790ae7eba9fde30674a52ddb -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Components/src/Core.Components.OxyPlot/Converter/PointDataConverter.cs (.../PointDataConverter.cs) (revision d0f1bca0f6a4833a790ae7eba9fde30674a52ddb)
+++ Core/Components/src/Core.Components.OxyPlot/Converter/PointDataConverter.cs (.../PointDataConverter.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Linq;
using Core.Components.Charting.Data;
using OxyPlot;
@@ -16,16 +17,19 @@
}
}
- internal override Series Convert(ChartData data)
+ internal override IList Convert(ChartData data)
{
+ var pointData = (PointData) data;
var series = new LineSeries
{
- ItemsSource = data.Points.ToArray(),
+ ItemsSource = pointData.Points.ToArray(),
+ IsVisible = pointData.IsVisible,
Mapping = TupleToDataPoint,
LineStyle = LineStyle.None,
- MarkerType = MarkerType.Circle
+ MarkerType = MarkerType.Circle,
+ Tag = data,
};
- return series;
+ return new List { series };
}
}
}
\ No newline at end of file
Index: Core/Components/src/Core.Components.OxyPlot/Converter/SeriesFactory.cs
===================================================================
diff -u -rd0f1bca0f6a4833a790ae7eba9fde30674a52ddb -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Components/src/Core.Components.OxyPlot/Converter/SeriesFactory.cs (.../SeriesFactory.cs) (revision d0f1bca0f6a4833a790ae7eba9fde30674a52ddb)
+++ Core/Components/src/Core.Components.OxyPlot/Converter/SeriesFactory.cs (.../SeriesFactory.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -18,15 +18,16 @@
{
new AreaDataConverter(),
new LineDataConverter(),
- new PointDataConverter()
+ new PointDataConverter(),
+ new ChartDataCollectionConverter()
};
///
/// Creates a new from the given .
///
/// The to base the creation of a upon.
/// A new .
- public Series Create(ChartData data)
+ public IList Create(ChartData data)
{
foreach (var converter in converters)
{
Index: Core/Components/src/Core.Components.OxyPlot/Core.Components.OxyPlot.csproj
===================================================================
diff -u -r9b19f753c055f426fcea7b6c01cdf43c8d9f2468 -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Components/src/Core.Components.OxyPlot/Core.Components.OxyPlot.csproj (.../Core.Components.OxyPlot.csproj) (revision 9b19f753c055f426fcea7b6c01cdf43c8d9f2468)
+++ Core/Components/src/Core.Components.OxyPlot/Core.Components.OxyPlot.csproj (.../Core.Components.OxyPlot.csproj) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -48,9 +48,8 @@
Properties\GlobalAssembly.cs
-
-
+
Index: Core/Components/test/Core.Components.Charting.Test/Data/ChartDataTest.cs
===================================================================
diff -u -race2d2aedcb70dbf614869b58145aec35d233c08 -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Components/test/Core.Components.Charting.Test/Data/ChartDataTest.cs (.../ChartDataTest.cs) (revision ace2d2aedcb70dbf614869b58145aec35d233c08)
+++ Core/Components/test/Core.Components.Charting.Test/Data/ChartDataTest.cs (.../ChartDataTest.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -1,5 +1,4 @@
-using System;
-using System.Collections.Generic;
+using Core.Common.Base;
using Core.Components.Charting.Data;
using NUnit.Framework;
@@ -9,35 +8,15 @@
public class ChartDataTest
{
[Test]
- public void Constructor_PointsNull_ThrowsArgumentException()
+ public void DefaultConstructor_Observable()
{
// Call
- TestDelegate test = () => new TestChartData(null);
+ var chartData = new TestChartData();
// Assert
- Assert.Throws(test);
+ Assert.IsInstanceOf(chartData);
}
-
- [Test]
- public void Constructor_WithPoints_PointsCopySet()
- {
- // Setup
- var points = new List>
- {
- new Tuple(3.2, 1.1)
- };
-
- // Call
- var data = new TestChartData(points);
-
- // Assert
- Assert.IsTrue(data.IsVisible);
- CollectionAssert.AreEqual(points, data.Points);
- Assert.AreNotSame(points, data.Points);
- }
}
- public class TestChartData : ChartData {
- public TestChartData(IEnumerable> points) : base(points) {}
- }
+ public class TestChartData : ChartData {}
}
\ No newline at end of file
Index: Core/Components/test/Core.Components.Charting.TestUtil/TestChartData.cs
===================================================================
diff -u -rdaaa148db691a71c042fcdd3ca039cf13c59217c -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Components/test/Core.Components.Charting.TestUtil/TestChartData.cs (.../TestChartData.cs) (revision daaa148db691a71c042fcdd3ca039cf13c59217c)
+++ Core/Components/test/Core.Components.Charting.TestUtil/TestChartData.cs (.../TestChartData.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -1,13 +1,9 @@
-using System;
-using System.Collections.ObjectModel;
using Core.Components.Charting.Data;
namespace Core.Components.Charting.TestUtil
{
///
/// A class representing a ChartData type which is not in the regular codebase.
///
- public class TestChartData : ChartData {
- public TestChartData() : base(new Collection>()) {}
- }
+ public class TestChartData : ChartData {}
}
\ No newline at end of file
Index: Core/Components/test/Core.Components.OxyPlot.Forms.Test/BaseChartTest.cs
===================================================================
diff -u -r460ed7ba26498668b47780bf1abd8293db3baeff -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Components/test/Core.Components.OxyPlot.Forms.Test/BaseChartTest.cs (.../BaseChartTest.cs) (revision 460ed7ba26498668b47780bf1abd8293db3baeff)
+++ Core/Components/test/Core.Components.OxyPlot.Forms.Test/BaseChartTest.cs (.../BaseChartTest.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -6,6 +6,7 @@
using Core.Common.Base;
using Core.Components.Charting.Data;
using Core.Components.Charting.TestUtil;
+using Core.Components.OxyPlot.Collection;
using NUnit.Framework;
using Rhino.Mocks;
@@ -110,66 +111,6 @@
}*/
[Test]
- public void SetPosition_DataNull_ThrowsArgumentNullException()
- {
- // Setup
- var chart = new BaseChart();
-
- // Call
- TestDelegate test = () => chart.SetPosition(null, new Random(21).Next());
-
- // Assert
- Assert.Throws(test);
- }
-
- [Test]
- public void SetPosition_SerieNotOnChart_ThrowsNotSupportedException()
- {
- // Setup
- BaseChart chart = CreateTestBaseChart();
-
- // Call
- TestDelegate test = () => chart.SetPosition(new TestChartData(), 0);
-
- // Assert
- Assert.Throws(test);
- }
-
- [Test]
- [TestCase(-50)]
- [TestCase(-1)]
- [TestCase(3)]
- [TestCase(50)]
- public void SetPosition_SerieOnChartPositionOutsideRange_ThrowsInvalidOperationException(int position)
- {
- // Setup
- BaseChart chart = CreateTestBaseChart();
-
- // Call
- TestDelegate test = () => chart.SetPosition(new TestChartData(), position);
-
- // Assert
- Assert.Throws(test);
- }
-
- [Test]
- [TestCase(0)]
- [TestCase(1)]
- [TestCase(2)]
- public void SetPosition_SerieOnChartPositionInRange_SetsNewPosition(int position)
- {
- // Setup
- BaseChart chart = CreateTestBaseChart();
- var testElement = chart.Data.ElementAt(new Random(21).Next(0,3));
-
- // Call
- chart.SetPosition(testElement, position);
-
- // Assert
- Assert.AreSame(testElement, chart.Data.ElementAt(position));
- }
-
- [Test]
public void NotifyObservers_WithObserverAttached_ObserverIsNotified()
{
// Setup
@@ -247,12 +188,12 @@
{
return new BaseChart
{
- Data =
+ Data = new ChartDataCollection(new List
{
new LineData(new List>()),
new PointData(new List>()),
new AreaData(new List>())
- }
+ })
};
}
}
Index: Core/Components/test/Core.Components.OxyPlot.Forms.Test/LinearPlotViewTest.cs
===================================================================
diff -u -r9b19f753c055f426fcea7b6c01cdf43c8d9f2468 -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Components/test/Core.Components.OxyPlot.Forms.Test/LinearPlotViewTest.cs (.../LinearPlotViewTest.cs) (revision 9b19f753c055f426fcea7b6c01cdf43c8d9f2468)
+++ Core/Components/test/Core.Components.OxyPlot.Forms.Test/LinearPlotViewTest.cs (.../LinearPlotViewTest.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -4,7 +4,6 @@
using OxyPlot;
using OxyPlot.Axes;
using Core.Components.OxyPlot.Forms.Properties;
-using OxyPlot.Series;
using OxyPlot.WindowsForms;
using TickStyle = OxyPlot.Axes.TickStyle;
Index: Core/Components/test/Core.Components.OxyPlot.Test/Converter/AreaDataConverterTest.cs
===================================================================
diff -u -rd0f1bca0f6a4833a790ae7eba9fde30674a52ddb -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Components/test/Core.Components.OxyPlot.Test/Converter/AreaDataConverterTest.cs (.../AreaDataConverterTest.cs) (revision d0f1bca0f6a4833a790ae7eba9fde30674a52ddb)
+++ Core/Components/test/Core.Components.OxyPlot.Test/Converter/AreaDataConverterTest.cs (.../AreaDataConverterTest.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -67,8 +67,8 @@
var series = converter.Convert(areaData);
// Assert
- Assert.IsInstanceOf(series);
- var areaSeries = ((AreaSeries)series);
+ Assert.IsInstanceOf>(series);
+ var areaSeries = ((AreaSeries)series[0]);
var expectedData = points.Select(t => new DataPoint(t.Item1, t.Item2)).ToArray();
CollectionAssert.AreEqual(expectedData, areaSeries.Points);
CollectionAssert.AreEqual(new Collection { expectedData.First() }, areaSeries.Points2);
Index: Core/Components/test/Core.Components.OxyPlot.Test/Converter/ChartDataConverterTest.cs
===================================================================
diff -u -rd0f1bca0f6a4833a790ae7eba9fde30674a52ddb -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Components/test/Core.Components.OxyPlot.Test/Converter/ChartDataConverterTest.cs (.../ChartDataConverterTest.cs) (revision d0f1bca0f6a4833a790ae7eba9fde30674a52ddb)
+++ Core/Components/test/Core.Components.OxyPlot.Test/Converter/ChartDataConverterTest.cs (.../ChartDataConverterTest.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -48,9 +48,7 @@
Assert.IsFalse(childResult);
}
- private class Class : ChartData {
- public Class() : base(new Collection>()) { }
- }
+ private class Class : ChartData {}
private class Child : Class {}
@@ -71,7 +69,7 @@
}
}
- internal override Series Convert(ChartData data)
+ internal override IList Convert(ChartData data)
{
throw new NotImplementedException();
}
Index: Core/Components/test/Core.Components.OxyPlot.Test/Converter/LineDataConverterTest.cs
===================================================================
diff -u -rd0f1bca0f6a4833a790ae7eba9fde30674a52ddb -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Components/test/Core.Components.OxyPlot.Test/Converter/LineDataConverterTest.cs (.../LineDataConverterTest.cs) (revision d0f1bca0f6a4833a790ae7eba9fde30674a52ddb)
+++ Core/Components/test/Core.Components.OxyPlot.Test/Converter/LineDataConverterTest.cs (.../LineDataConverterTest.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Collections.ObjectModel;
using Core.Components.Charting.Data;
using Core.Components.Charting.TestUtil;
@@ -63,8 +64,8 @@
var series = converter.Convert(lineData);
// Assert
- Assert.IsInstanceOf(series);
- var lineSeries = ((LineSeries)series);
+ Assert.IsInstanceOf>(series);
+ var lineSeries = ((LineSeries)series[0]);
CollectionAssert.AreEqual(points, lineSeries.ItemsSource);
Assert.AreNotSame(points, lineSeries.ItemsSource);
}
Index: Core/Components/test/Core.Components.OxyPlot.Test/Converter/PointDataConverterTest.cs
===================================================================
diff -u -rd0f1bca0f6a4833a790ae7eba9fde30674a52ddb -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Components/test/Core.Components.OxyPlot.Test/Converter/PointDataConverterTest.cs (.../PointDataConverterTest.cs) (revision d0f1bca0f6a4833a790ae7eba9fde30674a52ddb)
+++ Core/Components/test/Core.Components.OxyPlot.Test/Converter/PointDataConverterTest.cs (.../PointDataConverterTest.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Collections.ObjectModel;
using Core.Components.Charting.Data;
using Core.Components.Charting.TestUtil;
@@ -64,8 +65,8 @@
var series = converter.Convert(pointData);
// Assert
- Assert.IsInstanceOf(series);
- var lineSeries = ((LineSeries)series);
+ Assert.IsInstanceOf>(series);
+ var lineSeries = ((LineSeries)series[0]);
CollectionAssert.AreEqual(points, lineSeries.ItemsSource);
Assert.AreNotSame(points, lineSeries.ItemsSource);
Assert.AreEqual(LineStyle.None, lineSeries.LineStyle);
Index: Core/Components/test/Core.Components.OxyPlot.Test/Converter/SeriesFactoryTest.cs
===================================================================
diff -u -rd0f1bca0f6a4833a790ae7eba9fde30674a52ddb -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Components/test/Core.Components.OxyPlot.Test/Converter/SeriesFactoryTest.cs (.../SeriesFactoryTest.cs) (revision d0f1bca0f6a4833a790ae7eba9fde30674a52ddb)
+++ Core/Components/test/Core.Components.OxyPlot.Test/Converter/SeriesFactoryTest.cs (.../SeriesFactoryTest.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -23,11 +23,12 @@
var expectedData = CreateExpectedData(testData);
// Call
- Series series = factory.Create(new AreaData(testData));
+ IList series = factory.Create(new AreaData(testData));
// Assert
- Assert.IsInstanceOf(series);
- var areaSeries = ((AreaSeries)series);
+ Assert.AreEqual(1, series.Count);
+ Assert.IsInstanceOf>(series);
+ var areaSeries = ((AreaSeries)series[0]);
CollectionAssert.AreEqual(expectedData, areaSeries.Points);
CollectionAssert.AreEqual(new Collection{expectedData.First()}, areaSeries.Points2);
Assert.AreNotSame(expectedData, areaSeries.ItemsSource);
@@ -41,11 +42,12 @@
var testData = CreateTestData();
// Call
- Series series = factory.Create(new LineData(testData));
+ IList series = factory.Create(new LineData(testData));
// Assert
- Assert.IsInstanceOf(series);
- var lineSeries = ((LineSeries)series);
+ Assert.AreEqual(1, series.Count);
+ Assert.IsInstanceOf>(series);
+ var lineSeries = ((LineSeries)series[0]);
CollectionAssert.AreEqual(testData, lineSeries.ItemsSource);
Assert.AreNotSame(testData, lineSeries.ItemsSource);
}
@@ -58,11 +60,12 @@
var testData = CreateTestData();
// Call
- Series series = factory.Create(new PointData(testData));
+ IList series = factory.Create(new PointData(testData));
// Assert
- Assert.IsInstanceOf(series);
- var lineSeries = ((LineSeries)series);
+ Assert.AreEqual(1, series.Count);
+ Assert.IsInstanceOf>(series);
+ var lineSeries = ((LineSeries)series[0]);
CollectionAssert.AreEqual(testData, lineSeries.ItemsSource);
Assert.AreNotSame(testData, lineSeries.ItemsSource);
Assert.AreEqual(LineStyle.None, lineSeries.LineStyle);
Index: Core/Plugins/src/Core.Plugins.OxyPlot/Commands/OpenChartViewCommand.cs
===================================================================
diff -u -r49d7fa72db4b07c74e58d15a2d4ac21dc06160ea -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Plugins/src/Core.Plugins.OxyPlot/Commands/OpenChartViewCommand.cs (.../OpenChartViewCommand.cs) (revision 49d7fa72db4b07c74e58d15a2d4ac21dc06160ea)
+++ Core/Plugins/src/Core.Plugins.OxyPlot/Commands/OpenChartViewCommand.cs (.../OpenChartViewCommand.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -1,7 +1,9 @@
using System;
+using System.Collections.Generic;
using System.Collections.ObjectModel;
using Core.Common.Gui;
using Core.Components.Charting.Data;
+using Core.Components.OxyPlot.Collection;
using Core.Plugins.OxyPlot.Forms;
namespace Core.Plugins.OxyPlot.Commands
@@ -59,7 +61,7 @@
new Tuple(0.5, 1.6),
new Tuple(1.0, 2.1)
});
- Gui.DocumentViewsResolver.OpenViewForData(new Collection() { area, clearArea, line, points });
+ Gui.DocumentViewsResolver.OpenViewForData(new ChartDataCollection( new List { area, clearArea, line, points }));
}
}
}
\ No newline at end of file
Index: Core/Plugins/src/Core.Plugins.OxyPlot/Forms/ChartDataView.cs
===================================================================
diff -u -r460ed7ba26498668b47780bf1abd8293db3baeff -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Plugins/src/Core.Plugins.OxyPlot/Forms/ChartDataView.cs (.../ChartDataView.cs) (revision 460ed7ba26498668b47780bf1abd8293db3baeff)
+++ Core/Plugins/src/Core.Plugins.OxyPlot/Forms/ChartDataView.cs (.../ChartDataView.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -10,7 +10,7 @@
///
public partial class ChartDataView : UserControl, IChartView
{
- private ICollection data;
+ private ChartData data;
///
/// Creates a new instance of .
@@ -28,13 +28,11 @@
}
set
{
- data = (ICollection) value;
+ data = (ChartData) value;
+
if (data != null)
{
- foreach (var item in data)
- {
- Chart.Data.Add(item);
- }
+ Chart.Data = data;
}
}
}
Index: Core/Plugins/src/Core.Plugins.OxyPlot/Legend/ChartDataNodePresenter.cs
===================================================================
diff -u -r16f0202ea76565e235a73eae6637b3ca03e9c3df -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Plugins/src/Core.Plugins.OxyPlot/Legend/ChartDataNodePresenter.cs (.../ChartDataNodePresenter.cs) (revision 16f0202ea76565e235a73eae6637b3ca03e9c3df)
+++ Core/Plugins/src/Core.Plugins.OxyPlot/Legend/ChartDataNodePresenter.cs (.../ChartDataNodePresenter.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -21,29 +21,45 @@
{
node.Text = Resources.ChartDataNodePresenter_Area_data_label;
node.Image = Resources.AreaIcon;
+ node.Checked = ((AreaData)nodeData).IsVisible;
}
else if (nodeData is LineData)
{
node.Text = Resources.ChartDataNodePresenter_Line_data_label;
node.Image = Resources.LineIcon;
+ node.Checked = ((LineData)nodeData).IsVisible;
}
else if (nodeData is PointData)
{
node.Text = Resources.ChartDataNodePresenter_Point_data_label;
node.Image = Resources.PointsIcon;
+ node.Checked = ((PointData)nodeData).IsVisible;
}
else
{
throw new NotSupportedException("Cannot add chart data of type other than points, lines or area.");
}
node.ShowCheckBox = true;
- node.Checked = nodeData.IsVisible;
}
public override void OnNodeChecked(TreeNode node)
{
- var chartData = ((ChartData)node.Tag);
- chartData.IsVisible = node.Checked;
+ var chartData = (ChartData)node.Parent.Tag;
+ var lineData = node.Tag as LineData;
+ var pointData = node.Tag as PointData;
+ var areaData = node.Tag as AreaData;
+ if (lineData != null)
+ {
+ lineData.IsVisible = node.Checked;
+ }
+ if (pointData != null)
+ {
+ pointData.IsVisible = node.Checked;
+ }
+ if (areaData != null)
+ {
+ areaData.IsVisible = node.Checked;
+ }
chartData.NotifyObservers();
}
}
Index: Core/Plugins/src/Core.Plugins.OxyPlot/Legend/ChartNodePresenter.cs
===================================================================
diff -u -r2b683c57220a71446dcf4eda3894fd003546347f -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Plugins/src/Core.Plugins.OxyPlot/Legend/ChartNodePresenter.cs (.../ChartNodePresenter.cs) (revision 2b683c57220a71446dcf4eda3894fd003546347f)
+++ Core/Plugins/src/Core.Plugins.OxyPlot/Legend/ChartNodePresenter.cs (.../ChartNodePresenter.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -3,14 +3,15 @@
using Core.Common.Controls.TreeView;
using Core.Common.Gui.Properties;
using Core.Components.Charting.Data;
+using Core.Components.OxyPlot.Collection;
using Core.Components.OxyPlot.Forms;
namespace Core.Plugins.OxyPlot.Legend
{
///
/// This class describes the presentation of in a .
///
- public class ChartNodePresenter : TreeViewNodePresenterBase
+ public class ChartNodePresenter : TreeViewNodePresenterBase
{
public override DragOperations CanDrop(object item, TreeNode sourceNode, TreeNode targetNode, DragOperations validOperations)
{
@@ -26,22 +27,23 @@
return item is ChartData;
}
- public override void OnDragDrop(object item, object itemParent, BaseChart target, DragOperations operation, int position)
+ public override void OnDragDrop(object item, object itemParent, ChartDataCollection target, DragOperations operation, int position)
{
var draggedData = item as ChartData;
- target.SetPosition(draggedData, target.Data.Count - 1 - position);
+ target.List.Remove(draggedData);
+ target.List.Insert(target.List.Count - position, draggedData);
target.NotifyObservers();
}
- public override void UpdateNode(TreeNode parentNode, TreeNode node, BaseChart nodeData)
+ public override void UpdateNode(TreeNode parentNode, TreeNode node, ChartDataCollection nodeData)
{
node.Text = Properties.Resources.General_Chart;
node.Image = Resources.folder;
}
- public override IEnumerable GetChildNodeObjects(BaseChart parentNodeData)
+ public override IEnumerable GetChildNodeObjects(ChartDataCollection parentNodeData)
{
- return parentNodeData.Data.Reverse();
+ return parentNodeData.List.Reverse();
}
}
}
\ No newline at end of file
Index: Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendController.cs
===================================================================
diff -u -r9bf140313b222568c57110c9a8a664e2e1a213e1 -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendController.cs (.../LegendController.cs) (revision 9bf140313b222568c57110c9a8a664e2e1a213e1)
+++ Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendController.cs (.../LegendController.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -1,5 +1,8 @@
using System;
+using System.Resources;
using Core.Common.Controls.Views;
+using Core.Components.Charting;
+using Core.Components.Charting.Data;
using Core.Components.OxyPlot.Forms;
namespace Core.Plugins.OxyPlot.Legend
@@ -73,11 +76,11 @@
///
/// The for which to show data. If null the
/// data will be cleared.
- public void UpdateForChart(BaseChart chart)
+ public void Update(ChartData data)
{
if (IsLegendViewOpen())
{
- legendView.Data = chart;
+ legendView.Data = data;
}
}
}
Index: Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendTreeView.cs
===================================================================
diff -u -r49d7fa72db4b07c74e58d15a2d4ac21dc06160ea -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendTreeView.cs (.../LegendTreeView.cs) (revision 49d7fa72db4b07c74e58d15a2d4ac21dc06160ea)
+++ Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendTreeView.cs (.../LegendTreeView.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -1,4 +1,5 @@
-using Core.Components.OxyPlot.Forms;
+using Core.Components.Charting.Data;
+using Core.Components.OxyPlot.Forms;
using TreeView = Core.Common.Controls.TreeView.TreeView;
namespace Core.Plugins.OxyPlot.Legend
@@ -20,11 +21,11 @@
///
/// Gets or sets the that is used as the source of the .
///
- public BaseChart Chart
+ public ChartData ChartData
{
get
{
- return (BaseChart)Data;
+ return (ChartData)Data;
}
set
{
Index: Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendView.cs
===================================================================
diff -u -r51a1d01aacd31638434df31702386d9a8c8f9a17 -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendView.cs (.../LegendView.cs) (revision 51a1d01aacd31638434df31702386d9a8c8f9a17)
+++ Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendView.cs (.../LegendView.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -1,5 +1,6 @@
using System.Windows.Forms;
using Core.Common.Controls.Views;
+using Core.Components.Charting.Data;
using Core.Components.OxyPlot.Forms;
using Core.Plugins.OxyPlot.Properties;
@@ -23,24 +24,24 @@
{
get
{
- return seriesTree.Chart;
+ return seriesTree.ChartData;
}
set
{
- UpdateTree((BaseChart)value);
+ UpdateTree((ChartData)value);
}
}
///
/// Updates the tree with the current state of the chart.
///
- private void UpdateTree(BaseChart data)
+ private void UpdateTree(ChartData data)
{
if (IsDisposed)
{
return;
}
- seriesTree.Chart = data;
+ seriesTree.ChartData = data;
}
}
}
\ No newline at end of file
Index: Core/Plugins/src/Core.Plugins.OxyPlot/OxyPlotGuiPlugin.cs
===================================================================
diff -u -rd2e8fef372ac718930dabb3952f7d0199764d39c -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Plugins/src/Core.Plugins.OxyPlot/OxyPlotGuiPlugin.cs (.../OxyPlotGuiPlugin.cs) (revision d2e8fef372ac718930dabb3952f7d0199764d39c)
+++ Core/Plugins/src/Core.Plugins.OxyPlot/OxyPlotGuiPlugin.cs (.../OxyPlotGuiPlugin.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -4,7 +4,7 @@
using Core.Common.Gui;
using Core.Common.Gui.Forms;
using Core.Common.Gui.Plugin;
-using Core.Components.Charting.Data;
+using Core.Components.OxyPlot.Collection;
using Core.Plugins.OxyPlot.Commands;
using Core.Plugins.OxyPlot.Forms;
using Core.Plugins.OxyPlot.Legend;
@@ -43,7 +43,7 @@
public override IEnumerable GetViewInfoObjects()
{
- yield return new ViewInfo, ChartDataView>
+ yield return new ViewInfo
{
Image = Resources.ChartIcon,
GetViewName = (v, o) => "Diagram"
@@ -121,12 +121,12 @@
if (chartView != null)
{
chartingRibbon.Chart = chartView.Chart;
- legendController.UpdateForChart(chartView.Chart);
+ legendController.Update(chartView.Chart.Data);
}
else
{
chartingRibbon.Chart = null;
- legendController.UpdateForChart(null);
+ legendController.Update(null);
}
}
}
Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Forms/ChartDataViewTest.cs
===================================================================
diff -u -rba3f5abc18676f64d95d75270494424f169b3c4e -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Forms/ChartDataViewTest.cs (.../ChartDataViewTest.cs) (revision ba3f5abc18676f64d95d75270494424f169b3c4e)
+++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Forms/ChartDataViewTest.cs (.../ChartDataViewTest.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -36,7 +36,7 @@
chartView.Data = null;
// Assert
- Assert.IsEmpty(chart.Data);
+// Assert.IsEmpty(chart.Data);
}
[Test]
Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartDataNodePresenterTest.cs
===================================================================
diff -u -r460ed7ba26498668b47780bf1abd8293db3baeff -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartDataNodePresenterTest.cs (.../ChartDataNodePresenterTest.cs) (revision 460ed7ba26498668b47780bf1abd8293db3baeff)
+++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartDataNodePresenterTest.cs (.../ChartDataNodePresenterTest.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -5,11 +5,11 @@
using Core.Common.TestUtil;
using Core.Components.Charting.Data;
using Core.Components.Charting.TestUtil;
+using Core.Components.OxyPlot.Collection;
using Core.Components.OxyPlot.Forms;
using Core.Plugins.OxyPlot.Legend;
using Core.Plugins.OxyPlot.Properties;
using NUnit.Framework;
-using Rhino.Mocks;
namespace Core.Plugins.OxyPlot.Test.Legend
{
@@ -53,17 +53,26 @@
var pointData = new PointData(new List>());
var areaData = new AreaData(new List>());
+ var chartDataCollection = new ChartDataCollection(new ChartData[]
+ {
+ lineData,
+ pointData,
+ areaData
+ });
var legendTreeView = new LegendTreeView
{
- Chart = new BaseChart
- {
- Data = {lineData, pointData, areaData}
- }
+ Data = chartDataCollection
};
+ legendTreeView.ChartData = chartDataCollection;
+
var nodePresenter = new ChartDataNodePresenter
{
TreeView = legendTreeView
};
+ var parentNode = new TreeNode(legendTreeView)
+ {
+ Tag = chartDataCollection
+ };
var lineNode = new TreeNode(legendTreeView)
{
Tag = lineData,
@@ -79,6 +88,9 @@
Tag = areaData,
Checked = isVisible
};
+ parentNode.Nodes.Add(lineNode);
+ parentNode.Nodes.Add(pointNode);
+ parentNode.Nodes.Add(areaNode);
// When
nodePresenter.OnNodeChecked(lineNode);
Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartNodePresenterTest.cs
===================================================================
diff -u -r460ed7ba26498668b47780bf1abd8293db3baeff -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartNodePresenterTest.cs (.../ChartNodePresenterTest.cs) (revision 460ed7ba26498668b47780bf1abd8293db3baeff)
+++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartNodePresenterTest.cs (.../ChartNodePresenterTest.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -7,6 +7,7 @@
using Core.Common.TestUtil;
using Core.Components.Charting.Data;
using Core.Components.Charting.TestUtil;
+using Core.Components.OxyPlot.Collection;
using Core.Components.OxyPlot.Forms;
using Core.Plugins.OxyPlot.Legend;
using NUnit.Framework;
@@ -23,9 +24,9 @@
var nodePresenter = new ChartNodePresenter();
// Assert
- Assert.IsInstanceOf>(nodePresenter);
+ Assert.IsInstanceOf>(nodePresenter);
Assert.IsNull(nodePresenter.TreeView);
- Assert.AreEqual(typeof(BaseChart), nodePresenter.NodeTagType);
+ Assert.AreEqual(typeof(ChartDataCollection), nodePresenter.NodeTagType);
}
[Test]
@@ -86,36 +87,37 @@
{
// Setup
var nodePresenter = new ChartNodePresenter();
- BaseChart chart = CreateTestBaseChart();
+ ChartDataCollection chart = CreateTestBaseChart();
- ChartData testElement = chart.Data.ElementAt(0);
+ ChartData testElement = chart.List.ElementAt(0);
+
// Call
nodePresenter.OnDragDrop(testElement, null, chart, 0, position);
// Assert
var reversedIndex = 2 - position;
- Assert.AreSame(testElement, chart.Data.ElementAt(reversedIndex));
+ Assert.AreSame(testElement, chart.List.ElementAt(reversedIndex));
}
[Test]
[TestCase(-50)]
[TestCase(-1)]
[TestCase(3)]
[TestCase(50)]
- public void OnDragDrop_ChartDataAndBaseChartOutsideRange_ThrowsArgumentException(int position)
+ public void OnDragDrop_ChartDataAndBaseChartOutsideRange_ThrowsArgumentOutOfRangeException(int position)
{
// Setup
var nodePresenter = new ChartNodePresenter();
- BaseChart chart = CreateTestBaseChart();
+ ChartDataCollection chart = CreateTestBaseChart();
- ChartData testElement = chart.Data.ElementAt(0);
+ ChartData testElement = chart.List.ElementAt(0);
// Call
TestDelegate test = () => nodePresenter.OnDragDrop(testElement, null, chart, 0, position);
// Assert
- Assert.Throws(test);
+ Assert.Throws(test);
}
[Test]
@@ -138,25 +140,23 @@
{
// Setup
var nodePresenter = new ChartNodePresenter();
- BaseChart chart = CreateTestBaseChart();
+ ChartDataCollection chart = CreateTestBaseChart();
// Call
IEnumerable result = nodePresenter.GetChildNodeObjects(chart);
// Assert
- CollectionAssert.AreEqual(chart.Data.Reverse(), result);
+ CollectionAssert.AreEqual(chart.List.Reverse(), result);
}
- private static BaseChart CreateTestBaseChart()
+ private static ChartDataCollection CreateTestBaseChart()
{
- return new BaseChart
+ return new ChartDataCollection(new List
{
- Data = {
- new LineData(new List>()),
- new PointData(new List>()),
- new AreaData(new List>())
- }
- };
+ new LineData(new List>()),
+ new PointData(new List>()),
+ new AreaData(new List>())
+ });
}
}
}
\ No newline at end of file
Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/LegendTreeViewTest.cs
===================================================================
diff -u -ra70fac40e34e16bed007b1d0d4e437d91c89d0cb -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/LegendTreeViewTest.cs (.../LegendTreeViewTest.cs) (revision a70fac40e34e16bed007b1d0d4e437d91c89d0cb)
+++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/LegendTreeViewTest.cs (.../LegendTreeViewTest.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -17,7 +17,7 @@
Assert.AreEqual(2, view.NodePresenters.Count());
Assert.IsInstanceOf(view.NodePresenters.ElementAt(0));
Assert.IsInstanceOf(view.NodePresenters.ElementAt(1));
- Assert.IsNull(view.Chart);
+ Assert.IsNull(view.ChartData);
}
}
}
\ No newline at end of file
Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/LegendViewTest.cs
===================================================================
diff -u -ra70fac40e34e16bed007b1d0d4e437d91c89d0cb -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/LegendViewTest.cs (.../LegendViewTest.cs) (revision a70fac40e34e16bed007b1d0d4e437d91c89d0cb)
+++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/LegendViewTest.cs (.../LegendViewTest.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -1,6 +1,9 @@
using System;
+using System.Collections.Generic;
using System.Windows.Forms;
using Core.Common.Controls.Views;
+using Core.Components.Charting.Data;
+using Core.Components.OxyPlot.Collection;
using Core.Components.OxyPlot.Forms;
using Core.Plugins.OxyPlot.Legend;
using Core.Plugins.OxyPlot.Properties;
@@ -29,7 +32,7 @@
{
// Setup
var view = new LegendView();
- var baseChart = new BaseChart();
+ var baseChart = new ChartDataCollection(new List());
// Call
view.Data = baseChart;
Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/OxyPlotGuiPluginTest.cs
===================================================================
diff -u -rd2e8fef372ac718930dabb3952f7d0199764d39c -rfc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8
--- Core/Plugins/test/Core.Plugins.OxyPlot.Test/OxyPlotGuiPluginTest.cs (.../OxyPlotGuiPluginTest.cs) (revision d2e8fef372ac718930dabb3952f7d0199764d39c)
+++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/OxyPlotGuiPluginTest.cs (.../OxyPlotGuiPluginTest.cs) (revision fc0a61c81da4dcf9f436c8b8bd9c51c6b4d65ef8)
@@ -7,6 +7,8 @@
using Core.Common.Gui.Forms.MainWindow;
using Core.Common.Gui.Forms.ViewManager;
using Core.Components.Charting.Data;
+using Core.Components.Charting.TestUtil;
+using Core.Components.OxyPlot.Collection;
using Core.Components.OxyPlot.Forms;
using Core.Plugins.OxyPlot.Forms;
using Core.Plugins.OxyPlot.Legend;
@@ -93,7 +95,7 @@
// Assert
Assert.AreEqual(1, views.Length);
- Assert.AreEqual(typeof(ICollection), views[0].DataType);
+ Assert.AreEqual(typeof(ChartDataCollection), views[0].DataType);
Assert.AreEqual(typeof(ChartDataView), views[0].ViewType);
Assert.AreEqual("Diagram", views[0].GetViewName(view, null));
}
@@ -135,7 +137,11 @@
gui.MainWindow = new MainWindow(gui);
var mocks = new MockRepository();
IView viewMock = isChartViewActive ? (IView)new TestChartView() : new TestView();
- viewMock.Data = new BaseChart();
+ var baseChart = new BaseChart
+ {
+ Data = new LineData(Enumerable.Empty>())
+ };
+ viewMock.Data = baseChart;
mocks.ReplayAll();
@@ -152,7 +158,7 @@
plugin.OpenToolView(legendView);
// Then
- Assert.AreSame(isChartViewActive ? viewMock.Data : null, legendView.Data);
+ Assert.AreSame(isChartViewActive ? baseChart.Data : null, legendView.Data);
mocks.VerifyAll();
}
}