Index: Core/Components/src/Core.Components.OxyPlot.Forms/BaseChart.cs
===================================================================
diff -u -r570101d9648e296b96c7e624c4d4f6bfad8d41b6 -r51a1d01aacd31638434df31702386d9a8c8f9a17
--- Core/Components/src/Core.Components.OxyPlot.Forms/BaseChart.cs (.../BaseChart.cs) (revision 570101d9648e296b96c7e624c4d4f6bfad8d41b6)
+++ Core/Components/src/Core.Components.OxyPlot.Forms/BaseChart.cs (.../BaseChart.cs) (revision 51a1d01aacd31638434df31702386d9a8c8f9a17)
@@ -3,6 +3,7 @@
using Core.Components.OxyPlot.Properties;
using OxyPlot;
using OxyPlot.Axes;
+using OxyPlot.Series;
using OxyPlot.WindowsForms;
namespace Core.Components.OxyPlot.Forms
@@ -46,14 +47,16 @@
Position = AxisPosition.Bottom,
TickStyle = TickStyle.None,
ExtraGridlines = new[] { 0.0 },
- ExtraGridlineThickness = 1
+ ExtraGridlineThickness = 1,
+ Layer = AxisLayer.AboveSeries
};
yAxis = new LinearAxis
{
Title = Resources.BaseChart_YAxisTitle,
TickStyle = TickStyle.None,
ExtraGridlines = new[] { 0.0 },
- ExtraGridlineThickness = 1
+ ExtraGridlineThickness = 1,
+ Layer = AxisLayer.AboveSeries
};
Model.Axes.Add(xAxis);
Model.Axes.Add(yAxis);
@@ -80,5 +83,24 @@
{
Model.Series.Clear();
}
+
+ ///
+ /// 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)
+ {
+ chartData.IsVisible = visibility;
+ Invalidate();
+ }
+ else
+ {
+ throw new ArgumentException("Visibility set for IChartData which was not of type Series.");
+ }
+ }
}
}
\ No newline at end of file
Index: Core/Plugins/src/Core.Plugins.OxyPlot/Commands/OpenChartViewCommand.cs
===================================================================
diff -u -r03d5df1364557b6f4a184908affb7754e58b3fa4 -r51a1d01aacd31638434df31702386d9a8c8f9a17
--- Core/Plugins/src/Core.Plugins.OxyPlot/Commands/OpenChartViewCommand.cs (.../OpenChartViewCommand.cs) (revision 03d5df1364557b6f4a184908affb7754e58b3fa4)
+++ Core/Plugins/src/Core.Plugins.OxyPlot/Commands/OpenChartViewCommand.cs (.../OpenChartViewCommand.cs) (revision 51a1d01aacd31638434df31702386d9a8c8f9a17)
@@ -2,6 +2,7 @@
using System.Collections.ObjectModel;
using Core.Common.Gui;
using Core.Components.OxyPlot.Data;
+using OxyPlot;
namespace Core.Plugins.OxyPlot.Commands
{
@@ -41,6 +42,14 @@
new Tuple(0.0, 0.5),
new Tuple(0.0, 1.1)
});
+ var clearArea = new AreaData(new Collection>
+ {
+ new Tuple(0.5, 0.5),
+ new Tuple(0.5, 1.0),
+ 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),
@@ -49,6 +58,7 @@
});
var data = new CollectionData();
data.Add(area);
+ data.Add(clearArea);
data.Add(line);
data.Add(points);
Gui.DocumentViewsResolver.OpenViewForData(data);
Index: Core/Plugins/src/Core.Plugins.OxyPlot/Legend/ChartDataNodePresenter.cs
===================================================================
diff -u -r570101d9648e296b96c7e624c4d4f6bfad8d41b6 -r51a1d01aacd31638434df31702386d9a8c8f9a17
--- Core/Plugins/src/Core.Plugins.OxyPlot/Legend/ChartDataNodePresenter.cs (.../ChartDataNodePresenter.cs) (revision 570101d9648e296b96c7e624c4d4f6bfad8d41b6)
+++ Core/Plugins/src/Core.Plugins.OxyPlot/Legend/ChartDataNodePresenter.cs (.../ChartDataNodePresenter.cs) (revision 51a1d01aacd31638434df31702386d9a8c8f9a17)
@@ -1,3 +1,4 @@
+using System.ComponentModel;
using Core.Common.Controls.TreeView;
using Core.Components.OxyPlot.Data;
@@ -23,6 +24,13 @@
{
node.Image = Properties.Resources.PointsIcon;
}
+ node.ShowCheckBox = true;
+ node.Checked = true;
}
+
+ public override void OnNodeChecked(TreeNode node)
+ {
+ ((LegendTreeView) TreeView).Chart.SetVisibility((IChartData)node.Tag, node.Checked);
+ }
}
}
\ No newline at end of file
Index: Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendTreeView.cs
===================================================================
diff -u -r570101d9648e296b96c7e624c4d4f6bfad8d41b6 -r51a1d01aacd31638434df31702386d9a8c8f9a17
--- Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendTreeView.cs (.../LegendTreeView.cs) (revision 570101d9648e296b96c7e624c4d4f6bfad8d41b6)
+++ Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendTreeView.cs (.../LegendTreeView.cs) (revision 51a1d01aacd31638434df31702386d9a8c8f9a17)
@@ -1,4 +1,5 @@
-using Core.Common.Controls.TreeView;
+using Core.Components.OxyPlot.Forms;
+using TreeView = Core.Common.Controls.TreeView.TreeView;
namespace Core.Plugins.OxyPlot.Legend
{
@@ -9,5 +10,22 @@
RegisterNodePresenter(new ChartDataNodePresenter());
RegisterNodePresenter(new ChartNodePresenter());
}
+
+ public BaseChart Chart
+ {
+ get
+ {
+ return (BaseChart)Data;
+ }
+ set
+ {
+ Data = value;
+
+ if (value == null)
+ {
+ Nodes.Clear();
+ }
+ }
+ }
}
}
\ No newline at end of file
Index: Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendView.cs
===================================================================
diff -u -r10a16f2a08c6a50176351ae46c9a23a37ab92e28 -r51a1d01aacd31638434df31702386d9a8c8f9a17
--- Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendView.cs (.../LegendView.cs) (revision 10a16f2a08c6a50176351ae46c9a23a37ab92e28)
+++ Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendView.cs (.../LegendView.cs) (revision 51a1d01aacd31638434df31702386d9a8c8f9a17)
@@ -11,11 +11,6 @@
public sealed partial class LegendView : UserControl, IView
{
///
- /// The chart for which this view should show data.
- ///
- private BaseChart chart;
-
- ///
/// Creates a new instance of .
///
public LegendView()
@@ -28,32 +23,24 @@
{
get
{
- return chart;
+ return seriesTree.Chart;
}
set
{
- chart = (BaseChart) value;
- UpdateTree();
+ UpdateTree((BaseChart)value);
}
}
///
/// Updates the tree with the current state of the chart.
///
- private void UpdateTree()
+ private void UpdateTree(BaseChart data)
{
if (IsDisposed)
{
return;
}
- if (chart != null)
- {
- seriesTree.Data = chart;
- }
- else
- {
- seriesTree.Nodes.Clear();
- }
+ seriesTree.Chart = data;
}
}
}
\ No newline at end of file
Index: Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendView.resx
===================================================================
diff -u -r5a98830aee77b1ee0158c11ba5cccffc656226e0 -r51a1d01aacd31638434df31702386d9a8c8f9a17
--- Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendView.resx (.../LegendView.resx) (revision 5a98830aee77b1ee0158c11ba5cccffc656226e0)
+++ Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendView.resx (.../LegendView.resx) (revision 51a1d01aacd31638434df31702386d9a8c8f9a17)
@@ -142,7 +142,7 @@
seriesTree
- Core.Plugins.OxyPlot.Legend.LegendTreeView, Core.Plugins.OxyPlot, Version=0.5.0.1508, Culture=neutral, PublicKeyToken=null
+ Core.Plugins.OxyPlot.Legend.LegendTreeView, Core.Plugins.OxyPlot, Version=0.5.0.1530, Culture=neutral, PublicKeyToken=null
$this
Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartDataNodePresenterTest.cs
===================================================================
diff -u -r10a16f2a08c6a50176351ae46c9a23a37ab92e28 -r51a1d01aacd31638434df31702386d9a8c8f9a17
--- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartDataNodePresenterTest.cs (.../ChartDataNodePresenterTest.cs) (revision 10a16f2a08c6a50176351ae46c9a23a37ab92e28)
+++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/ChartDataNodePresenterTest.cs (.../ChartDataNodePresenterTest.cs) (revision 51a1d01aacd31638434df31702386d9a8c8f9a17)
@@ -26,7 +26,7 @@
}
[Test]
- public void UpdateNode_ForPointData_SetsTextAndIcon()
+ public void UpdateNode_ForPointData_SetsProperties()
{
// Setup
var nodePresenter = new ChartDataNodePresenter();
@@ -37,6 +37,8 @@
// Assert
Assert.AreEqual("PointData", treeNode.Text);
+ Assert.IsTrue(treeNode.ShowCheckBox);
+ Assert.IsTrue(treeNode.Checked);
TestHelper.AssertImagesAreEqual(Resources.PointsIcon, treeNode.Image);
}
Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/OxyPlotGuiPluginTest.cs
===================================================================
diff -u -rb6dea7374102ce7e7a8f13cf127ea01c36e03eb9 -r51a1d01aacd31638434df31702386d9a8c8f9a17
--- Core/Plugins/test/Core.Plugins.OxyPlot.Test/OxyPlotGuiPluginTest.cs (.../OxyPlotGuiPluginTest.cs) (revision b6dea7374102ce7e7a8f13cf127ea01c36e03eb9)
+++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/OxyPlotGuiPluginTest.cs (.../OxyPlotGuiPluginTest.cs) (revision 51a1d01aacd31638434df31702386d9a8c8f9a17)
@@ -145,11 +145,8 @@
gui.DocumentViews.ActiveView = viewMock;
var legendView = gui.ToolWindowViews.First(t => t is LegendView);
- gui.ToolWindowViews.Remove(legendView);
+ legendView.Data = null;
- // Precondition
- Assert.IsNull(legendView.Data);
-
// When
plugin.OpenToolView(legendView);