forked from oxyplot/oxyplot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ThreeColorLineSeries (oxyplot#378)
- Loading branch information
Showing
14 changed files
with
544 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,7 @@ Kevin Crowell <[email protected]> | |
LECO® Corporation | ||
Levi Botelho <[email protected]> | ||
lsowen | ||
Luka B | ||
Matthew Leibowitz <[email protected]> | ||
Memphisch <[email protected]> | ||
Mendel Monteiro-Beckerman | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
Source/Examples/ExampleLibrary/Series/ThreeColorLineSeriesExamples.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
// <copyright file="ThreeColorLineSeriesExamples.cs" company="OxyPlot"> | ||
// Copyright (c) 2014 OxyPlot contributors | ||
// </copyright> | ||
// <summary> | ||
// Provides examples for the ThreeColorLineSeries. | ||
// </summary> | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
|
||
namespace ExampleLibrary.Series | ||
{ | ||
using OxyPlot; | ||
using OxyPlot.Axes; | ||
using OxyPlot.Series; | ||
using System; | ||
|
||
/// <summary> | ||
/// Provides examples for the <see cref="ThreeColorLineSeries" />. | ||
/// </summary> | ||
[Examples("ThreeColorLineSeries"), Tags("Series")] | ||
public class ThreeColorLineSeriesExamples | ||
{ | ||
/// <summary> | ||
/// Creates an example showing temperatures. | ||
/// </summary> | ||
/// <returns>A <see cref="PlotModel" />.</returns> | ||
[Example("Temperatures")] | ||
public static PlotModel ThreeColorLineSeries() | ||
{ | ||
var plotModel1 = new PlotModel(); | ||
plotModel1.LegendSymbolLength = 24; | ||
plotModel1.Title = "ThreeColorLineSeries"; | ||
var linearAxis1 = new LinearAxis(); | ||
linearAxis1.Title = "Temperature"; | ||
linearAxis1.Unit = "°C"; | ||
linearAxis1.ExtraGridlines = new Double[1]; | ||
linearAxis1.ExtraGridlines[0] = 0; | ||
plotModel1.Axes.Add(linearAxis1); | ||
var linearAxis2 = new LinearAxis(); | ||
linearAxis2.Position = AxisPosition.Bottom; | ||
linearAxis2.Title = "Date"; | ||
plotModel1.Axes.Add(linearAxis2); | ||
var twoColorLineSeries1 = new ThreeColorLineSeries(); | ||
twoColorLineSeries1.MarkerSize = 4; | ||
twoColorLineSeries1.MarkerStroke = OxyColors.Black; | ||
twoColorLineSeries1.MarkerStrokeThickness = 1.5; | ||
twoColorLineSeries1.MarkerType = MarkerType.Circle; | ||
//twoColorLineSeries1.Smooth = true; | ||
twoColorLineSeries1.StrokeThickness = 3; | ||
twoColorLineSeries1.Title = "Temperature Example"; | ||
twoColorLineSeries1.TrackerFormatString = "December {2:0}: {4:0.0} °C"; | ||
twoColorLineSeries1.Points.Add(new DataPoint(1, 5)); | ||
twoColorLineSeries1.Points.Add(new DataPoint(2, 0)); | ||
twoColorLineSeries1.Points.Add(new DataPoint(3, 7)); | ||
twoColorLineSeries1.Points.Add(new DataPoint(4, 7)); | ||
twoColorLineSeries1.Points.Add(new DataPoint(5, 4)); | ||
twoColorLineSeries1.Points.Add(new DataPoint(6, 3)); | ||
twoColorLineSeries1.Points.Add(new DataPoint(7, 5)); | ||
twoColorLineSeries1.Points.Add(new DataPoint(8, 5)); | ||
twoColorLineSeries1.Points.Add(new DataPoint(9, 11)); | ||
twoColorLineSeries1.Points.Add(new DataPoint(10, 4)); | ||
twoColorLineSeries1.Points.Add(new DataPoint(11, 2)); | ||
twoColorLineSeries1.Points.Add(new DataPoint(12, 3)); | ||
twoColorLineSeries1.Points.Add(new DataPoint(13, 2)); | ||
twoColorLineSeries1.Points.Add(new DataPoint(14, 1)); | ||
twoColorLineSeries1.Points.Add(new DataPoint(15, 0)); | ||
twoColorLineSeries1.Points.Add(new DataPoint(16, 2)); | ||
twoColorLineSeries1.Points.Add(new DataPoint(17, -1)); | ||
twoColorLineSeries1.Points.Add(new DataPoint(18, 0)); | ||
twoColorLineSeries1.Points.Add(new DataPoint(19, 0)); | ||
twoColorLineSeries1.Points.Add(new DataPoint(20, -3)); | ||
twoColorLineSeries1.Points.Add(new DataPoint(21, -6)); | ||
twoColorLineSeries1.Points.Add(new DataPoint(22, -13)); | ||
twoColorLineSeries1.Points.Add(new DataPoint(23, -10)); | ||
twoColorLineSeries1.Points.Add(new DataPoint(24, -10)); | ||
twoColorLineSeries1.Points.Add(new DataPoint(25, 0)); | ||
twoColorLineSeries1.Points.Add(new DataPoint(26, -4)); | ||
twoColorLineSeries1.Points.Add(new DataPoint(27, -5)); | ||
twoColorLineSeries1.Points.Add(new DataPoint(28, -4)); | ||
twoColorLineSeries1.Points.Add(new DataPoint(29, 3)); | ||
twoColorLineSeries1.Points.Add(new DataPoint(30, 0)); | ||
twoColorLineSeries1.Points.Add(new DataPoint(31, -5)); | ||
|
||
twoColorLineSeries1.Points.Add(new DataPoint(32, -20)); | ||
twoColorLineSeries1.Points.Add(new DataPoint(33, -20)); | ||
twoColorLineSeries1.Points.Add(new DataPoint(34, 20)); | ||
twoColorLineSeries1.Points.Add(new DataPoint(35, 20)); | ||
plotModel1.Series.Add(twoColorLineSeries1); | ||
return plotModel1; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,180 @@ | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
// <copyright file="ThreeColorLineSeries.cs" company="OxyPlot"> | ||
// Copyright (c) 2014 OxyPlot contributors | ||
// </copyright> | ||
// <summary> | ||
// The WPF wrapper for OxyPlot.ThreeColorLineSeries. | ||
// </summary> | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
|
||
namespace OxyPlot.Wpf | ||
{ | ||
using System.Windows; | ||
using System.Windows.Media; | ||
|
||
/// <summary> | ||
/// The WPF wrapper for OxyPlot.ThreeColorLineSeries. | ||
/// </summary> | ||
public class ThreeColorLineSeries : LineSeries | ||
{ | ||
/// <summary> | ||
/// Identifies the <see cref="ColorLo"/> dependency property. | ||
/// </summary> | ||
public static readonly DependencyProperty ColorLoProperty = DependencyProperty.Register( | ||
"ColorLo", typeof(Color), typeof(ThreeColorLineSeries), new UIPropertyMetadata(Colors.Blue, AppearanceChanged)); | ||
|
||
/// <summary> | ||
/// Identifies the <see cref="ColorHi"/> dependency property. | ||
/// </summary> | ||
public static readonly DependencyProperty ColorHiProperty = DependencyProperty.Register( | ||
"ColorHi", typeof(Color), typeof(ThreeColorLineSeries), new UIPropertyMetadata(Colors.Red, AppearanceChanged)); | ||
|
||
/// <summary> | ||
/// Identifies the <see cref="LimitLo"/> dependency property. | ||
/// </summary> | ||
public static readonly DependencyProperty LimitLoProperty = DependencyProperty.Register( | ||
"LimitLo", typeof(double), typeof(ThreeColorLineSeries), new UIPropertyMetadata(0.0, AppearanceChanged)); | ||
|
||
/// <summary> | ||
/// Identifies the <see cref="LimitHi"/> dependency property. | ||
/// </summary> | ||
public static readonly DependencyProperty LimitHiProperty = DependencyProperty.Register( | ||
"LimitHi", typeof(double), typeof(ThreeColorLineSeries), new UIPropertyMetadata(0.0, AppearanceChanged)); | ||
|
||
/// <summary> | ||
/// Identifies the <see cref="LineStyleLo"/> dependency property. | ||
/// </summary> | ||
public static readonly DependencyProperty LineStyleLoProperty = DependencyProperty.Register( | ||
"LineStyleLo", | ||
typeof(LineStyle), | ||
typeof(ThreeColorLineSeries), | ||
new UIPropertyMetadata(LineStyle.Solid, AppearanceChanged)); | ||
|
||
/// <summary> | ||
/// Identifies the <see cref="LineStyleHi"/> dependency property. | ||
/// </summary> | ||
public static readonly DependencyProperty LineStyleHiProperty = DependencyProperty.Register( | ||
"LineStyleHi", | ||
typeof(LineStyle), | ||
typeof(ThreeColorLineSeries), | ||
new UIPropertyMetadata(LineStyle.Solid, AppearanceChanged)); | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref = "ThreeColorLineSeries" /> class. | ||
/// </summary> | ||
public ThreeColorLineSeries() | ||
{ | ||
this.InternalSeries = new OxyPlot.Series.ThreeColorLineSeries(); | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets ColorLo. | ||
/// </summary> | ||
public Color ColorLo | ||
{ | ||
get | ||
{ | ||
return (Color)this.GetValue(ColorLoProperty); | ||
} | ||
|
||
set | ||
{ | ||
this.SetValue(ColorLoProperty, value); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets ColorHi. | ||
/// </summary> | ||
public Color ColorHi | ||
{ | ||
get | ||
{ | ||
return (Color)this.GetValue(ColorHiProperty); | ||
} | ||
|
||
set | ||
{ | ||
this.SetValue(ColorHiProperty, value); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets LimitLo. | ||
/// </summary> | ||
public double LimitLo | ||
{ | ||
get | ||
{ | ||
return (double)this.GetValue(LimitLoProperty); | ||
} | ||
|
||
set | ||
{ | ||
this.SetValue(LimitLoProperty, value); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets LimitHi. | ||
/// </summary> | ||
public double LimitHi | ||
{ | ||
get | ||
{ | ||
return (double)this.GetValue(LimitHiProperty); | ||
} | ||
|
||
set | ||
{ | ||
this.SetValue(LimitHiProperty, value); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets LineStyleLo. | ||
/// </summary> | ||
public LineStyle LineStyleLo | ||
{ | ||
get | ||
{ | ||
return (LineStyle)this.GetValue(LineStyleLoProperty); | ||
} | ||
|
||
set | ||
{ | ||
this.SetValue(LineStyleLoProperty, value); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets LineStyleHi. | ||
/// </summary> | ||
public LineStyle LineStyleHi | ||
{ | ||
get | ||
{ | ||
return (LineStyle)this.GetValue(LineStyleHiProperty); | ||
} | ||
|
||
set | ||
{ | ||
this.SetValue(LineStyleHiProperty, value); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Synchronizes the properties. | ||
/// </summary> | ||
/// <param name="series">The series.</param> | ||
protected override void SynchronizeProperties(OxyPlot.Series.Series series) | ||
{ | ||
base.SynchronizeProperties(series); | ||
var s = series as OxyPlot.Series.ThreeColorLineSeries; | ||
s.LimitLo = this.LimitLo; | ||
s.ColorLo = this.ColorLo.ToOxyColor(); | ||
s.LimitHi = this.LimitHi; | ||
s.ColorHi = this.ColorHi.ToOxyColor(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.