项目结构调整

This commit is contained in:
艾竹
2023-04-16 20:11:40 +08:00
parent cbfbf96033
commit 81f91f3f35
2124 changed files with 218 additions and 5516 deletions

View File

@@ -0,0 +1,540 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using LiveCharts.Charts;
using LiveCharts.Definitions.Charts;
using LiveCharts.Dtos;
using LiveCharts.Helpers;
namespace LiveCharts
{
/// <summary>
///
/// </summary>
public class AxisCore
{
private double _topLimit;
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="AxisCore"/> class.
/// </summary>
/// <param name="view">The view.</param>
public AxisCore(IAxisView view)
{
View = view;
CleanFactor = 3;
Cache = new Dictionary<double, SeparatorElementCore>();
LastAxisMax = null;
LastAxisMin = null;
}
#endregion
#region Public Properties
/// <summary>
/// Gets or sets the chart.
/// </summary>
/// <value>
/// The chart.
/// </value>
public ChartCore Chart { get; set; }
/// <summary>
/// Gets or sets the view.
/// </summary>
/// <value>
/// The view.
/// </value>
public IAxisView View { get; set; }
/// <summary>
/// Gets or sets the labels.
/// </summary>
/// <value>
/// The labels.
/// </value>
public IList<string> Labels { get; set; }
/// <summary>
/// Gets or sets the sections.
/// </summary>
/// <value>
/// The sections.
/// </value>
public List<AxisSectionCore> Sections { get; set; }
/// <summary>
/// Gets or sets the label formatter.
/// </summary>
/// <value>
/// The label formatter.
/// </value>
public Func<double, string> LabelFormatter { get; set; }
/// <summary>
/// Gets or sets the stroke thickness.
/// </summary>
/// <value>
/// The stroke thickness.
/// </value>
public double StrokeThickness { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [show labels].
/// </summary>
/// <value>
/// <c>true</c> if [show labels]; otherwise, <c>false</c>.
/// </value>
public bool ShowLabels { get; set; }
/// <summary>
/// Gets or sets the maximum value.
/// </summary>
/// <value>
/// The maximum value.
/// </value>
public double MaxValue { get; set; }
/// <summary>
/// Gets or sets the minimum value.
/// </summary>
/// <value>
/// The minimum value.
/// </value>
public double MinValue { get; set; }
/// <summary>
/// Gets or sets the title.
/// </summary>
/// <value>
/// The title.
/// </value>
public string Title { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [disable animations].
/// </summary>
/// <value>
/// <c>true</c> if [disable animations]; otherwise, <c>false</c>.
/// </value>
public bool DisableAnimations { get; set; }
/// <summary>
/// Gets or sets the position.
/// </summary>
/// <value>
/// The position.
/// </value>
public AxisPosition Position { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is merged.
/// </summary>
/// <value>
/// <c>true</c> if this instance is merged; otherwise, <c>false</c>.
/// </value>
public bool IsMerged { get; set; }
/// <summary>
/// Gets a value indicating whether [evaluates unit width].
/// </summary>
/// <value>
/// <c>true</c> if [evaluates unit width]; otherwise, <c>false</c>.
/// </value>
public bool EvaluatesUnitWidth { get; internal set; }
/// <summary>
/// Gets the current separators.
/// </summary>
/// <value>
/// The current separators.
/// </value>
public IEnumerable<SeparatorElementCore> CurrentSeparators
{
get { return Cache.Values; }
}
/// <summary>
/// Gets or sets the separator.
/// </summary>
/// <value>
/// The separator.
/// </value>
public SeparatorConfigurationCore Separator { get; set; }
/// <summary>
/// Gets the s.
/// </summary>
/// <value>
/// The s.
/// </value>
public double S { get; internal set; }
#endregion
#region Internal Properties
internal double Tab { get; set; }
internal double TopLimit
{
get { return _topLimit; }
set
{
_topLimit = value;
}
}
internal double BotLimit { get; set; }
internal double TopSeriesLimit { get; set; }
internal double BotSeriesLimit { get; set; }
internal double MaxPointRadius { get; set; }
internal double Magnitude { get; set; }
internal double CleanFactor { get; set; }
internal Dictionary<double, SeparatorElementCore> Cache { get; set; }
internal double? LastAxisMax { get; set; }
internal double? LastAxisMin { get; set; }
internal CoreRectangle LastPlotArea { get; set; }
internal int GarbageCollectorIndex { get; set; }
internal double PreviousTop { get; set; }
internal double PreviousBot { get; set; }
internal double FirstSeparator { get; private set; }
internal double LastSeparator { get; private set; }
#endregion
#region Public Methods
/// <summary>
/// Gets the formatter.
/// </summary>
/// <returns></returns>
public Func<double, string> GetFormatter()
{
return Formatter;
}
/// <summary>
/// Clears the separators.
/// </summary>
public void ClearSeparators()
{
foreach (var separator in Cache)
{
separator.Value.View.Clear(Chart.View);
}
Cache = new Dictionary<double, SeparatorElementCore>();
}
#endregion
#region Internal Methods
internal void CalculateSeparator(ChartCore chart, AxisOrientation source)
{
var range = TopLimit - BotLimit;
range = range <= 0 ? 1 : range;
//ToDO: Improve this according to current labels!
var separations = source == AxisOrientation.Y
? Math.Round(chart.ControlSize.Height / ((12) * CleanFactor), 0) // at least 3 font 12 labels per separator.
: Math.Round(chart.ControlSize.Width / (50 * CleanFactor), 0); // at least 150 pixels per separator.
separations = separations < 2 ? 2 : separations;
var minimum = range / separations;
Magnitude = Math.Pow(10, Math.Floor(Math.Log(minimum) / Math.Log(10)));
if (!double.IsNaN(Separator.Step))
{
S = Separator.Step;
return;
}
var residual = minimum / Magnitude;
double tick;
if (residual > 5)
tick = 10 * Magnitude;
else if (residual > 2)
tick = 5 * Magnitude;
else if (residual > 1)
tick = 2 * Magnitude;
else
tick = Magnitude;
S = tick;
if (Labels != null) S = S < 1 ? 1 : S;
}
internal virtual CoreMargin PrepareChart(AxisOrientation source, ChartCore chart)
{
if (!(Math.Abs(TopLimit - BotLimit) > S * .01) || !ShowLabels) return new CoreMargin();
CalculateSeparator(chart, source);
var f = GetFormatter();
var currentMargin = new CoreMargin();
var tolerance = S / 10;
InitializeGarbageCollector();
var m = !double.IsNaN(View.BarUnit)
? View.BarUnit
: (!double.IsNaN(View.Unit)
? View.Unit
: Magnitude);
var u = !double.IsNaN(View.BarUnit)
? View.BarUnit
: (!double.IsNaN(View.Unit)
? View.Unit
: 1);
if (TopLimit <= 0 && BotLimit < 0)
{
var l = TopLimit - (EvaluatesUnitWidth ? u : 0);
LastSeparator = l;
for (var i = l; i >= Math.Truncate(BotLimit / m) * m; i -= S)
{
FirstSeparator = i;
DrawSeparator(i, tolerance, currentMargin, f, source);
}
}
else
{
var l = Math.Truncate(BotLimit / m) * m;
FirstSeparator = l;
for (var i = l; i <= TopLimit - (EvaluatesUnitWidth ? u : 0); i += S)
{
LastSeparator = i;
DrawSeparator(i, tolerance, currentMargin, f, source);
}
}
return currentMargin;
}
internal void UpdateSeparators(AxisOrientation source, ChartCore chart, int axisIndex)
{
foreach (var element in Cache.Values.ToArray())
{
if (element.GarbageCollectorIndex < GarbageCollectorIndex)
{
element.State = SeparationState.Remove;
Cache.Remove(element.Key);
}
var toLine = ChartFunctions.ToPlotArea(element.Value, source, chart, axisIndex);
var direction = source == AxisOrientation.X ? 1 : -1;
toLine += EvaluatesUnitWidth ? direction * ChartFunctions.GetUnitWidth(source, chart, this) / 2 : 0;
var toLabel = toLine + element.View.LabelModel.GetOffsetBySource(source);
if (IsMerged)
{
const double padding = 4;
if (source == AxisOrientation.Y)
{
if (toLabel + element.View.LabelModel.ActualHeight >
chart.DrawMargin.Top + chart.DrawMargin.Height)
toLabel -= element.View.LabelModel.ActualHeight + padding;
}
else
{
if (toLabel + element.View.LabelModel.ActualWidth >
chart.DrawMargin.Left + chart.DrawMargin.Width)
toLabel -= element.View.LabelModel.ActualWidth + padding;
}
}
var labelTab = Tab;
labelTab += element.View.LabelModel.GetOffsetBySource(source.Invert());
switch (element.State)
{
case SeparationState.Remove:
if (!chart.View.DisableAnimations && !View.DisableAnimations)
{
element.View.Move(chart, this, source, axisIndex, toLabel, toLine, labelTab);
element.View.FadeOutAndRemove(chart);
}
else
{
element.View.Remove(chart);
}
break;
case SeparationState.Keep:
if (!chart.View.DisableAnimations && !View.DisableAnimations)
{
if (element.IsNew)
{
var toLinePrevious = FromPreviousState(element.Value, source, chart);
toLinePrevious += EvaluatesUnitWidth ? ChartFunctions.GetUnitWidth(source, chart, this) / 2 : 0;
var toLabelPrevious = toLinePrevious + element.View.LabelModel.GetOffsetBySource(source);
element.View.Place(chart, this, source, axisIndex, toLabelPrevious,
toLinePrevious, labelTab);
element.View.FadeIn(this, chart);
}
element.View.Move(chart, this, source, axisIndex, toLabel, toLine, labelTab);
}
else
{
element.View.Place(chart, this, source, axisIndex, toLabel, toLine, labelTab);
}
break;
case SeparationState.InitialAdd:
element.View.Place(chart, this, source, axisIndex, toLabel, toLine, labelTab);
break;
default:
throw new ArgumentOutOfRangeException();
}
}
LastAxisMax = TopLimit;
LastAxisMin = BotLimit;
LastPlotArea = new CoreRectangle(chart.DrawMargin.Left, chart.DrawMargin.Top,
chart.DrawMargin.Width, chart.DrawMargin.Height);
}
internal double FromPreviousState(double value, AxisOrientation source, ChartCore chart)
{
if (LastAxisMax == null) return 0;
var p1 = new CorePoint();
var p2 = new CorePoint();
if (source == AxisOrientation.Y)
{
p1.X = LastAxisMax ?? 0;
p1.Y = LastPlotArea.Top;
p2.X = LastAxisMin ?? 0;
p2.Y = LastPlotArea.Top + LastPlotArea.Height;
}
else
{
p1.X = LastAxisMax ?? 0;
p1.Y = LastPlotArea.Width + LastPlotArea.Left;
p2.X = LastAxisMin ?? 0;
p2.Y = LastPlotArea.Left;
}
var deltaX = p2.X - p1.X;
// ReSharper disable once CompareOfFloatsByEqualityOperator
var m = (p2.Y - p1.Y) / (deltaX == 0 ? double.MinValue : deltaX);
var d = m * (value - p1.X) + p1.Y;
return d;
}
#endregion
#region Protected Methods
/// <summary>
/// Initializes the garbage collector.
/// </summary>
protected void InitializeGarbageCollector()
{
if (GarbageCollectorIndex == int.MaxValue)
{
foreach (var value in Cache.Values)
{
value.GarbageCollectorIndex = 0;
}
GarbageCollectorIndex = 0;
}
GarbageCollectorIndex++;
}
#endregion
#region Private Methods
private void DrawSeparator(double i, double tolerance, CoreMargin currentMargin, Func<double, string> f, AxisOrientation source)
{
if (i < BotLimit) return;
SeparatorElementCore asc;
var key = Math.Round(i / tolerance) * tolerance;
if (!Cache.TryGetValue(key, out asc))
{
asc = new SeparatorElementCore { IsNew = true };
Cache[key] = asc;
}
else
{
asc.IsNew = false;
}
View.RenderSeparator(asc, Chart);
asc.Key = key;
asc.Value = i;
asc.GarbageCollectorIndex = GarbageCollectorIndex;
var labelsMargin = asc.View.UpdateLabel(f(i), this, source);
currentMargin.Width = labelsMargin.TakenWidth > currentMargin.Width
? labelsMargin.TakenWidth
: currentMargin.Width;
currentMargin.Height = labelsMargin.TakenHeight > currentMargin.Height
? labelsMargin.TakenHeight
: currentMargin.Height;
currentMargin.Left = labelsMargin.Left > currentMargin.Left
? labelsMargin.Left
: currentMargin.Left;
currentMargin.Right = labelsMargin.Right > currentMargin.Right
? labelsMargin.Right
: currentMargin.Right;
currentMargin.Top = labelsMargin.Top > currentMargin.Top
? labelsMargin.Top
: currentMargin.Top;
currentMargin.Bottom = labelsMargin.Bottom > currentMargin.Bottom
? labelsMargin.Bottom
: currentMargin.Bottom;
if (LastAxisMax == null)
{
asc.State = SeparationState.InitialAdd;
return;
}
asc.State = SeparationState.Keep;
}
private string Formatter(double x)
{
if (Labels == null)
{
return LabelFormatter == null
? x.ToString(CultureInfo.InvariantCulture)
: LabelFormatter(x);
}
if (x < 0) x *= -1;
return Labels.Count > x && x >= 0
? Labels[(int)x]
: "";
}
#endregion
}
}

View File

@@ -0,0 +1,44 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts
{
/// <summary>
/// Cartesian Axis orientation
/// </summary>
public enum AxisOrientation
{
/// <summary>
/// Unknown orientation
/// </summary>
None,
/// <summary>
/// Horizontal (X)
/// </summary>
X,
/// <summary>
/// Vertical (Y)
/// </summary>
Y
}
}

View File

@@ -0,0 +1,39 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts
{
/// <summary>
/// Axis position
/// </summary>
public enum AxisPosition
{
/// <summary>
/// Left for Y axis, Bottom for X axis
/// </summary>
LeftBottom,
/// <summary>
/// Right for Y axis, Top for X axis
/// </summary>
RightTop
}
}

View File

@@ -0,0 +1,72 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using LiveCharts.Charts;
using LiveCharts.Definitions.Charts;
namespace LiveCharts
{
/// <summary>
///
/// </summary>
public class AxisSectionCore
{
/// <summary>
/// Initializes a new instance of the <see cref="AxisSectionCore"/> class.
/// </summary>
/// <param name="view">The view.</param>
/// <param name="chart">The chart.</param>
public AxisSectionCore(IAxisSectionView view, ChartCore chart)
{
View = view;
Chart = chart;
}
/// <summary>
/// Gets or sets the view.
/// </summary>
/// <value>
/// The view.
/// </value>
public IAxisSectionView View { get; set; }
/// <summary>
/// Gets or sets the source.
/// </summary>
/// <value>
/// The source.
/// </value>
public AxisOrientation Source { get; set; }
/// <summary>
/// Gets or sets the index of the axis.
/// </summary>
/// <value>
/// The index of the axis.
/// </value>
public int AxisIndex { get; set; }
/// <summary>
/// Gets or sets the chart.
/// </summary>
/// <value>
/// The chart.
/// </value>
public ChartCore Chart { get; set; }
}
}

View File

@@ -0,0 +1,50 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System;
namespace LiveCharts
{
/// <summary>
/// Describes where a label should be placed
/// </summary>
public enum BarLabelPosition
{
/// <summary>
/// Places a label at the top of a bar
/// </summary>
Top,
/// <summary>
/// Places a labels inside the bar
/// </summary>
[Obsolete("Instead use BarLabelPosition.Parallel")]
Merged,
/// <summary>
/// Places a labels in a parallel orientation to the bar height.
/// </summary>
Parallel,
/// <summary>
/// Places a labels in a perpendicular orientation to the bar height.
/// </summary>
Perpendicular
}
}

View File

@@ -0,0 +1,21 @@
namespace LiveChartsCore
{
public class BezierData
{
public BezierData()
{
}
public BezierData(LvcPoint point)
{
Point1 = point;
Point2 = point;
Point3 = point;
}
public LvcPoint Point1 { get; set; }
public LvcPoint Point2 { get; set; }
public LvcPoint Point3 { get; set; }
public LvcPoint StartPoint { get; set; }
}
}

View File

@@ -0,0 +1,311 @@
//MIT License(MIT)
//copyright(c) 2016 Alberto Rodriguez
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files ("Software"), to deal
//in Software without restriction, including without limitation rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of Software, and to permit persons to whom Software is
//furnished to do so, subject to following conditions:
//above copyright notice and this permission notice shall be included in all
//copies or substantial portions of Software.
//SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH SOFTWARE OR USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System;
using System.Collections.Generic;
using System.Linq;
using LiveCharts.Charts;
using LiveCharts.Definitions.Charts;
using LiveCharts.Dtos;
namespace LiveCharts
{
/// <summary>
/// Contains useful methods to apply to a chart
/// </summary>
public static class ChartFunctions
{
/// <summary>
/// Converts from chart values to chart control size.
/// </summary>
/// <param name="value">value to scale</param>
/// <param name="source">axis orientation to scale value at</param>
/// <param name="chart">chart model to scale value at</param>
/// <param name="axis">axis index in collection of chart.axis</param>
/// <returns></returns>
public static double ToPlotArea(double value, AxisOrientation source, ChartCore chart, int axis = 0)
{
var p1 = new CorePoint();
var p2 = new CorePoint();
if (source == AxisOrientation.Y)
{
p1.X = chart.AxisY[axis].TopLimit;
p1.Y = chart.DrawMargin.Top;
p2.X = chart.AxisY[axis].BotLimit;
p2.Y = chart.DrawMargin.Top + chart.DrawMargin.Height;
}
else
{
p1.X = chart.AxisX[axis].TopLimit;
p1.Y = chart.DrawMargin.Width + chart.DrawMargin.Left;
p2.X = chart.AxisX[axis].BotLimit;
p2.Y = chart.DrawMargin.Left;
}
var deltaX = p2.X - p1.X;
// ReSharper disable once CompareOfFloatsByEqualityOperator
var m = (p2.Y - p1.Y)/(deltaX == 0 ? double.MinValue : deltaX);
return m * (value - p1.X) + p1.Y;
}
/// <summary>
/// Converts from chart values to chart control size.
/// </summary>
/// <param name="value">value to scale</param>
/// <param name="source">axis orientation to scale value at</param>
/// <param name="chart">chart model to scale value at</param>
/// <param name="axis">axis model instance</param>
/// <returns></returns>
public static double ToPlotArea(double value, AxisOrientation source, ChartCore chart, AxisCore axis)
{
var p1 = new CorePoint();
var p2 = new CorePoint();
if (source == AxisOrientation.Y)
{
p1.X = axis.TopLimit;
p1.Y = chart.DrawMargin.Top;
p2.X = axis.BotLimit;
p2.Y = chart.DrawMargin.Top + chart.DrawMargin.Height;
}
else
{
p1.X = axis.TopLimit;
p1.Y = chart.DrawMargin.Width + chart.DrawMargin.Left;
p2.X = axis.BotLimit;
p2.Y = chart.DrawMargin.Left;
}
var deltaX = p2.X - p1.X;
// ReSharper disable once CompareOfFloatsByEqualityOperator
var m = (p2.Y - p1.Y) / (deltaX == 0 ? double.MinValue : deltaX);
return m * (value - p1.X) + p1.Y;
}
/// <summary>
/// Converts from chart control size to chart values.
/// </summary>
/// <param name="value">value to scale</param>
/// <param name="source">axis orientation to scale value at</param>
/// <param name="chart">chart model to scale value at</param>
/// <param name="axis">axis index in collection of chart.axis</param>
/// <returns></returns>
public static double FromPlotArea(double value, AxisOrientation source, ChartCore chart, int axis = 0)
{
var p1 = new CorePoint();
var p2 = new CorePoint();
if (source == AxisOrientation.Y)
{
p1.X = chart.AxisY[axis].TopLimit;
p1.Y = chart.DrawMargin.Top;
p2.X = chart.AxisY[axis].BotLimit;
p2.Y = chart.DrawMargin.Top + chart.DrawMargin.Height;
}
else
{
p1.X = chart.AxisX[axis].TopLimit;
p1.Y = chart.DrawMargin.Width + chart.DrawMargin.Left;
p2.X = chart.AxisX[axis].BotLimit;
p2.Y = chart.DrawMargin.Left;
}
var deltaX = p2.X - p1.X;
// ReSharper disable once CompareOfFloatsByEqualityOperator
var m = (p2.Y - p1.Y) / (deltaX == 0 ? double.MinValue : deltaX);
return (value + m * p1.X - p1.Y) / m;
}
/// <summary>
/// Converts from chart values to chart draw margin size.
/// </summary>
/// <param name="value">value to scale</param>
/// <param name="source">axis orientation</param>
/// <param name="chart">chart model to scale the value at</param>
/// <param name="axis">axis instance to scale the value at</param>
/// <returns></returns>
public static double ToDrawMargin(double value, AxisOrientation source, ChartCore chart, int axis = 0)
{
var o = source == AxisOrientation.X
? chart.DrawMargin.Left
: chart.DrawMargin.Top;
return ToPlotArea(value, source, chart, axis) - o;
}
/// <summary>
/// Converts from chart values to chart draw margin size.
/// </summary>
/// <param name="value">value to scale</param>
/// <param name="source">axis orientation</param>
/// <param name="chart">chart model to scale the value at</param>
/// <param name="axis">axis instance to scale the value at</param>
/// <returns></returns>
public static double ToDrawMargin(double value, AxisOrientation source, ChartCore chart, AxisCore axis)
{
var o = source == AxisOrientation.X
? chart.DrawMargin.Left
: chart.DrawMargin.Top;
return ToPlotArea(value, source, chart, axis) - o;
}
/// <summary>
/// Converts from chart values to chart draw margin size.
/// </summary>
/// <param name="point">point to scale</param>
/// <param name="axisXIndex">axis orientation</param>
/// <param name="axisYIndex">axis instance to scale the value at</param>
/// <param name="chart">chart model to scale the value at</param>
/// <returns></returns>
public static CorePoint ToDrawMargin(ChartPoint point, int axisXIndex, int axisYIndex, ChartCore chart)
{
return new CorePoint(
ToDrawMargin(point.X, AxisOrientation.X, chart, axisXIndex),
ToDrawMargin(point.Y, AxisOrientation.Y, chart, axisYIndex));
}
/// <summary>
/// Gets the width of a unit in the chart
/// </summary>
/// <param name="source">axis orientation</param>
/// <param name="chart">chart model to get the scale at</param>
/// <param name="axis">axis index in the axes collection</param>
/// <returns></returns>
public static double GetUnitWidth(AxisOrientation source, ChartCore chart, int axis = 0)
{
return GetUnitWidth(source, chart,
(source == AxisOrientation.X ? chart.AxisX : chart.AxisY)[axis]);
}
/// <summary>
/// Gets the width of a unit in the chart
/// </summary>
/// <param name="source">axis orientation</param>
/// <param name="chart">chart model to get the scale at</param>
/// <param name="axis">axis instance</param>
/// <returns></returns>
public static double GetUnitWidth(AxisOrientation source, ChartCore chart, AxisCore axis)
{
double min;
double u = !double.IsNaN(axis.View.BarUnit)
? axis.View.BarUnit
: (!double.IsNaN(axis.View.Unit)
? axis.View.Unit
: 1);
if (source == AxisOrientation.Y)
{
min = axis.BotLimit;
return ToDrawMargin(min, AxisOrientation.Y, chart, axis) -
ToDrawMargin(min + u, AxisOrientation.Y, chart, axis);
}
min = axis.BotLimit;
return ToDrawMargin(min + u, AxisOrientation.X, chart, axis) -
ToDrawMargin(min, AxisOrientation.X, chart, axis);
}
/// <summary>
/// Returns data in the chart according to:
/// </summary>
/// <param name="senderPoint">point that was hovered</param>
/// <param name="chart">chart model to get the data from</param>
/// <param name="selectionMode">selection mode</param>
/// <returns></returns>
public static TooltipDataViewModel GetTooltipData(ChartPoint senderPoint, ChartCore chart, TooltipSelectionMode selectionMode)
{
var ax = chart.AxisX[senderPoint.SeriesView.ScalesXAt];
var ay = chart.AxisY[senderPoint.SeriesView.ScalesYAt];
switch (selectionMode)
{
case TooltipSelectionMode.OnlySender:
return new TooltipDataViewModel
{
XFormatter = ax.GetFormatter(),
YFormatter = ay.GetFormatter(),
Points = new List<ChartPoint> {senderPoint},
Shares = null
};
case TooltipSelectionMode.SharedXValues:
var tx = Math.Abs(FromPlotArea(1, AxisOrientation.X, chart, senderPoint.SeriesView.ScalesXAt)
- FromPlotArea(2, AxisOrientation.X, chart, senderPoint.SeriesView.ScalesXAt)) * .01;
return new TooltipDataViewModel
{
XFormatter = ax.GetFormatter(),
YFormatter = ay.GetFormatter(),
Points = chart.View.ActualSeries.Where(x => x.ScalesXAt == senderPoint.SeriesView.ScalesXAt)
.SelectMany(x => x.Values.GetPoints(x))
.Where(x => Math.Abs(x.X - senderPoint.X) < tx),
Shares = (chart.View is IPieChart) ? null : (double?) senderPoint.X
};
case TooltipSelectionMode.SharedYValues:
var ty = Math.Abs(FromPlotArea(1, AxisOrientation.Y, chart, senderPoint.SeriesView.ScalesYAt)
- FromPlotArea(2, AxisOrientation.Y, chart, senderPoint.SeriesView.ScalesYAt)) * .01;
return new TooltipDataViewModel
{
XFormatter = ax.GetFormatter(),
YFormatter = ay.GetFormatter(),
Points = chart.View.ActualSeries.Where(x => x.ScalesYAt == senderPoint.SeriesView.ScalesYAt)
.SelectMany(x => x.Values.GetPoints(x))
.Where(x => Math.Abs(x.Y - senderPoint.Y) < ty),
Shares = senderPoint.Y
};
case TooltipSelectionMode.SharedXInSeries:
var txs = Math.Abs(FromPlotArea(1, AxisOrientation.X, chart, senderPoint.SeriesView.ScalesXAt)
- FromPlotArea(2, AxisOrientation.X, chart, senderPoint.SeriesView.ScalesXAt)) * .01;
return new TooltipDataViewModel
{
XFormatter = ax.GetFormatter(),
YFormatter = ay.GetFormatter(),
Points = senderPoint.SeriesView.ActualValues.GetPoints(senderPoint.SeriesView)
.Where(x => Math.Abs(x.X - senderPoint.X) < txs),
Shares = senderPoint.X
};
case TooltipSelectionMode.SharedYInSeries:
var tys = Math.Abs(FromPlotArea(1, AxisOrientation.Y, chart, senderPoint.SeriesView.ScalesYAt)
- FromPlotArea(2, AxisOrientation.Y, chart, senderPoint.SeriesView.ScalesYAt)) * .01;
return new TooltipDataViewModel
{
XFormatter = ax.GetFormatter(),
YFormatter = ay.GetFormatter(),
Points = senderPoint.SeriesView.ActualValues.GetPoints(senderPoint.SeriesView)
.Where(x => Math.Abs(x.Y - senderPoint.Y) < tys),
Shares = senderPoint.Y
};
default:
throw new ArgumentOutOfRangeException();
}
}
}
}

View File

@@ -0,0 +1,188 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using LiveCharts.Definitions.Charts;
using LiveCharts.Definitions.Points;
using LiveCharts.Definitions.Series;
using LiveCharts.Dtos;
namespace LiveCharts
{
/// <summary>
/// Defines a point in the chart
/// </summary>
public class ChartPoint
{
#region Cartesian
/// <summary>
/// Gets the X point value
/// </summary>
public double X { get; internal set; }
/// <summary>
/// Gets the Y point value
/// </summary>
public double Y { get; internal set; }
#endregion
/// <summary>
/// Gets the Gantt x start value
/// </summary>
public double XStart { get; set; }
/// <summary>
/// Gets the Gantt y start value
/// </summary>
public double YStart { get; set; }
internal bool EvaluatesGantt { get; set; }
#region Gantt
#endregion
#region Weighted
/// <summary>
/// Gets the Weight of the point
/// </summary>
public double Weight { get; internal set; }
#endregion
#region stacked
/// <summary>
/// Gets where the stacked value started from
/// </summary>
public double From { get; internal set; }
/// <summary>
/// Gets where the stacked value finishes
/// </summary>
public double To { get; internal set; }
/// <summary>
/// Get the total sum of the stacked elements
/// </summary>
public double Sum { get; internal set; }
/// <summary>
/// Get the participation of the point in the stacked elements
/// </summary>
public double Participation { get; internal set; }
/// <summary>
/// gets the stacked participation of a point
/// </summary>
public double StackedParticipation { get; internal set; }
#endregion
#region Financial
/// <summary>
/// Gets the Open value of the point
/// </summary>
public double Open { get; internal set; }
/// <summary>
/// Gets the High value of the point
/// </summary>
public double High { get; internal set; }
/// <summary>
/// Gets the Low value of the point
/// </summary>
public double Low { get; internal set; }
/// <summary>
/// Gets the Close value of the point
/// </summary>
public double Close { get; internal set; }
#endregion
#region Polar
/// <summary>
/// Gets the Radius of a point
/// </summary>
public double Radius { get; internal set; }
/// <summary>
/// Gets the angle of a point
/// </summary>
public double Angle { get; internal set; }
#endregion
#region Appearance
/// <summary>
/// Gets the Fill brush of this point, this property overrides series Fill property
/// </summary>
public object Fill { get; internal set; }
/// <summary>
/// Gets the Stroke brush of this point, this property overrides series Stroke property
/// </summary>
public object Stroke { get; internal set; }
#endregion
/// <summary>
/// Gets the coordinate where the value is placed at chart
/// </summary>
public CorePoint ChartLocation { get; internal set; }
/// <summary>
/// Gets the index of this point in the chart
/// </summary>
public int Key { get; internal set; }
/// <summary>
/// Gets the object where the chart pulled the point
/// </summary>
public object Instance { get; internal set; }
/// <summary >
/// Gets or sets the view of this chart point
/// </summary>
public IChartPointView View { get; internal set; }
/// <summary>
/// Gets the series where the point belongs to
/// </summary>
public ISeriesView SeriesView { get; internal set; }
/// <summary>
/// Gets the chart view.
/// </summary>
/// <value>
/// The chart view.
/// </value>
public IChartView ChartView { get { return SeriesView.Model.Chart.View; } }
internal double Gci { get; set; }
}
}

View File

@@ -0,0 +1,131 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System;
using LiveCharts.Charts;
using LiveCharts.Definitions.Series;
using LiveCharts.Helpers;
namespace LiveCharts
{
/// <summary>
///
/// </summary>
public class ChartUpdater
{
/// <summary>
/// Gets or sets the chart.
/// </summary>
/// <value>
/// The chart.
/// </value>
public ChartCore Chart { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is updating.
/// </summary>
/// <value>
/// <c>true</c> if this instance is updating; otherwise, <c>false</c>.
/// </value>
public bool IsUpdating { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [restart view requested].
/// </summary>
/// <value>
/// <c>true</c> if [restart view requested]; otherwise, <c>false</c>.
/// </value>
public bool RestartViewRequested { get; set; }
private void InitializeSeriesView(ISeriesView seriesView)
{
Chart.View.EnsureElementBelongsToCurrentView(seriesView);
}
/// <summary>
/// Runs the specified restart view.
/// </summary>
/// <param name="restartView">if set to <c>true</c> [restart view].</param>
/// <param name="updateNow">if set to <c>true</c> [update now].</param>
/// <exception cref="System.NotImplementedException"></exception>
public virtual void Run(bool restartView = false, bool updateNow = false)
{
throw new NotImplementedException();
}
/// <summary>
/// Updates the frequency.
/// </summary>
/// <param name="freq">The freq.</param>
/// <exception cref="System.NotImplementedException"></exception>
public virtual void UpdateFrequency(TimeSpan freq)
{
throw new NotImplementedException();
}
/// <summary>
/// Updates the specified restarts animations.
/// </summary>
/// <param name="restartsAnimations">if set to <c>true</c> [restarts animations].</param>
/// <param name="force"></param>
protected void Update(bool restartsAnimations = false, bool force = false)
{
if (Chart.View.UpdaterState == UpdaterState.Paused) return;
if (!force && !Chart.View.IsControlLoaded) return;
if (restartsAnimations)
Chart.View.ActualSeries.ForEach(s =>
{
if (s.ActualValues == null) return;
s.ActualValues.GetPoints(s).ForEach(p =>
{
if (p == null || p.View == null) return;
p.View.RemoveFromView(Chart);
p.View = null;
});
});
Chart.AxisX = Chart.View.MapXAxes(Chart);
Chart.AxisY = Chart.View.MapYAxes(Chart);
foreach (var series in Chart.View.ActualSeries)
{
InitializeSeriesView(series);
series.ActualValues.Initialize(series);
series.InitializeColors();
series.DrawSpecializedElements();
}
Chart.PrepareAxes();
Chart.RunSpecializedChartComponents();
foreach (var series in Chart.View.ActualSeries)
{
series.OnSeriesUpdateStart();
series.ActualValues.InitializeStep(series);
series.Model.Update();
series.ActualValues.CollectGarbage(series);
series.OnSeriesUpdatedFinish();
series.PlaceSpecializedElements();
}
}
}
}

View File

@@ -0,0 +1,354 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System.Collections.Generic;
using System.Linq;
using LiveCharts.Charts;
using LiveCharts.Configurations;
using LiveCharts.Definitions.Series;
using LiveCharts.Dtos;
using LiveCharts.Helpers;
#if NET45
using System.Reflection;
#endif
namespace LiveCharts
{
/// <summary>
/// Creates a collection of chart values
/// </summary>
/// <typeparam name="T">Type to plot, notice you could need to configure the type.</typeparam>
public class ChartValues<T> : NoisyCollection<T>, IChartValues
{
#region Constructors
/// <summary>
/// Initializes a new instance of chart values
/// </summary>
public ChartValues()
{
Trackers = new Dictionary<ISeriesView, PointTracker>();
NoisyCollectionChanged += OnChanged;
}
/// <summary>
/// Initializes a new instance of chart values, with a given collection
/// </summary>
public ChartValues(IEnumerable<T> collection) : base(collection)
{
Trackers = new Dictionary<ISeriesView, PointTracker>();
NoisyCollectionChanged += OnChanged;
}
#endregion
#region Properties
private IPointEvaluator<T> DefaultConfiguration { get; set; }
private Dictionary<ISeriesView, PointTracker> Trackers { get; set; }
#endregion
#region Public Methods
/// <summary>
/// Evaluates the limits in the chart values
/// </summary>
public void Initialize(ISeriesView seriesView)
{
var config = GetConfig(seriesView);
if (config == null) return;
var xMin = double.PositiveInfinity;
var xMax = double.NegativeInfinity;
var yMin = double.PositiveInfinity;
var yMax = double.NegativeInfinity;
var wMin = double.PositiveInfinity;
var wMax = double.NegativeInfinity;
var tracker = GetTracker(seriesView);
var cp = new ChartPoint();
var ax = seriesView.Model.Chart.AxisX[seriesView.ScalesXAt];
var ay = seriesView.Model.Chart.AxisY[seriesView.ScalesYAt];
double fx = double.IsNaN(ax.MinValue) ? double.NegativeInfinity : ax.MinValue,
tx = double.IsNaN(ax.MaxValue) ? double.PositiveInfinity : ax.MaxValue,
fy = double.IsNaN(ay.MinValue) ? double.NegativeInfinity : ay.MinValue,
ty = double.IsNaN(ay.MaxValue) ? double.PositiveInfinity : ay.MaxValue;
var isHorizontal = seriesView.Model.SeriesOrientation == SeriesOrientation.Horizontal;
var index = 0;
foreach(var item in this)
{
config.Evaluate(index, item, cp);
index++;
if (isHorizontal)
{
if (cp.X < fx || cp.X > tx) continue;
}
else
{
if (cp.Y < fy || cp.Y > ty) continue;
}
if (seriesView is IFinancialSeriesView)
{
if (cp.X < xMin) xMin = cp.X;
if (cp.X > xMax) xMax = cp.X;
if (cp.Low < yMin) yMin = cp.Low;
if (cp.High > yMax) yMax = cp.High;
if (cp.Weight < wMin) wMin = cp.Weight;
if (cp.Weight > wMax) wMax = cp.Weight;
}
else if (seriesView is IScatterSeriesView || seriesView is IHeatSeriesView)
{
if (cp.X < xMin) xMin = cp.X;
if (cp.X > xMax) xMax = cp.X;
if (cp.Y < yMin) yMin = cp.Y;
if (cp.Y > yMax) yMax = cp.Y;
if (cp.Weight < wMin) wMin = cp.Weight;
if (cp.Weight > wMax) wMax = cp.Weight;
}
else
{
if (cp.X < xMin) xMin = cp.X;
if (cp.X > xMax) xMax = cp.X;
if (cp.Y < yMin) yMin = cp.Y;
if (cp.Y > yMax) yMax = cp.Y;
}
}
tracker.XLimit = new CoreLimit(double.IsInfinity(xMin)
? 0
: xMin, double.IsInfinity(yMin) ? 1 : xMax);
tracker.YLimit = new CoreLimit(double.IsInfinity(yMin)
? 0
: yMin, double.IsInfinity(yMax) ? 1 : yMax);
tracker.WLimit = new CoreLimit(double.IsInfinity(wMin)
? 0
: wMin, double.IsInfinity(wMax) ? 1 : wMax);
}
/// <summary>
/// Gets the current chart points in the view, the view is required as an argument, because an instance of IChartValues could hold many ISeriesView instances.
/// </summary>
/// <param name="seriesView">The series view</param>
/// <returns></returns>
public IEnumerable<ChartPoint> GetPoints(ISeriesView seriesView)
{
if (seriesView == null) yield break;
var config = GetConfig(seriesView);
#if NET40
var isClass = typeof(T).IsClass;
var isObservable = isClass && typeof(IObservableChartPoint).IsAssignableFrom(typeof(T));
#endif
#if NET45
var isClass = typeof(T).GetTypeInfo().IsClass;
var isObservable = isClass &&
typeof(IObservableChartPoint).GetTypeInfo().IsAssignableFrom(typeof(T).GetTypeInfo());
#endif
var tracker = GetTracker(seriesView);
var gci = tracker.Gci;
var index = 0;
foreach (var value in this)
{
if (isObservable)
{
var observable = (IObservableChartPoint)value;
if (observable != null)
{
observable.PointChanged -= ObservableOnPointChanged;
observable.PointChanged += ObservableOnPointChanged;
}
}
var cp = GetChartPoint(isClass, tracker, index, value);
cp.Gci = gci;
cp.Instance = value;
cp.Key = index;
cp.SeriesView = seriesView;
config.Evaluate(index, value, cp);
index++;
yield return cp;
}
}
/// <summary>
/// Initializes the garbage collector
/// </summary>
public void InitializeStep(ISeriesView series)
{
ValidateGarbageCollector(series);
GetTracker(series).Gci++;
}
/// <summary>
/// Collects the unnecessary values
/// </summary>
public void CollectGarbage(ISeriesView seriesView)
{
#if NET40
var isclass = typeof(T).IsClass;
#endif
#if NET45
var isclass = typeof(T).GetTypeInfo().IsClass;
#endif
var tracker = GetTracker(seriesView);
foreach (var garbage in GetGarbagePoints(seriesView).ToList())
{
if (garbage.View != null) //yes null, double.Nan Values, will generate null views.
garbage.View.RemoveFromView(seriesView.Model.Chart);
if (!isclass)
{
tracker.Indexed.Remove(garbage.Key);
}
else
{
tracker.Referenced.Remove(garbage.Instance);
}
}
}
/// <summary>
/// Gets series that owns the values
/// </summary>
/// <param name="view"></param>
/// <returns></returns>
public PointTracker GetTracker(ISeriesView view)
{
PointTracker tracker;
if (Trackers.TryGetValue(view, out tracker)) return tracker;
tracker = new PointTracker();
Trackers[view] = tracker;
return tracker;
}
#endregion
#region Privates
private IPointEvaluator<T> GetConfig(ISeriesView view)
{
//Trying to get the user defined configuration...
//series == null means that chart values are null, and LiveCharts
//could not set the Series Instance tho the current chart values...
if (view == null || view.Model.SeriesCollection == null) return null;
var config =
(view.Configuration ?? view.Model.SeriesCollection.Configuration) as IPointEvaluator<T>;
if (config != null) return config;
return DefaultConfiguration ??
(DefaultConfiguration =
ChartCore.Configurations.GetConfig<T>(view.Model.SeriesOrientation) as IPointEvaluator<T>);
}
private static ChartPoint GetChartPoint(bool isClass, PointTracker tracker, int index, T value)
{
ChartPoint cp;
if (!isClass)
{
if (tracker.Indexed.TryGetValue(index, out cp)) return cp;
cp = new ChartPoint
{
Instance = value,
Key = index
};
tracker.Indexed[index] = cp;
}
else
{
if (tracker.Referenced.TryGetValue(value, out cp)) return cp;
cp = new ChartPoint
{
Instance = value,
Key = index
};
tracker.Referenced[value] = cp;
}
return cp;
}
private void ObservableOnPointChanged()
{
Trackers.Keys.ForEach(x => x.Model.Chart.Updater.Run());
}
private IEnumerable<ChartPoint> GetGarbagePoints(ISeriesView view)
{
var tracker = GetTracker(view);
return tracker.Indexed.Values.Where(x => IsGarbage(x, tracker)).Concat(
tracker.Referenced.Values.Where(x => IsGarbage(x, tracker)));
}
private void ValidateGarbageCollector(ISeriesView view)
{
var tracker = GetTracker(view);
if (tracker.Gci != int.MaxValue) return;
tracker.Gci = 0;
foreach (var point in tracker.Indexed.Values.Concat(tracker.Referenced.Values))
point.Gci = 0;
}
private static bool IsGarbage(ChartPoint point, PointTracker tracker)
{
return point.Gci < tracker.Gci
|| double.IsNaN(point.X) || double.IsNaN(point.Y);
}
private void OnChanged(IEnumerable<T> oldItems, IEnumerable<T> newItems)
{
if (Trackers.Keys.All(x => x != null && x.Model.Chart != null))
Trackers.Keys.ForEach(x => x.Model.Chart.Updater.Run());
}
#endregion
}
}

View File

@@ -0,0 +1,234 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System;
using System.Collections.Generic;
using LiveCharts.Configurations;
using LiveCharts.Defaults;
using LiveCharts.Helpers;
namespace LiveCharts
{
/// <summary>
/// Global LiveCharts configuration
/// </summary>
public class Charting
{
private static readonly Dictionary<Type, ConfigWrapper> Configurations;
#region Constructors
//Lets define some default configurations, all charts should be able to detect any of these types and plot
//them correctly
static Charting()
{
Configurations = new Dictionary<Type, ConfigWrapper>();
// Live.Charts can plot any type, yes even any class defined by yourself.
// you just need to tell the charts how to plot it.
// for example the XY Mapper exposes an X and Y method,
// for example .X( "mapper" ) asks for the function to get the value of a point in X, same with Y
// live charts will inject a value and an index
// the value will be of type <T> and the index is only the value of the point in the array.
//the SeriesMappers class is just a reminder of the configurations that we have, it actually just
//returns a new instance of the related configuration
//a configuration is only a holder for the mappers.
//lets configure <int>
For<int>(Mappers.Xy<int>()
.X((value, index) => index) //use the index of the item in the array as X
.Y(value => value), SeriesOrientation.Horizontal); //use the value (of type int integer this case) as Y
For<int>(Mappers.Xy<int>()
.X(value => value) //use the value (int) as X
.Y((value, index) => index), SeriesOrientation.Vertical); //use the index of the item in the array as Y
//OK now lets configure a class I defined, the ObservablePoint class, it only has 2 properties, X and Y
For<ObservablePoint>(Mappers.Xy<ObservablePoint>() //in this case value is of type <ObservablePoint>
.X(value => value.X) //use the X property as X
.Y(value => value.Y)); //use the Y property as Y
//easy, now live charts know how to plot an ObservablePoint class and integers.
//OK, now lets use another mapper, in this case we are going to configure a class for a PolarChart
//polar chart requires a Radius and an Angle instead of X and Y
//so we will just pull the Mappers.Polar configuration
//and specify which property to use as Radius and which one as Angle
//in this case the PolarPoint class that I defined only contains these 2 properties.
//so it is really easy, now value is of type Polar point, because we said so when: SeriesMappers.Polar<PolarPoint>()
For<PolarPoint>(Mappers.Polar<PolarPoint>()
.Radius(value => value.Radius) //use the radius property as radius for the plotting
.Angle(value => value.Angle)); //use the angle property as angle for the plotting
//now a more complex situation
//the OhclPoint is ready to plot financial points,
//the financial series requires a Open, High, Low, and Close values at least
//that is just by definition of a CandleStick series
//so I created a OhclPoint class, and used the Financial mapper:
//and again the OhclPoint class only contains those 4 properties
//we just mapped them correctly and LiveCharts will know how to handle this class.
//the DateTime for now its tricky....
//I will explain better later if i do not find a better solution...
For<OhlcPoint>(Mappers.Financial<OhlcPoint>()
.X((value, index) => index)
.Open(value => value.Open)
.High(value => value.High)
.Low(value => value.Low)
.Close(value => value.Close), SeriesOrientation.Horizontal);
For<double>(Mappers.Xy<double>()
.X((value, index) => index)
.Y(value => value), SeriesOrientation.Horizontal);
For<double>(Mappers.Xy<double>()
.X(value => value)
.Y((value, index) => index), SeriesOrientation.Vertical);
For<decimal>(Mappers.Xy<decimal>()
.X((value, index) => index)
.Y(value => (double) value), SeriesOrientation.Horizontal);
For<decimal>(Mappers.Xy<decimal>()
.X(value => (double) value)
.Y((value, index) => index), SeriesOrientation.Vertical);
For<short>(Mappers.Xy<short>()
.X((value, index) => index)
.Y(value => value), SeriesOrientation.Horizontal);
For<short>(Mappers.Xy<short>()
.X(value => value)
.Y((value, index) => index), SeriesOrientation.Vertical);
For<float>(Mappers.Xy<float>()
.X((value, index) => index)
.Y(value => value), SeriesOrientation.Horizontal);
For<float>(Mappers.Xy<float>()
.X(value => value)
.Y((value, index) => index), SeriesOrientation.Vertical);
For<long>(Mappers.Xy<long>()
.X((value, index) => index)
.Y(value => value), SeriesOrientation.Horizontal);
For<long>(Mappers.Xy<long>()
.X(value => value)
.Y((value, index) => index), SeriesOrientation.Vertical);
For<ScatterPoint>(Mappers.Weighted<ScatterPoint>()
.X(value => value.X)
.Y(value => value.Y)
.Weight(value => value.Weight));
For<HeatPoint>(Mappers.Weighted<HeatPoint>()
.X(value => value.X)
.Y(value => value.Y)
.Weight(value => value.Weight));
For<ObservableValue>(Mappers.Xy<ObservableValue>()
.X((value, index) => index)
.Y(value => value.Value),
SeriesOrientation.Horizontal);
For<ObservableValue>(Mappers.Xy<ObservableValue>()
.X(value => value.Value)
.Y((value, index) => index),
SeriesOrientation.Vertical);
For<DateTimePoint>(Mappers.Xy<DateTimePoint>()
.X(value => value.DateTime.Ticks)
.Y(value => value.Value), SeriesOrientation.Horizontal);
For<DateTimePoint>(Mappers.Xy<DateTimePoint>()
.X(value => value.Value)
.Y(value => value.DateTime.Ticks), SeriesOrientation.Vertical);
For<GanttPoint>(Mappers.Gantt<GanttPoint>()
.X((v, i) => -i)
.YStart(v => v.StartPoint)
.Y(v => v.EndPoint), SeriesOrientation.Horizontal);
For<GanttPoint>(Mappers.Gantt<GanttPoint>()
.Y((v, i) => -i)
.XStart(v => v.StartPoint)
.X(v => v.EndPoint), SeriesOrientation.Vertical);
}
/// <summary>
/// Saves a type mapper globally.
/// </summary>
/// <typeparam name="T">Type to configure</typeparam>
/// <param name="config">mapper</param>
/// <param name="orientation">mapper orientation</param>
public static void For<T>(object config, SeriesOrientation orientation = SeriesOrientation.All)
{
ConfigWrapper wrapper;
var t = typeof (T);
if (!Configurations.TryGetValue(t, out wrapper))
{
wrapper = new ConfigWrapper();
Configurations[t] = wrapper;
}
if (orientation == SeriesOrientation.All)
{
wrapper.VerticalConfig = config;
wrapper.HorizontalConfig = config;
return;
}
if (orientation == SeriesOrientation.Horizontal) wrapper.HorizontalConfig = config;
else wrapper.VerticalConfig = config;
}
#endregion
/// <summary>
/// Gets the configuration of a given type and orientation
/// </summary>
/// <typeparam name="T">type to look for</typeparam>
/// <param name="orientation">orientation to look for</param>
/// <returns></returns>
public object GetConfig<T>(SeriesOrientation orientation = SeriesOrientation.Horizontal)
{
ConfigWrapper wrapper;
if (!Configurations.TryGetValue(typeof(T), out wrapper))
throw new LiveChartsException("LiveCharts does not know how to plot " + typeof(T).Name + ", " +
"you can either, use an already configured type " +
"or configure this type you are trying to use, " +
"For more info see " +
"http://lvcharts.net/App/examples/v1/wpf/Types%20and%20Configuration");
return orientation == SeriesOrientation.Horizontal || orientation == SeriesOrientation.All
? wrapper.HorizontalConfig
: wrapper.VerticalConfig;
}
}
internal class ConfigWrapper
{
public object HorizontalConfig { get; set; }
public object VerticalConfig { get; set; }
}
}

View File

@@ -0,0 +1,323 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System;
using System.Collections.Generic;
using System.Linq;
using LiveCharts.Definitions.Charts;
using LiveCharts.Definitions.Series;
using LiveCharts.Dtos;
using LiveCharts.Helpers;
namespace LiveCharts.Charts
{
/// <summary>
/// Chart Model
/// </summary>
public class CartesianChartCore : ChartCore
{
#region Constructors
/// <summary>
/// Initializes Chart model
/// </summary>
/// <param name="view">The view.</param>
/// <param name="updater">The updater.</param>
public CartesianChartCore(IChartView view, ChartUpdater updater) : base(view, updater)
{
updater.Chart = this;
}
#endregion
#region Publics
/// <summary>
/// Prepares Chart Axes
/// </summary>
public override void PrepareAxes()
{
base.PrepareAxes();
if (View.ActualSeries.Any(x => !(x.Model is ICartesianSeries)))
throw new LiveChartsException(
"There is a invalid series in the series collection, " +
"verify that all the series implement ICartesianSeries.");
var cartesianSeries = View.ActualSeries.Select(x => x.Model).Cast<ICartesianSeries>().ToArray();
for (var index = 0; index < AxisX.Count; index++)
{
var xi = AxisX[index];
xi.CalculateSeparator(this, AxisOrientation.X);
// ReSharper disable once AccessToModifiedClosure
SetAxisLimits(xi, cartesianSeries.Where(x => x.View.ScalesXAt == index).ToArray(), AxisOrientation.X);
if (Math.Abs(xi.BotLimit - xi.TopLimit) < xi.S * .01)
{
if (Math.Abs(xi.PreviousBot - xi.PreviousTop) < xi.S * .01)
{
if (double.IsNaN(xi.MinValue)) xi.BotLimit -= xi.S;
else xi.BotLimit = xi.MinValue;
if (double.IsNaN(xi.MaxValue)) xi.TopLimit += xi.S;
else xi.TopLimit = xi.MaxValue;
if (Math.Abs(xi.BotLimit - xi.TopLimit) < xi.S * .01 && !View.IsInDesignMode)
throw new LiveChartsException("One axis has an invalid range, it is or it is " +
"tends to zero, please ensure your axis has a valid " +
"range");
}
else
{
xi.BotLimit = xi.PreviousBot;
xi.TopLimit = xi.PreviousTop;
}
}
xi.PreviousBot = xi.BotLimit;
xi.PreviousTop = xi.TopLimit;
}
for (var index = 0; index < AxisY.Count; index++)
{
var yi = AxisY[index];
yi.CalculateSeparator(this, AxisOrientation.Y);
// ReSharper disable once AccessToModifiedClosure
SetAxisLimits(yi, cartesianSeries.Where(x => x.View.ScalesYAt == index).ToArray(), AxisOrientation.Y);
if (Math.Abs(yi.BotLimit - yi.TopLimit) < yi.S * .01)
{
if (Math.Abs(yi.PreviousBot - yi.PreviousTop) < yi.S * .01)
{
if (double.IsNaN(yi.MinValue)) yi.BotLimit -= yi.S;
else yi.BotLimit = yi.MinValue;
if (double.IsNaN(yi.MaxValue)) yi.TopLimit += yi.S;
else yi.TopLimit = yi.MaxValue;
if (Math.Abs(yi.BotLimit - yi.TopLimit) < yi.S * .01)
throw new LiveChartsException("One axis has an invalid range, it is or it " +
"tends to zero, please ensure your axis has a valid " +
"range");
}
else
{
yi.BotLimit = yi.PreviousBot;
yi.TopLimit = yi.PreviousTop;
}
}
yi.PreviousBot = yi.BotLimit;
yi.PreviousTop = yi.TopLimit;
}
PrepareSeries();
CalculateComponentsAndMargin();
DrawOrUpdateSections();
AreComponentsLoaded = true;
}
/// <summary>
/// Runs the specialized chart components.
/// </summary>
public override void RunSpecializedChartComponents()
{
foreach (var visualElement in ((ICartesianChart) View).VisualElements)
{
visualElement.AddOrMove(this);
}
}
/// <summary>
/// Draws the or update sections.
/// </summary>
public void DrawOrUpdateSections()
{
for (var index = 0; index < AxisX.Count; index++)
{
var xi = AxisX[index];
foreach (var section in xi.Sections)
{
section.AxisIndex = index;
section.Source = AxisOrientation.X;
section.View.DrawOrMove(AxisOrientation.X, index);
}
}
for (var index = 0; index < AxisY.Count; index++)
{
var yi = AxisY[index];
foreach (var section in yi.Sections)
{
section.AxisIndex = index;
section.Source = AxisOrientation.Y;
section.View.DrawOrMove(AxisOrientation.Y, index);
}
}
}
#endregion
#region Privates
private static void SetAxisLimits(AxisCore ax, IList<ICartesianSeries> series, AxisOrientation orientation)
{
var first = new CoreLimit();
var firstR = 0d;
if (series.Count > 0)
{
first = orientation == AxisOrientation.X
? new CoreLimit(series[0].GetMinX(ax), series[0].GetMaxX(ax))
: new CoreLimit(series[0].GetMinY(ax), series[0].GetMaxY(ax));
var view = series[0].View as IAreaPoint;
firstR = view != null ? view.GetPointDiameter() : 0;
}
// [ max, min, pointRadius ]
var boundries = new[] { first.Max, first.Min, firstR };
for (var index = 1; index < series.Count; index++)
{
var cartesianSeries = series[index];
var limit = orientation == AxisOrientation.X
? new CoreLimit(cartesianSeries.GetMinX(ax), cartesianSeries.GetMaxX(ax))
: new CoreLimit(cartesianSeries.GetMinY(ax), cartesianSeries.GetMaxY(ax));
var view = cartesianSeries.View as IAreaPoint;
var radius = view != null ? view.GetPointDiameter() : 0;
if (limit.Max > boundries[0]) boundries[0] = limit.Max;
if (limit.Min < boundries[1]) boundries[1] = limit.Min;
if (radius > boundries[2]) boundries[2] = radius;
}
ax.TopSeriesLimit = boundries[0];
ax.BotSeriesLimit = boundries[1];
ax.TopLimit = double.IsNaN(ax.MaxValue) ? boundries[0] : ax.MaxValue;
ax.BotLimit = double.IsNaN(ax.MinValue) ? boundries[1] : ax.MinValue;
ax.MaxPointRadius = boundries[2];
}
private void PrepareSeries()
{
PrepareUnitWidth();
PrepareWeight();
PrepareStackedColumns();
PrepareStackedRows();
PrepareStackedAreas();
PrepareVerticalStackedAreas();
}
private void PrepareWeight()
{
if (!View.ActualSeries.Any(x => x is IScatterSeriesView || x is IHeatSeriesView)) return;
var vs = View.ActualSeries
.Select(x => x.ActualValues.GetTracker(x).WLimit)
.DefaultIfEmpty(new CoreLimit()).ToArray();
WLimit = new CoreLimit(vs.Select(x => x.Min).DefaultIfEmpty(0).Min(),
vs.Select(x => x.Max).DefaultIfEmpty(0).Max());
}
private void PrepareUnitWidth()
{
foreach (var series in View.ActualSeries)
{
if (series is IStackedColumnSeriesView || series is IColumnSeriesView ||
series is IFinancialSeriesView || series is IHeatSeriesView)
{
AxisX[series.ScalesXAt].EvaluatesUnitWidth = true;
}
if (series is IStackedRowSeriesView || series is IRowSeriesView || series is IHeatSeriesView)
{
AxisY[series.ScalesYAt].EvaluatesUnitWidth = true;
}
}
}
private void PrepareStackedColumns()
{
if (!View.ActualSeries.Any(x => x is IStackedColumnSeriesView)) return;
var isPercentage =
View.ActualSeries.Any(x => x is IStackModelableSeriesView && x is IStackedColumnSeriesView &&
((IStackModelableSeriesView) x).StackMode == StackMode.Percentage);
foreach (var group in View.ActualSeries.OfType<IStackedColumnSeriesView>().GroupBy(x => x.ScalesYAt))
{
StackPoints(group, AxisOrientation.Y, group.Key, isPercentage
? StackMode.Percentage : StackMode.Values);
}
}
private void PrepareStackedRows()
{
if (!View.ActualSeries.Any(x => x is IStackedRowSeriesView)) return;
var isPercentage =
View.ActualSeries.Any(x => x is IStackModelableSeriesView && x is IStackedRowSeriesView &&
((IStackModelableSeriesView) x).StackMode == StackMode.Percentage);
foreach (var group in View.ActualSeries.OfType<IStackedRowSeriesView>().GroupBy(x => x.ScalesXAt))
{
StackPoints(group, AxisOrientation.X, group.Key, isPercentage ? StackMode.Percentage : StackMode.Values);
}
}
private void PrepareStackedAreas()
{
if (!View.ActualSeries.Any(x => x is IStackedAreaSeriesView)) return;
var isPercentage =
View.ActualSeries.Any(x => x is IStackModelableSeriesView && x is IStackedAreaSeriesView &&
((IStackModelableSeriesView) x).StackMode == StackMode.Percentage);
foreach (var group in View.ActualSeries.OfType<IStackedAreaSeriesView>().GroupBy(x => x.ScalesYAt))
{
StackPoints(group, AxisOrientation.Y, group.Key, isPercentage ? StackMode.Percentage : StackMode.Values);
}
}
private void PrepareVerticalStackedAreas()
{
if (!View.ActualSeries.Any(x => x is IVerticalStackedAreaSeriesView)) return;
var isPercentage =
View.ActualSeries.Any(x => x is IStackModelableSeriesView && x is IVerticalStackedAreaSeriesView &&
((IStackModelableSeriesView) x).StackMode == StackMode.Percentage);
foreach (var group in View.ActualSeries.OfType<IVerticalStackedAreaSeriesView>().GroupBy(x => x.ScalesXAt))
{
StackPoints(group, AxisOrientation.X, group.Key, isPercentage ? StackMode.Percentage : StackMode.Values);
}
}
#endregion
}
}

View File

@@ -0,0 +1,751 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Linq;
using LiveCharts.Definitions.Charts;
using LiveCharts.Definitions.Series;
using LiveCharts.Dtos;
namespace LiveCharts.Charts
{
/// <summary>
///
/// </summary>
public abstract class ChartCore
{
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="ChartCore"/> class.
/// </summary>
/// <param name="view">The view.</param>
/// <param name="updater">The updater.</param>
protected ChartCore(IChartView view, ChartUpdater updater)
{
View = view;
Updater = updater;
DrawMargin = new CoreRectangle();
DrawMargin.SetHeight += view.SetDrawMarginHeight;
DrawMargin.SetWidth += view.SetDrawMarginWidth;
DrawMargin.SetTop += view.SetDrawMarginTop;
DrawMargin.SetLeft += view.SetDrawMarginLeft;
}
/// <summary>
/// Initializes the <see cref="ChartCore"/> class.
/// </summary>
static ChartCore()
{
Configurations = new Charting();
}
#endregion
#region Properties
/// <summary>
/// Gets or sets the configurations.
/// </summary>
/// <value>
/// The configurations.
/// </value>
public static Charting Configurations { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [series initialized].
/// </summary>
/// <value>
/// <c>true</c> if [series initialized]; otherwise, <c>false</c>.
/// </value>
public bool SeriesInitialized { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [are components loaded].
/// </summary>
/// <value>
/// <c>true</c> if [are components loaded]; otherwise, <c>false</c>.
/// </value>
public bool AreComponentsLoaded { get; set; }
/// <summary>
/// Gets or sets the view.
/// </summary>
/// <value>
/// The view.
/// </value>
public IChartView View { get; set; }
/// <summary>
/// Gets or sets the updater.
/// </summary>
/// <value>
/// The updater.
/// </value>
public ChartUpdater Updater { get; set; }
/// <summary>
/// Gets or sets the size of the control.
/// </summary>
/// <value>
/// The size of the control.
/// </value>
public CoreSize ControlSize { get; set; }
/// <summary>
/// Gets or sets the draw margin.
/// </summary>
/// <value>
/// The draw margin.
/// </value>
public CoreRectangle DrawMargin { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance has unitary points.
/// </summary>
/// <value>
/// <c>true</c> if this instance has unitary points; otherwise, <c>false</c>.
/// </value>
public bool HasUnitaryPoints { get; set; }
/// <summary>
/// Gets a value indicating whether [requires hover shape].
/// </summary>
/// <value>
/// <c>true</c> if [requires hover shape]; otherwise, <c>false</c>.
/// </value>
public bool RequiresHoverShape
{
get
{
return View != null &&
(View.HasTooltip || View.HasDataClickEventAttached || View.Hoverable);
}
}
/// <summary>
/// Gets or sets the axis x.
/// </summary>
/// <value>
/// The axis x.
/// </value>
public List<AxisCore> AxisX { get; set; }
/// <summary>
/// Gets or sets the axis y.
/// </summary>
/// <value>
/// The axis y.
/// </value>
public List<AxisCore> AxisY { get; set; }
/// <summary>
/// Gets or sets the x limit.
/// </summary>
/// <value>
/// The x limit.
/// </value>
public CoreLimit XLimit { get; set; }
/// <summary>
/// Gets or sets the y limit.
/// </summary>
/// <value>
/// The y limit.
/// </value>
public CoreLimit YLimit { get; set; }
/// <summary>
/// Gets or sets the w limit.
/// </summary>
/// <value>
/// The w limit.
/// </value>
public CoreLimit WLimit { get; set; }
/// <summary>
/// Gets or sets the index of the current color.
/// </summary>
/// <value>
/// The index of the current color.
/// </value>
public int CurrentColorIndex { get; set; }
/// <summary>
/// Gets or sets the pan origin.
/// </summary>
/// <value>
/// The pan origin.
/// </value>
public CorePoint PanOrigin { get; set; }
#endregion
#region Public Methods
/// <summary>
/// Prepares the axes.
/// </summary>
public virtual void PrepareAxes()
{
for (var index = 0; index < AxisX.Count; index++)
{
SetAxisLimits(
AxisX[index],
View.ActualSeries
// ReSharper disable once AccessToModifiedClosure
.Where(series => series.Values != null && series.ScalesXAt == index).ToArray(),
AxisOrientation.X);
}
for (var index = 0; index < AxisY.Count; index++)
{
SetAxisLimits(
AxisY[index],
View.ActualSeries
// ReSharper disable once AccessToModifiedClosure
.Where(series => series.Values != null && series.ScalesYAt == index).ToArray(),
AxisOrientation.Y);
}
}
/// <summary>
/// Runs the specialized chart components.
/// </summary>
public virtual void RunSpecializedChartComponents()
{
}
/// <summary>
/// Calculates the components and margin.
/// </summary>
public void CalculateComponentsAndMargin()
{
var curSize = new CoreRectangle(0, 0, ControlSize.Width, ControlSize.Height);
curSize = PlaceLegend(curSize);
const double padding = 4;
for (int index = 0; index < AxisY.Count; index++)
{
var ax = AxisY[index];
var titleSize = ax.View.UpdateTitle(this, -90d);
var biggest = ax.PrepareChart(AxisOrientation.Y, this);
var x = curSize.Left;
if (ax.Position == AxisPosition.LeftBottom)
{
ax.View.SetTitleLeft(x);
curSize.Left += titleSize.Height + biggest.Width + padding;
curSize.Width -= (titleSize.Height + biggest.Width + padding);
ax.Tab = curSize.Left;
}
else
{
ax.View.SetTitleLeft(x + curSize.Width - titleSize.Height);
curSize.Width -= (titleSize.Height + biggest.Width + padding);
ax.Tab = curSize.Left + curSize.Width;
}
var uw = ax.EvaluatesUnitWidth ? ChartFunctions.GetUnitWidth(AxisOrientation.Y, this, index)/2 : 0;
var topE = biggest.Top - uw;
if (topE> curSize.Top)
{
var dif = topE - curSize.Top;
curSize.Top += dif;
curSize.Height -= dif;
}
var botE = biggest.Bottom - uw;
if (botE > ControlSize.Height - (curSize.Top + curSize.Height))
{
var dif = botE - (ControlSize.Height - (curSize.Top + curSize.Height));
curSize.Height -= dif;
}
}
for (var index = 0; index < AxisX.Count; index++)
{
var xi = AxisX[index];
var titleSize = xi.View.UpdateTitle(this);
var biggest = xi.PrepareChart(AxisOrientation.X, this);
var top = curSize.Top;
if (xi.Position == AxisPosition.LeftBottom)
{
xi.View.SetTitleTop(top + curSize.Height - titleSize.Height);
curSize.Height -= (titleSize.Height + biggest.Height);
xi.Tab = curSize.Top + curSize.Height;
}
else
{
xi.View.SetTitleTop(top);
curSize.Top += titleSize.Height + biggest.Height;
curSize.Height -= (titleSize.Height + biggest.Height);
xi.Tab = curSize.Top;
}
//Notice the unit width is not exact at this point...
var uw = xi.EvaluatesUnitWidth ? ChartFunctions.GetUnitWidth(AxisOrientation.X, this, index)/2 : 0;
var leftE = biggest.Left - uw > 0 ? biggest.Left - uw : 0;
if (leftE > curSize.Left)
{
var dif = leftE - curSize.Left;
curSize.Left += dif;
curSize.Width -= dif;
foreach (var correctedAxis in AxisY
.Where(correctedAxis => correctedAxis.Position == AxisPosition.LeftBottom))
{
correctedAxis.Tab += dif;
}
}
var rightE = biggest.Right - uw > 0 ? biggest.Right - uw : 0;
if (rightE > ControlSize.Width - (curSize.Left + curSize.Width))
{
var dif = rightE - (ControlSize.Width - (curSize.Left + curSize.Width));
curSize.Width -= dif;
foreach (var correctedAxis in AxisY
.Where(correctedAxis => correctedAxis.Position == AxisPosition.RightTop))
{
correctedAxis.Tab -= dif;
}
}
}
DrawMargin.Top = curSize.Top;
DrawMargin.Left = curSize.Left;
DrawMargin.Width = curSize.Width;
DrawMargin.Height = curSize.Height;
for (var index = 0; index < AxisY.Count; index++)
{
var ax = AxisY[index];
var pr = ChartFunctions.FromPlotArea(ax.MaxPointRadius, AxisOrientation.Y, this, index) -
ChartFunctions.FromPlotArea(0, AxisOrientation.Y, this, index);
if (!double.IsNaN(pr))
{
ax.BotLimit += pr;
ax.TopLimit -= pr;
}
ax.UpdateSeparators(AxisOrientation.Y, this, index);
ax.View.SetTitleTop(curSize.Top + curSize.Height*.5 + ax.View.GetLabelSize().Width*.5);
}
for (var index = 0; index < AxisX.Count; index++)
{
var xi = AxisX[index];
var pr = ChartFunctions.FromPlotArea(xi.MaxPointRadius, AxisOrientation.X, this, index) -
ChartFunctions.FromPlotArea(0, AxisOrientation.X, this, index);
if (!double.IsNaN(pr))
{
xi.BotLimit -= pr;
xi.TopLimit += pr;
}
xi.UpdateSeparators(AxisOrientation.X, this, index);
xi.View.SetTitleLeft(curSize.Left + curSize.Width*.5 - xi.View.GetLabelSize().Width*.5);
}
}
/// <summary>
/// Places the legend.
/// </summary>
/// <param name="drawMargin">The draw margin.</param>
/// <returns></returns>
/// <exception cref="System.ArgumentOutOfRangeException"></exception>
public CoreRectangle PlaceLegend(CoreRectangle drawMargin)
{
var legendSize = View.LoadLegend();
const int padding = 10;
switch (View.LegendLocation)
{
case LegendLocation.None:
View.HideLegend();
break;
case LegendLocation.Top:
drawMargin.Top += legendSize.Height;
drawMargin.Height -= legendSize.Height;
View.ShowLegend(new CorePoint(ControlSize.Width * .5 - legendSize.Width * .5, 0));
break;
case LegendLocation.Bottom:
var bot = new CorePoint(ControlSize.Width*.5 - legendSize.Width*.5,
ControlSize.Height - legendSize.Height);
drawMargin.Height -= legendSize.Height;
View.ShowLegend(new CorePoint(bot.X, ControlSize.Height - legendSize.Height));
break;
case LegendLocation.Left:
drawMargin.Left = drawMargin.Left + legendSize.Width;
View.ShowLegend(new CorePoint(0, ControlSize.Height*.5 - legendSize.Height*.5));
break;
case LegendLocation.Right:
drawMargin.Width -= legendSize.Width + padding;
View.ShowLegend(new CorePoint(ControlSize.Width - legendSize.Width,
ControlSize.Height*.5 - legendSize.Height*.5));
break;
default:
throw new ArgumentOutOfRangeException();
}
return drawMargin;
}
/// <summary>
/// Zooms the in.
/// </summary>
/// <param name="pivot">The pivot.</param>
public void ZoomIn(CorePoint pivot)
{
if (AxisX == null || AxisY == null) return;
View.HideTooltip();
var speed = View.ZoomingSpeed < 0.1 ? 0.1 : (View.ZoomingSpeed > 0.95 ? 0.95 : View.ZoomingSpeed);
if (View.Zoom == ZoomingOptions.X || View.Zoom == ZoomingOptions.Xy)
{
for (var index = 0; index < AxisX.Count; index++)
{
var xi = AxisX[index];
var px = ChartFunctions.FromPlotArea(pivot.X, AxisOrientation.X, this, index);
var max = double.IsNaN(xi.View.MaxValue) ? xi.TopLimit : xi.View.MaxValue;
var min = double.IsNaN(xi.View.MinValue) ? xi.BotLimit : xi.View.MinValue;
var l = max - min;
var rMin = (px - min) / l;
var rMax = 1 - rMin;
var target = l * speed;
if (target < xi.View.MinRange) return;
var mint = px - target * rMin;
var maxt = px + target * rMax;
xi.View.SetRange(mint, maxt);
}
}
if (View.Zoom == ZoomingOptions.Y || View.Zoom == ZoomingOptions.Xy)
{
for (var index = 0; index < AxisY.Count; index++)
{
var ax = AxisY[index];
var py = ChartFunctions.FromPlotArea(pivot.Y, AxisOrientation.Y, this, index);
var max = double.IsNaN(ax.View.MaxValue) ? ax.TopLimit : ax.View.MaxValue;
var min = double.IsNaN(ax.View.MinValue) ? ax.BotLimit : ax.View.MinValue;
var l = max - min;
var rMin = (py - min) / l;
var rMax = 1 - rMin;
var target = l * speed;
if (target < ax.View.MinRange) return;
var mint = py - target * rMin;
var maxt = py + target * rMax;
ax.View.SetRange(mint, maxt);
}
}
}
/// <summary>
/// Zooms the out.
/// </summary>
/// <param name="pivot">The pivot.</param>
public void ZoomOut(CorePoint pivot)
{
View.HideTooltip();
var speed = View.ZoomingSpeed < 0.1 ? 0.1 : (View.ZoomingSpeed > 0.95 ? 0.95 : View.ZoomingSpeed);
if (View.Zoom == ZoomingOptions.X || View.Zoom == ZoomingOptions.Xy)
{
for (var index = 0; index < AxisX.Count; index++)
{
var xi = AxisX[index];
var px = ChartFunctions.FromPlotArea(pivot.X, AxisOrientation.X, this, index);
var max = double.IsNaN(xi.View.MaxValue) ? xi.TopLimit : xi.View.MaxValue;
var min = double.IsNaN(xi.View.MinValue) ? xi.BotLimit : xi.View.MinValue;
var l = max - min;
var rMin = (px - min) / l;
var rMax = 1 - rMin;
var target = l * (1 / speed);
if (target > xi.View.MaxRange) return;
var mint = px- target * rMin;
var maxt = px + target * rMax;
xi.View.SetRange(mint, maxt);
}
}
if (View.Zoom == ZoomingOptions.Y || View.Zoom == ZoomingOptions.Xy)
{
for (var index = 0; index < AxisY.Count; index++)
{
var ax = AxisY[index];
var py = ChartFunctions.FromPlotArea(pivot.Y, AxisOrientation.Y, this, index);
var max = double.IsNaN(ax.View.MaxValue) ? ax.TopLimit : ax.View.MaxValue;
var min = double.IsNaN(ax.View.MinValue) ? ax.BotLimit : ax.View.MinValue;
var l = max - min;
var rMin = (py - min) / l;
var rMax = 1 - rMin;
var target = l * (1 / speed);
if (target > ax.View.MaxRange) return;
var mint = py - target * rMin;
var maxt = py + target * rMax;
ax.View.SetRange(mint, maxt);
}
}
}
/// <summary>
/// Clears the zoom.
/// </summary>
public void ClearZoom()
{
foreach (var xi in AxisX) xi.View.SetRange(double.NaN, double.NaN);
foreach (var ax in AxisY) ax.View.SetRange(double.NaN, double.NaN);
}
/// <summary>
/// Drags the specified delta.
/// </summary>
/// <param name="delta">The delta.</param>
public void Drag(CorePoint delta)
{
if (View.Pan == PanningOptions.Unset && View.Zoom == ZoomingOptions.None ||
View.Pan == PanningOptions.None) return;
var px = View.Pan == PanningOptions.Unset &&
(View.Zoom == ZoomingOptions.X || View.Zoom == ZoomingOptions.Xy);
px = px || View.Pan == PanningOptions.X || View.Pan == PanningOptions.Xy;
if (px)
{
for (var index = 0; index < AxisX.Count; index++)
{
var xi = AxisX[index];
var dx = ChartFunctions.FromPlotArea(delta.X, AxisOrientation.X, this, index) -
ChartFunctions.FromPlotArea(0, AxisOrientation.X, this, index);
xi.View.SetRange((double.IsNaN(xi.View.MinValue) ? xi.BotLimit : xi.View.MinValue) + dx,
(double.IsNaN(xi.View.MaxValue) ? xi.TopLimit : xi.View.MaxValue) + dx);
}
}
var py = View.Pan == PanningOptions.Unset &&
(View.Zoom == ZoomingOptions.Y || View.Zoom == ZoomingOptions.Xy);
py = py || View.Pan == PanningOptions.Y || View.Pan == PanningOptions.Xy;
if (py)
{
for (var index = 0; index < AxisY.Count; index++)
{
var ax = AxisY[index];
var dy = ChartFunctions.FromPlotArea(delta.Y, AxisOrientation.Y, this, index) -
ChartFunctions.FromPlotArea(0, AxisOrientation.Y, this, index);
ax.View.SetRange((double.IsNaN(ax.View.MinValue) ? ax.BotLimit : ax.View.MinValue) + dy,
(double.IsNaN(ax.View.MaxValue) ? ax.TopLimit : ax.View.MaxValue) + dy);
}
}
}
#endregion
#region Protected
/// <summary>
/// Stacks the points.
/// </summary>
/// <param name="stackables">The stackables.</param>
/// <param name="stackAt">The stack at.</param>
/// <param name="stackIndex">Index of the stack.</param>
/// <param name="mode">The mode.</param>
protected void StackPoints(IEnumerable<ISeriesView> stackables, AxisOrientation stackAt, int stackIndex,
StackMode mode = StackMode.Values)
{
var stackedColumns = stackables.SelectMany(x => x.ActualValues.GetPoints(x))
.GroupBy(x => stackAt == AxisOrientation.X ? x.Y : x.X);
double mostLeft = 0, mostRight = 0;
foreach (var column in stackedColumns)
{
double sumLeft = 0, sumRight = 0;
foreach (var item in column)
{
var s = stackAt == AxisOrientation.X ? item.X : item.Y;
if (s < 0)
sumLeft += s;
else
sumRight += s;
}
var lastLeft = 0d;
var lastRight = 0d;
var leftPart = 0d;
var rightPart = 0d;
foreach (var point in column)
{
var pulled = stackAt == AxisOrientation.X ? point.X : point.Y;
//notice using (pulled < 0) or (pulled <= 0) could cause an issue similar to
//https://github.com/beto-rodriguez/Live-Charts/issues/231
//from that issue I changed <= to <
//only because it is more common to use positive values than negative
//you could face a similar issue if you are stacking only negative values
//a work around is forcing (pulled < 0) to be true,
//instead of using zero values, use -0.000000001/
if (pulled < 0)
{
point.From = lastLeft;
point.To = lastLeft + pulled;
point.Sum = sumLeft;
point.Participation = (point.To - point.From) / point.Sum;
point.Participation = double.IsNaN(point.Participation)
? 0
: point.Participation;
leftPart += point.Participation;
point.StackedParticipation = leftPart;
lastLeft = point.To;
}
else
{
point.From = lastRight;
point.To = lastRight + pulled;
point.Sum = sumRight;
point.Participation = (point.To - point.From) / point.Sum;
point.Participation = double.IsNaN(point.Participation)
? 0
: point.Participation;
rightPart += point.Participation;
point.StackedParticipation = rightPart;
lastRight = point.To;
}
}
if (sumLeft < mostLeft) mostLeft = sumLeft;
if (sumRight > mostRight) mostRight = sumRight;
}
if (stackAt == AxisOrientation.X)
{
var ax = AxisX[stackIndex];
if (mode == StackMode.Percentage)
{
if (double.IsNaN(ax.MinValue)) ax.BotLimit = 0;
if (double.IsNaN(ax.MaxValue)) ax.TopLimit = 1;
}
else
{
if (mostLeft < ax.BotLimit)
// ReSharper disable once CompareOfFloatsByEqualityOperator
if (double.IsNaN(ax.MinValue))
ax.BotLimit = mostLeft == 0
? 0
: ((int) (mostLeft/ax.S) - 1)*ax.S;
if (mostRight > ax.TopLimit)
// ReSharper disable once CompareOfFloatsByEqualityOperator
if (double.IsNaN(ax.MaxValue))
ax.TopLimit = mostRight == 0
? 0
: ((int) (mostRight/ax.S) + 1)*ax.S;
}
}
if (stackAt == AxisOrientation.Y)
{
var ay = AxisY[stackIndex];
if (mode == StackMode.Percentage)
{
if (double.IsNaN(ay.MinValue)) ay.BotLimit = 0;
if (double.IsNaN(ay.MaxValue)) ay.TopLimit = 1;
}
else
{
if (mostLeft < ay.BotLimit)
// ReSharper disable once CompareOfFloatsByEqualityOperator
if (double.IsNaN(ay.MinValue))
ay.BotLimit = mostLeft == 0
? 0
: ((int) (mostLeft/ay.S) - 1)*ay.S;
if (mostRight > ay.TopLimit)
// ReSharper disable once CompareOfFloatsByEqualityOperator
if (double.IsNaN(ay.MaxValue))
ay.TopLimit = mostRight == 0
? 0
: ((int) (mostRight/ay.S) + 1)*ay.S;
}
}
}
#endregion
#region Privates
private static void SetAxisLimits(AxisCore ax, IList<ISeriesView> series, AxisOrientation orientation)
{
var first = new CoreLimit();
var firstR = 0d;
if (series.Count > 0)
{
first = orientation == AxisOrientation.X
? series[0].Values.GetTracker(series[0]).XLimit
: series[0].Values.GetTracker(series[0]).YLimit;
var view = series[0] as IAreaPoint;
firstR = view != null ? view.GetPointDiameter() : 0;
}
// [ max, min, pointRadius ]
var boundries = new[] {first.Max, first.Min, firstR};
for (var index = 1; index < series.Count; index++)
{
var seriesView = series[index];
var tracker = seriesView.Values.GetTracker(seriesView);
var limit = orientation == AxisOrientation.X ? tracker.XLimit : tracker.YLimit;
var view = seriesView as IAreaPoint;
var radius = view != null ? view.GetPointDiameter() : 0;
if (limit.Max > boundries[0]) boundries[0] = limit.Max;
if (limit.Min < boundries[1]) boundries[1] = limit.Min;
if (radius > boundries[2]) boundries[2] = radius;
}
ax.TopSeriesLimit = boundries[0];
ax.BotSeriesLimit = boundries[1];
ax.TopLimit = double.IsNaN(ax.MaxValue) ? boundries[0] : ax.MaxValue;
ax.BotLimit = double.IsNaN(ax.MinValue) ? boundries[1] : ax.MinValue;
ax.MaxPointRadius = boundries[2];
}
#endregion
}
}

View File

@@ -0,0 +1,112 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System;
using System.Linq;
using LiveCharts.Definitions.Charts;
using LiveCharts.Definitions.Series;
using LiveCharts.Dtos;
using LiveCharts.Helpers;
namespace LiveCharts.Charts
{
/// <summary>
///
/// </summary>
/// <seealso cref="LiveCharts.Charts.ChartCore" />
public class PieChartCore : ChartCore
{
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="PieChartCore"/> class.
/// </summary>
/// <param name="view">The view.</param>
/// <param name="updater">The updater.</param>
public PieChartCore(IChartView view, ChartUpdater updater) : base(view, updater)
{
updater.Chart = this;
}
#endregion
#region Publics
/// <summary>
/// Prepares the axes.
/// </summary>
/// <exception cref="LiveChartsException">There is a invalid series in the series collection, " +
/// "verify that all the series implement IPieSeries.</exception>
public override void PrepareAxes()
{
View.Zoom = ZoomingOptions.None;
if (View.ActualSeries.Any(x => !(x.Model is IPieSeries)))
throw new LiveChartsException(
"There is a invalid series in the series collection, " +
"verify that all the series implement IPieSeries.");
foreach (var xi in AxisX)
{
xi.S = 1;
xi.BotLimit = View.ActualSeries.Select(x => x.Values.GetTracker(x).XLimit.Min)
.DefaultIfEmpty(0).Min();
xi.TopLimit = View.ActualSeries.Select(x => x.Values.GetTracker(x).XLimit.Max)
.DefaultIfEmpty(0).Max();
if (Math.Abs(xi.BotLimit - xi.TopLimit) < xi.S * .01)
{
xi.BotLimit -= xi.S;
xi.TopLimit += xi.S;
}
}
foreach (var yi in AxisY)
{
//yi.CalculateSeparator(this, AxisTags.X);
yi.BotLimit = View.ActualSeries.Select(x => x.Values.GetTracker(x).YLimit.Min)
.DefaultIfEmpty(0).Min();
yi.TopLimit = View.ActualSeries.Select(x => x.Values.GetTracker(x).YLimit.Max)
.DefaultIfEmpty(0).Max();
if (Math.Abs(yi.BotLimit - yi.TopLimit) < yi.S * .01)
{
yi.BotLimit -= yi.S;
yi.TopLimit += yi.S;
}
}
StackPoints(View.ActualSeries, AxisOrientation.Y, 0);
var curSize = new CoreRectangle(0, 0, ControlSize.Width, ControlSize.Height);
curSize = PlaceLegend(curSize);
DrawMargin.Top = curSize.Top;
DrawMargin.Left = curSize.Left;
DrawMargin.Width = curSize.Width;
DrawMargin.Height = curSize.Height;
}
#endregion
}
}

View File

@@ -0,0 +1,136 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System;
namespace LiveCharts.Configurations
{
/// <summary>
/// Mapper to configure X and Y points
/// </summary>
/// <typeparam name="T">Type to configure</typeparam>
public class CartesianMapper<T> : IPointEvaluator<T>
{
private Func<T, int, double> _x = (v, i) => i;
private Func<T, int, double> _y = (v, i) => i;
private Func<T, int, object> _stroke;
private Func<T, int, object> _fill;
/// <summary>
/// Sets values for a specific point
/// </summary>
/// <param name="point">Point to set</param>
/// <param name="value"></param>
/// <param name="key"></param>
public void Evaluate(int key, T value, ChartPoint point)
{
point.X = _x(value, key);
point.Y = _y(value, key);
if (_stroke != null) point.Stroke = _stroke(value, key);
if (_fill != null) point.Fill = _fill(value, key);
}
/// <summary>
/// Sets the X mapper
/// </summary>
/// <param name="predicate">function that pulls X coordinate</param>
/// <returns>current mapper instance</returns>
public CartesianMapper<T> X(Func<T, double> predicate)
{
return X((t, i) => predicate(t));
}
/// <summary>
/// Sets the X mapper
/// </summary>
/// <param name="predicate">function that pulls X coordinate, with value and index as parameters</param>
/// <returns>current mapper instance</returns>
public CartesianMapper<T> X(Func<T, int, double> predicate)
{
_x = predicate;
return this;
}
/// <summary>
/// Sets the Y mapper
/// </summary>
/// <param name="predicate">function that pulls Y coordinate</param>
/// <returns>current mapper instance</returns>
public CartesianMapper<T> Y(Func<T, double> predicate)
{
return Y((t, i) => predicate(t));
}
/// <summary>
/// Sets the Y mapper
/// </summary>
/// <param name="predicate">function that pulls Y coordinate, with value and index as parameters</param>
/// <returns>current mapper instance</returns>
public CartesianMapper<T> Y(Func<T, int, double> predicate)
{
_y = predicate;
return this;
}
/// <summary>
/// Sets the Stroke of the point
/// </summary>
/// <param name="predicate"></param>
/// <returns></returns>
public CartesianMapper<T> Stroke(Func<T, object> predicate)
{
return Stroke((t, i) => predicate(t));
}
/// <summary>
/// Sets the Stroke of the point
/// </summary>
/// <param name="predicate"></param>
/// <returns></returns>
public CartesianMapper<T> Stroke(Func<T, int, object> predicate)
{
_stroke = predicate;
return this;
}
/// <summary>
/// Sets the Fill of the point
/// </summary>
/// <param name="predicate"></param>
/// <returns></returns>
public CartesianMapper<T> Fill(Func<T, object> predicate)
{
return Fill((t, i) => predicate(t));
}
/// <summary>
/// Sets the Fill of the point
/// </summary>
/// <param name="predicate"></param>
/// <returns></returns>
public CartesianMapper<T> Fill(Func<T, int, object> predicate)
{
_fill = predicate;
return this;
}
}
}

View File

@@ -0,0 +1,176 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System;
namespace LiveCharts.Configurations
{
/// <summary>
/// Mapper to configure financial points
/// </summary>
/// <typeparam name="T">type to configure</typeparam>
public class FinancialMapper<T> : IPointEvaluator<T>
{
private Func<T, int, double> _x = (v, i) => i;
private Func<T, int, double> _y = (v, i) => 0;
private Func<T, int, double> _open;
private Func<T, int, double> _high;
private Func<T, int, double> _low;
private Func<T, int, double> _close;
/// <summary>
/// Sets values for a specific point
/// </summary>
/// <param name="point">Point to set</param>
/// <param name="value"></param>
/// <param name="key"></param>
public void Evaluate(int key, T value, ChartPoint point)
{
point.X = _x(value, key);
point.Y = _y(value, key);
point.Open = _open(value, key);
point.High = _high(value, key);
point.Close = _close(value, key);
point.Low = _low(value, key);
}
/// <summary>
/// Maps X value
/// </summary>
/// <param name="predicate">function that pulls X coordinate</param>
/// <returns>current mapper instance</returns>
public FinancialMapper<T> X(Func<T, double> predicate)
{
return X((t, i) => predicate(t));
}
/// <summary>
/// Maps X value
/// </summary>
/// <param name="predicate">function that pulls X coordinate, with value and index as parameters</param>
/// <returns>current mapper instance</returns>
public FinancialMapper<T> X(Func<T, int, double> predicate)
{
_x = predicate;
return this;
}
/// <summary>
/// Maps Y value
/// </summary>
/// <param name="predicate">function that pulls Y coordinate</param>
/// <returns>current mapper instance</returns>
public FinancialMapper<T> Y(Func<T, double> predicate)
{
return Y((t, i) => predicate(t));
}
/// <summary>
/// Maps Y value
/// </summary>
/// <param name="predicate">function that pulls Y coordinate, with value and index as parameters</param>
/// <returns>current mapper instance</returns>
public FinancialMapper<T> Y(Func<T, int, double> predicate)
{
_y = predicate;
return this;
}
/// <summary>
/// Maps Open value
/// </summary>
/// <param name="predicate">function that pulls open value</param>
/// <returns>current mapper instance</returns>
public FinancialMapper<T> Open(Func<T, double> predicate)
{
return Open((t, i) => predicate(t));
}
/// <summary>
/// Maps Open value
/// </summary>
/// <param name="predicate">function that pulls open value, value and index as parameters</param>
/// <returns>current mapper instance</returns>
public FinancialMapper<T> Open(Func<T, int, double> predicate)
{
_open = predicate;
return this;
}
/// <summary>
/// Maps High value
/// </summary>
/// <param name="predicate">function that pulls High value</param>
/// <returns>current mapper instance</returns>
public FinancialMapper<T> High(Func<T, double> predicate)
{
return High((t, i) => predicate(t));
}
/// <summary>
/// Maps High value
/// </summary>
/// <param name="predicate">function that pulls High value</param>
/// <returns>current mapper instance</returns>
public FinancialMapper<T> High(Func<T, int, double> predicate)
{
_high = predicate;
return this;
}
/// <summary>
/// Maps Close value
/// </summary>
/// <param name="predicate">function that pulls close value</param>
/// <returns>current mapper instance</returns>
public FinancialMapper<T> Close(Func<T, double> predicate)
{
return Close((t, i) => predicate(t));
}
/// <summary>
/// Maps Close value
/// </summary>
/// <param name="predicate">function that pulls close value, value and index as parameters</param>
/// <returns>current mapper instance</returns>
public FinancialMapper<T> Close(Func<T, int, double> predicate)
{
_close = predicate;
return this;
}
/// <summary>
/// Maps Low value
/// </summary>
/// <param name="predicate">function that pulls low value</param>
/// <returns>current mapper instance</returns>
public FinancialMapper<T> Low(Func<T, double> predicate)
{
return Low((t, i) => predicate(t));
}
/// <summary>
/// Maps Low value
/// </summary>
/// <param name="predicate">function that pulls low value, index and value as parameters</param>
/// <returns>current mapper instance</returns>
public FinancialMapper<T> Low(Func<T, int, double> predicate)
{
_low = predicate;
return this;
}
}
}

View File

@@ -0,0 +1,184 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System;
namespace LiveCharts.Configurations
{
/// <summary>
/// Mapper to configure X and Y points
/// </summary>
/// <typeparam name="T">Type to configure</typeparam>
public class GanttMapper<T> : IPointEvaluator<T>
{
private Func<T, int, double> _x = (v, i) => i;
private Func<T, int, double> _y = (v, i) => i;
private Func<T, int, double> _startX = (v, i) => 0;
private Func<T, int, double> _startY = (v, i) => 0;
private Func<T, int, object> _stroke;
private Func<T, int, object> _fill;
/// <summary>
/// Sets values for a specific point
/// </summary>
/// <param name="point">Point to set</param>
/// <param name="value"></param>
/// <param name="key"></param>
public void Evaluate(int key, T value, ChartPoint point)
{
point.X = _x(value, key);
point.Y = _y(value, key);
point.XStart = _startX(value, key);
point.YStart = _startY(value, key);
if (_stroke != null) point.Stroke = _stroke(value, key);
if (_fill != null) point.Fill = _fill(value, key);
point.EvaluatesGantt = true;
}
/// <summary>
/// Sets the X mapper
/// </summary>
/// <param name="predicate">function that pulls X coordinate</param>
/// <returns>current mapper instance</returns>
public GanttMapper<T> X(Func<T, double> predicate)
{
return X((t, i) => predicate(t));
}
/// <summary>
/// Sets the X mapper
/// </summary>
/// <param name="predicate">function that pulls X coordinate, with value and index as parameters</param>
/// <returns>current mapper instance</returns>
public GanttMapper<T> X(Func<T, int, double> predicate)
{
_x = predicate;
return this;
}
/// <summary>
/// Sets the XStart mapper
/// </summary>
/// <param name="predicate">function that pulls X coordinate</param>
/// <returns>current mapper instance</returns>
public GanttMapper<T> XStart(Func<T, double> predicate)
{
return XStart((t, i) => predicate(t));
}
/// <summary>
/// Sets the XStart mapper
/// </summary>
/// <param name="predicate">function that pulls X coordinate, with value and index as parameters</param>
/// <returns>current mapper instance</returns>
public GanttMapper<T> XStart(Func<T, int, double> predicate)
{
_startX = predicate;
return this;
}
/// <summary>
/// Sets the Y mapper
/// </summary>
/// <param name="predicate">function that pulls Y coordinate</param>
/// <returns>current mapper instance</returns>
public GanttMapper<T> Y(Func<T, double> predicate)
{
return Y((t, i) => predicate(t));
}
/// <summary>
/// Sets the Y mapper
/// </summary>
/// <param name="predicate">function that pulls Y coordinate, with value and index as parameters</param>
/// <returns>current mapper instance</returns>
public GanttMapper<T> Y(Func<T, int, double> predicate)
{
_y = predicate;
return this;
}
/// <summary>
/// Sets the YStart mapper
/// </summary>
/// <param name="predicate">function that pulls Y coordinate</param>
/// <returns>current mapper instance</returns>
public GanttMapper<T> YStart(Func<T, double> predicate)
{
return YStart((t, i) => predicate(t));
}
/// <summary>
/// Sets the YStart mapper
/// </summary>
/// <param name="predicate">function that pulls Y coordinate, with value and index as parameters</param>
/// <returns>current mapper instance</returns>
public GanttMapper<T> YStart(Func<T, int, double> predicate)
{
_startY = predicate;
return this;
}
/// <summary>
/// Sets the Stroke of the point
/// </summary>
/// <param name="predicate"></param>
/// <returns></returns>
public GanttMapper<T> Stroke(Func<T, object> predicate)
{
return Stroke((t, i) => predicate(t));
}
/// <summary>
/// Sets the Stroke of the point
/// </summary>
/// <param name="predicate"></param>
/// <returns></returns>
public GanttMapper<T> Stroke(Func<T, int, object> predicate)
{
_stroke = predicate;
return this;
}
/// <summary>
/// Sets the Fill of the point
/// </summary>
/// <param name="predicate"></param>
/// <returns></returns>
public GanttMapper<T> Fill(Func<T, object> predicate)
{
return Fill((t, i) => predicate(t));
}
/// <summary>
/// Sets the Fill of the point
/// </summary>
/// <param name="predicate"></param>
/// <returns></returns>
public GanttMapper<T> Fill(Func<T, int, object> predicate)
{
_fill = predicate;
return this;
}
}
}

View File

@@ -0,0 +1,39 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Configurations
{
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
public interface IPointEvaluator<in T>
{
/// <summary>
/// Evaluates the specified key.
/// </summary>
/// <param name="key">The key.</param>
/// <param name="value">The value.</param>
/// <param name="point">The point.</param>
void Evaluate(int key, T value, ChartPoint point);
}
}

View File

@@ -0,0 +1,90 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Configurations
{
/// <summary>
/// Gets the already built point mappers
/// </summary>
public static class Mappers
{
/// <summary>
/// Gets a mapper to configure X, Y points
/// </summary>
/// <typeparam name="T">Type to map</typeparam>
/// <returns>A new cartesian mapper instance</returns>
public static CartesianMapper<T> Xy<T>()
{
return new CartesianMapper<T>();
}
/// <summary>
/// Gets a mapper to configure financial points
/// </summary>
/// <typeparam name="T">type to map</typeparam>
/// <returns>a new financial mapper instance</returns>
public static FinancialMapper<T> Financial<T>()
{
return new FinancialMapper<T>();
}
/// <summary>
/// Gets a mapper to configure X, Y and Weight points
/// </summary>
/// <typeparam name="T">type to map</typeparam>
/// <returns>a new weighted mapper instance</returns>
public static WeightedMapper<T> Weighted<T>()
{
return new WeightedMapper<T>();
}
/// <summary>
/// Gets a Gantt Mapper
/// </summary>
/// <typeparam name="T">type to amp</typeparam>
/// <returns>a new polar mapper insance</returns>
public static GanttMapper<T> Gantt<T>()
{
return new GanttMapper<T>();
}
/// <summary>
/// Gets a mapper to configure Radius and Angle
/// </summary>
/// <typeparam name="T">type to amp</typeparam>
/// <returns>a new polar mapper insance</returns>
public static PolarMapper<T> Polar<T>()
{
return new PolarMapper<T>();
}
/// <summary>
/// PGets a mapper to configure a pie chart
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
public static PieMapper<T> Pie<T>()
{
return new PieMapper<T>();
}
}
}

View File

@@ -0,0 +1,94 @@
using System;
namespace LiveCharts.Configurations
{
/// <summary>
/// Mapper to configure X and Y points
/// </summary>
/// <typeparam name="T">Type to configure</typeparam>
public class PieMapper<T> : IPointEvaluator<T>
{
private readonly Func<T, int, double> _x = (v, i) => i;
private Func<T, int, double> _y = (v, i) => i;
private Func<T, int, object> _stroke;
private Func<T, int, object> _fill;
/// <summary>
/// Sets values for a specific point
/// </summary>
/// <param name="point">Point to set</param>
/// <param name="value"></param>
/// <param name="key"></param>
public void Evaluate(int key, T value, ChartPoint point)
{
point.X = _x(value, key);
point.Y = _y(value, key);
if (_stroke != null) point.Stroke = _stroke(value, key);
if (_fill != null) point.Fill = _fill(value, key);
}
/// <summary>
/// Sets the Y mapper
/// </summary>
/// <param name="predicate">function that pulls Y coordinate</param>
/// <returns>current mapper instance</returns>
public PieMapper<T> Value(Func<T, double> predicate)
{
return Value((t, i) => predicate(t));
}
/// <summary>
/// Sets the Y mapper
/// </summary>
/// <param name="predicate">function that pulls Y coordinate, with value and index as parameters</param>
/// <returns>current mapper instance</returns>
public PieMapper<T> Value(Func<T, int, double> predicate)
{
_y = predicate;
return this;
}
/// <summary>
/// Sets the Stroke of the point
/// </summary>
/// <param name="predicate"></param>
/// <returns></returns>
public PieMapper<T> Stroke(Func<T, object> predicate)
{
return Stroke((t, i) => predicate(t));
}
/// <summary>
/// Sets the Stroke of the point
/// </summary>
/// <param name="predicate"></param>
/// <returns></returns>
public PieMapper<T> Stroke(Func<T, int, object> predicate)
{
_stroke = predicate;
return this;
}
/// <summary>
/// Sets the Fill of the point
/// </summary>
/// <param name="predicate"></param>
/// <returns></returns>
public PieMapper<T> Fill(Func<T, object> predicate)
{
return Fill((t, i) => predicate(t));
}
/// <summary>
/// Sets the Fill of the point
/// </summary>
/// <param name="predicate"></param>
/// <returns></returns>
public PieMapper<T> Fill(Func<T, int, object> predicate)
{
_fill = predicate;
return this;
}
}
}

View File

@@ -0,0 +1,134 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System;
namespace LiveCharts.Configurations
{
/// <summary>
/// Mapper to configure polar series
/// </summary>
/// <typeparam name="T"></typeparam>
public class PolarMapper<T> : IPointEvaluator<T>
{
private Func<T, int, double> _r;
private Func<T, int, double> _angle;
private Func<T, int, object> _stroke;
private Func<T, int, object> _fill;
/// <summary>
/// Sets values for a specific point
/// </summary>
/// <param name="point">Point to set</param>
/// <param name="value"></param>
/// <param name="key"></param>
public void Evaluate(int key, T value, ChartPoint point)
{
point.Radius = _r(value, key);
point.Angle = _angle(value, key);
if (_stroke != null) point.Stroke = _stroke(value, key);
if (_fill != null) point.Fill = _fill(value, key);
}
/// <summary>
/// Maps X value
/// </summary>
/// <param name="predicate">function that pulls the radius value</param>
/// <returns>current mapper instance</returns>
public PolarMapper<T> Radius(Func<T, double> predicate)
{
return Radius((t, i) => predicate(t));
}
/// <summary>
/// Maps X value
/// </summary>
/// <param name="predicate">function that pulls the radius value, value and index as parameters</param>
/// <returns>current mapper instance</returns>
public PolarMapper<T> Radius(Func<T, int, double> predicate)
{
_r = predicate;
return this;
}
/// <summary>
/// Maps Y value
/// </summary>
/// <param name="predicate">function that pulls the angle value</param>
/// <returns>current mapper instance</returns>
public PolarMapper<T> Angle(Func<T, double> predicate)
{
return Angle((t, i) => predicate(t));
}
/// <summary>
/// Maps Y value
/// </summary>
/// <param name="predicate">function that pulls the angle value, value and index as parameters</param>
/// <returns>current mapper instance</returns>
public PolarMapper<T> Angle(Func<T, int, double> predicate)
{
_angle = predicate;
return this;
}
/// <summary>
/// Sets the Stroke of the point
/// </summary>
/// <param name="predicate"></param>
/// <returns></returns>
public PolarMapper<T> Stroke(Func<T, object> predicate)
{
return Stroke((t, i) => predicate(t));
}
/// <summary>
/// Sets the Stroke of the point
/// </summary>
/// <param name="predicate"></param>
/// <returns></returns>
public PolarMapper<T> Stroke(Func<T, int, object> predicate)
{
_stroke = predicate;
return this;
}
/// <summary>
/// Sets the Fill of the point
/// </summary>
/// <param name="predicate"></param>
/// <returns></returns>
public PolarMapper<T> Fill(Func<T, object> predicate)
{
return Fill((t, i) => predicate(t));
}
/// <summary>
/// Sets the Fill of the point
/// </summary>
/// <param name="predicate"></param>
/// <returns></returns>
public PolarMapper<T> Fill(Func<T, int, object> predicate)
{
_fill = predicate;
return this;
}
}
}

View File

@@ -0,0 +1,159 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System;
namespace LiveCharts.Configurations
{
/// <summary>
/// Mapper to configure Bubble points
/// </summary>
/// <typeparam name="T">type to configure</typeparam>
public class WeightedMapper<T> : IPointEvaluator<T>
{
private Func<T, int, double> _x = (v, i) => i;
private Func<T, int, double> _y = (v, i) => i;
private Func<T, int, double> _weight = (v, i) => 0;
private Func<T, int, object> _stroke;
private Func<T, int, object> _fill;
/// <summary>
/// Sets values for a specific point
/// </summary>
/// <param name="point">Point to set</param>
/// <param name="value"></param>
/// <param name="key"></param>
public void Evaluate(int key, T value, ChartPoint point)
{
point.X = _x(value, key);
point.Y = _y(value, key);
point.Weight = _weight(value, key);
if (_stroke != null) point.Stroke = _stroke(value, key);
if (_fill != null) point.Fill = _fill(value, key);
}
/// <summary>
/// Sets the X mapper
/// </summary>
/// <param name="predicate">function that pulls the X coordinate</param>
/// <returns>current mapper instance</returns>
public WeightedMapper<T> X(Func<T, double> predicate)
{
return X((t, i) => predicate(t));
}
/// <summary>
/// Sets the X mapper
/// </summary>
/// <param name="predicate">function that pulls the X coordinate, value and index as parameters</param>
/// <returns>current mapper instance</returns>
public WeightedMapper<T> X(Func<T, int, double> predicate)
{
_x = predicate;
return this;
}
/// <summary>
/// Sets the Y mapper
/// </summary>
/// <param name="predicate">function that pulls the Y coordinate</param>
/// <returns>current mapper instance</returns>
public WeightedMapper<T> Y(Func<T, double> predicate)
{
return Y((t, i) => predicate(t));
}
/// <summary>
/// Sets the Y mapper
/// </summary>
/// <param name="predicate">function that pulls the Y coordinate, value and index as parameters</param>
/// <returns>current mapper instance</returns>
public WeightedMapper<T> Y(Func<T, int, double> predicate)
{
_y = predicate;
return this;
}
/// <summary>
/// Sets Weight mapper
/// </summary>
/// <param name="predicate">function that pulls the point's weight</param>
/// <returns>current mapper instance</returns>
public WeightedMapper<T> Weight(Func<T, double> predicate)
{
return Weight((t, i) => predicate(t));
}
/// <summary>
/// Sets Weight mapper
/// </summary>
/// <param name="predicate">function that pulls the point's weight, value and index as parameters</param>
/// <returns>current mapper instance</returns>
public WeightedMapper<T> Weight(Func<T, int, double> predicate)
{
_weight = predicate;
return this;
}
/// <summary>
/// Sets the Stroke of the point
/// </summary>
/// <param name="predicate"></param>
/// <returns></returns>
public WeightedMapper<T> Stroke(Func<T, object> predicate)
{
return Stroke((t, i) => predicate(t));
}
/// <summary>
/// Sets the Stroke of the point
/// </summary>
/// <param name="predicate"></param>
/// <returns></returns>
public WeightedMapper<T> Stroke(Func<T, int, object> predicate)
{
_stroke = predicate;
return this;
}
/// <summary>
/// Sets the Fill of the point
/// </summary>
/// <param name="predicate"></param>
/// <returns></returns>
public WeightedMapper<T> Fill(Func<T, object> predicate)
{
return Fill((t, i) => predicate(t));
}
/// <summary>
/// Sets the Fill of the point
/// </summary>
/// <param name="predicate"></param>
/// <returns></returns>
public WeightedMapper<T> Fill(Func<T, int, object> predicate)
{
_fill = predicate;
return this;
}
}
}

View File

@@ -0,0 +1,180 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D447642C-A85F-4AB0-96D9-C66CFF91AADA}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LiveCharts</RootNamespace>
<AssemblyName>LiveCharts</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TargetFrameworkProfile>Profile78</TargetFrameworkProfile>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DefineConstants Condition=" '$(TargetFrameworkVersion)' == 'v4.0' ">NET40</DefineConstants>
<DefineConstants Condition=" '$(TargetFrameworkVersion)' == 'v4.5' ">NET45</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Debug\LiveCharts.XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<DefineConstants Condition=" '$(TargetFrameworkVersion)' == 'v4.0' ">NET40</DefineConstants>
<DefineConstants Condition=" '$(TargetFrameworkVersion)' == 'v4.5' ">NET45</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\LiveCharts.XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>sign.pfx</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup>
<DelaySign>false</DelaySign>
</PropertyGroup>
<ItemGroup>
<Compile Include="AxisCore.cs" />
<Compile Include="AxisOrientation.cs" />
<Compile Include="AxisPosition.cs" />
<Compile Include="AxisSectionCore.cs" />
<Compile Include="BarLabelPosition.cs" />
<Compile Include="ChartFunctions.cs" />
<Compile Include="Charting.cs" />
<Compile Include="ChartPoint.cs" />
<Compile Include="Charts\CartesianChartCore.cs" />
<Compile Include="Charts\ChartCore.cs" />
<Compile Include="Charts\PieChartCore.cs" />
<Compile Include="ChartUpdater.cs" />
<Compile Include="ChartValues.cs" />
<Compile Include="Configurations\CartesianMapper.cs" />
<Compile Include="Configurations\FinancialMapper.cs" />
<Compile Include="Configurations\GanttMapper.cs" />
<Compile Include="Configurations\IPointEvaluator.cs" />
<Compile Include="Configurations\Mappers.cs" />
<Compile Include="Configurations\PieMapper.cs" />
<Compile Include="Configurations\PolarMapper.cs" />
<Compile Include="Configurations\WeightedMapper.cs" />
<Compile Include="DataLabelViewModel.cs" />
<Compile Include="Defaults\AxisLimits.cs" />
<Compile Include="Defaults\DateTimePoint.cs" />
<Compile Include="Defaults\GanttPoint.cs" />
<Compile Include="Defaults\HeatPoint.cs" />
<Compile Include="Defaults\ObservablePoint.cs" />
<Compile Include="Defaults\ObservableValue.cs" />
<Compile Include="Defaults\OHLCPoint.cs" />
<Compile Include="Defaults\PolarPoint.cs" />
<Compile Include="Defaults\ScatterPoint.cs" />
<Compile Include="Definitions\Charts\IAxisSectionView.cs" />
<Compile Include="Definitions\Charts\IAxisView.cs" />
<Compile Include="Definitions\Charts\ICartesianChart.cs" />
<Compile Include="Definitions\Charts\ICartesianVisualElement.cs" />
<Compile Include="Definitions\Charts\IChartView.cs" />
<Compile Include="Definitions\Charts\ILogarithmicAxisView.cs" />
<Compile Include="Definitions\Charts\IPieChart.cs" />
<Compile Include="Definitions\Charts\ISeparatorElementView.cs" />
<Compile Include="Definitions\Charts\ISeparatorView.cs" />
<Compile Include="Definitions\Points\IBezierPointView.cs" />
<Compile Include="Definitions\Points\IChartPointView.cs" />
<Compile Include="Definitions\Points\IHeatPointView.cs" />
<Compile Include="Definitions\Points\IOhlcPointView.cs" />
<Compile Include="Definitions\Points\IPieSlicePointView.cs" />
<Compile Include="Definitions\Points\IRectanglePointView.cs" />
<Compile Include="Definitions\Points\IScatterPointView.cs" />
<Compile Include="Definitions\Points\IStepPointView.cs" />
<Compile Include="Definitions\Series\IAreaPoint.cs" />
<Compile Include="Definitions\Series\ICartesianSeries.cs" />
<Compile Include="Definitions\Series\IColumnSeriesView.cs" />
<Compile Include="Definitions\Series\IFinancialSeriesView.cs" />
<Compile Include="Definitions\Series\IHeatSeriesView.cs" />
<Compile Include="Definitions\Series\ILineSeriesView.cs" />
<Compile Include="Definitions\Series\IPieSeries.cs" />
<Compile Include="Definitions\Series\IPieSeriesView.cs" />
<Compile Include="Definitions\Series\IRowSeriesView.cs" />
<Compile Include="Definitions\Series\IScatterSeriesView.cs" />
<Compile Include="Definitions\Series\ISeriesView.cs" />
<Compile Include="Definitions\Series\IStackedAreaSeriesView.cs" />
<Compile Include="Definitions\Series\IStackedColumnSeriesView.cs" />
<Compile Include="Definitions\Series\IStackedRowSeriesView.cs" />
<Compile Include="Definitions\Series\IStackModelableSeriesView.cs" />
<Compile Include="Definitions\Series\IVerticalStackedAreaSeriesView.cs" />
<Compile Include="Dtos\BezierData.cs" />
<Compile Include="Dtos\CoreColor.cs" />
<Compile Include="Dtos\CoreGradientStop.cs" />
<Compile Include="Dtos\CoreLimit.cs" />
<Compile Include="Dtos\CoreMargin.cs" />
<Compile Include="Dtos\CorePoint.cs" />
<Compile Include="Dtos\CoreRectangle.cs" />
<Compile Include="Dtos\CoreSize.cs" />
<Compile Include="Dtos\LabelEvaluation.cs" />
<Compile Include="Dtos\StackedSum.cs" />
<Compile Include="Dtos\TooltipDataViewModel.cs" />
<Compile Include="Events\Delegates.cs" />
<Compile Include="Events\PreviewRangeChangedEventArgs.cs" />
<Compile Include="Events\RangeChangedEventArgs.cs" />
<Compile Include="Helpers\Extentions.cs" />
<Compile Include="Helpers\LiveChartsException.cs" />
<Compile Include="Helpers\NoisyCollection.cs" />
<Compile Include="IChartValues.cs" />
<Compile Include="IObservableChartPoint.cs" />
<Compile Include="LegendLocation.cs" />
<Compile Include="LogarithmicAxisCore.cs" />
<Compile Include="Maps\MapData.cs" />
<Compile Include="PanningOptions.cs" />
<Compile Include="PieLabelPosition.cs" />
<Compile Include="PointTracker.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ScrollMode.cs" />
<Compile Include="SeparationState.cs" />
<Compile Include="SeparatorConfigurationCore.cs" />
<Compile Include="SeparatorElementCore.cs" />
<Compile Include="Seriesalgorithm.cs" />
<Compile Include="SeriesAlgorithms\CandleAlgorithm.cs" />
<Compile Include="SeriesAlgorithms\ColumnAlgorithm.cs" />
<Compile Include="SeriesAlgorithms\HeatAlgorithm.cs" />
<Compile Include="SeriesAlgorithms\LineAlgorithm.cs" />
<Compile Include="SeriesAlgorithms\OhlcAlgorithm.cs" />
<Compile Include="SeriesAlgorithms\PieAlgorithm.cs" />
<Compile Include="SeriesAlgorithms\RowAlgorithm.cs" />
<Compile Include="SeriesAlgorithms\ScatterAlgorithm.cs" />
<Compile Include="SeriesAlgorithms\StackedAreaAlgorithm.cs" />
<Compile Include="SeriesAlgorithms\StackedColumnAlgorithm.cs" />
<Compile Include="SeriesAlgorithms\StackedRowAlgorithm.cs" />
<Compile Include="SeriesAlgorithms\StepLineAlgorithm.cs" />
<Compile Include="SeriesAlgorithms\VerticalLineAlgorithm.cs" />
<Compile Include="SeriesAlgorithms\VerticalStackedAreaAlgorithm.cs" />
<Compile Include="SeriesCollection.cs" />
<Compile Include="SeriesOrientation.cs" />
<Compile Include="StackMode.cs" />
<Compile Include="TooltipSelectionMode.cs" />
<Compile Include="UpdaterState.cs" />
<Compile Include="VisualElementsCollection.cs" />
<Compile Include="ZoomingOptions.cs" />
</ItemGroup>
<ItemGroup>
<None Include="sign.pfx" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue">CSharp50</s:String></wpf:ResourceDictionary>

View File

@@ -0,0 +1,30 @@
<?xml version="1.0"?>
<package >
<metadata>
<id>LiveCharts</id>
<version>0.0.0.0</version>
<title>LiveCharts</title>
<authors>Beto Rodriguez</authors>
<owners>Beto Rodriguez</owners>
<licenseUrl>https://github.com/beto-rodriguez/Live-Charts/blob/master/LICENSE.TXT</licenseUrl>
<projectUrl>http://lvcharts.net/</projectUrl>
<iconUrl>http://lvcharts.net/Content/Images/Logos/lcred.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Simple, flexible, interactive and powerful data visualization for .Net</description>
<releaseNotes>See https://github.com/beto-rodriguez/Live-Charts/releases</releaseNotes>
<copyright>Copyright 2016</copyright>
<tags>livechart, live, chart, charting, plot, plots, plotting, graph, graphs, graphing, data</tags>
</metadata>
<files>
<file src="readme.txt" target="" />
<file src="bin\Release\LiveCharts.dll" target="lib\portable-net45+win8+wp8" />
<file src="bin\Release\LiveCharts.pdb" target="lib\portable-net45+win8+wp8" />
<file src="bin\Release\LiveCharts.xml" target="lib\portable-net45+win8+wp8" />
<file src="..\Core40\bin\Net40\LiveCharts.dll" target="lib\net40" />
<file src="..\Core40\bin\Net40\LiveCharts.pdb" target="lib\net40" />
<file src="..\Core40\bin\Net40\LiveCharts.xml" target="lib\net40" />
<file src="..\Core40\bin\Net45\LiveCharts.dll" target="lib\net45" />
<file src="..\Core40\bin\Net45\LiveCharts.pdb" target="lib\net45" />
<file src="..\Core40\bin\Net45\LiveCharts.xml" target="lib\net45" />
</files>
</package>

View File

@@ -0,0 +1,46 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts
{
/// <summary>
/// Describes a data label view model
/// </summary>
public class DataLabelViewModel
{
/// <summary>
/// Gets or sets the formatted text of the current point
/// </summary>
/// <value>
/// The formatted text.
/// </value>
public string FormattedText { get; set; }
/// <summary>
/// Gets the instance of the current point.
/// </summary>
/// <value>
/// The instance.
/// </value>
public object Instance { get; internal set; }
}
}

View File

@@ -0,0 +1,64 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System;
namespace LiveCharts.Defaults
{
internal static class AxisLimits
{
internal static double StretchMax(AxisCore axis)
{
return axis.TopLimit; //Math.Ceiling(axis.TopLimit/axis.Magnitude)*axis.Magnitude;
}
internal static double StretchMin(AxisCore axis)
{
return axis.BotLimit; //Math.Floor(axis.BotLimit/axis.Magnitude)*axis.Magnitude;
}
internal static double UnitRight(AxisCore axis)
{
return Math.Ceiling(axis.TopLimit/axis.Magnitude)*axis.Magnitude + 1;
}
internal static double UnitLeft(AxisCore axis)
{
return Math.Floor(axis.BotLimit/axis.Magnitude)*axis.Magnitude - 1;
}
internal static double SeparatorMax(AxisCore axis)
{
return ((int) (axis.TopLimit/axis.S) + 1)*axis.S;
}
internal static double SeparatorMaxRounded(AxisCore axis)
{
return Math.Round((axis.TopLimit/axis.S) + 1, 0)*axis.S;
}
internal static double SeparatorMin(AxisCore axis)
{
return (((int) (axis.BotLimit/axis.S)) - 1)*axis.S;
}
}
}

View File

@@ -0,0 +1,93 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System;
namespace LiveCharts.Defaults
{
/// <summary>
/// An already configured chart point with a date time and a double properties, this class notifies the chart to update every time a property changes
/// </summary>
public class DateTimePoint : IObservableChartPoint
{
private DateTime _dateTime;
private double _value;
/// <summary>
/// Initializes a new instance of DateTimePoint class
/// </summary>
public DateTimePoint()
{
}
/// <summary>
/// Initializes a new instance of DateTimePoint class, giving date time and value
/// </summary>
/// <param name="dateTime"></param>
/// <param name="value"></param>
public DateTimePoint(DateTime dateTime, double value)
{
_dateTime = dateTime;
_value = value;
}
/// <summary>
/// DateTime Property
/// </summary>
public DateTime DateTime
{
get { return _dateTime; }
set
{
_dateTime = value;
OnPointChanged();
}
}
/// <summary>
/// The Value property
/// </summary>
public double Value
{
get { return _value; }
set
{
_value = value;
OnPointChanged();
}
}
/// <summary>
/// Point changed event
/// </summary>
public event Action PointChanged;
/// <summary>
/// On Point property changed method
/// </summary>
protected virtual void OnPointChanged()
{
if (PointChanged != null) PointChanged.Invoke();
}
}
}

View File

@@ -0,0 +1,92 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System;
namespace LiveCharts.Defaults
{
/// <summary>
/// Defines a Gantt point in a cartesian chart
/// </summary>
public class GanttPoint : IObservableChartPoint
{
private double _startPoint;
private double _endPoint;
/// <summary>
/// Initializes a new instance of GanttPoint class.
/// </summary>
public GanttPoint()
{
}
/// <summary>
/// Initializes a new instance of GanttPoint class with given start and end points.
/// </summary>
public GanttPoint(double startPoint, double endPoint)
{
StartPoint = startPoint;
EndPoint = endPoint;
}
/// <summary>
/// Gets or sets point start
/// </summary>
public double StartPoint
{
get { return _startPoint; }
set
{
_startPoint = value;
OnPointChanged();
}
}
/// <summary>
/// Gets or sets point end
/// </summary>
public double EndPoint
{
get { return _endPoint; }
set
{
_endPoint = value;
OnPointChanged();
}
}
/// <summary>
/// PointChanged event
/// </summary>
public event Action PointChanged;
/// <summary>
/// OnPoint property changed method
/// </summary>
protected virtual void OnPointChanged()
{
if (PointChanged != null)
PointChanged.Invoke();
}
}
}

View File

@@ -0,0 +1,51 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Defaults
{
/// <summary>
/// An already configured weighted chart point, this class notifies the chart to update every time a property changes
/// </summary>
public class HeatPoint : ScatterPoint
{
/// <summary>
/// Initializes a new instance of HeatPoint class
/// </summary>
public HeatPoint()
{
}
/// <summary>
/// _initializes a new instance of HeatPoint class, giving x, y and weight
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="weight"></param>
public HeatPoint(double x, double y, double weight)
{
X = x;
Y = y;
Weight = weight;
}
}
}

View File

@@ -0,0 +1,125 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System;
namespace LiveCharts.Defaults
{
/// <summary>
/// An already configured chart point, this class notifies the chart to update every time a property changes
/// </summary>
public class OhlcPoint : IObservableChartPoint
{
private double _open;
private double _high;
private double _low;
private double _close;
/// <summary>
/// Initializes a new instance of OhclPoint class
/// </summary>
public OhlcPoint()
{
}
/// <summary>
/// Initializes a new instance o OhclPointc class, giving open, high, low and close values
/// </summary>
/// <param name="open"></param>
/// <param name="high"></param>
/// <param name="low"></param>
/// <param name="close"></param>
public OhlcPoint(double open, double high, double low, double close)
{
Open = open;
High = high;
Low = low;
Close = close;
}
/// <summary>
/// The open value i the chart
/// </summary>
public double Open
{
get { return _open; }
set
{
_open = value;
OnPointChanged();
}
}
/// <summary>
/// The high value in the chart
/// </summary>
public double High
{
get { return _high; }
set
{
_high = value;
OnPointChanged();
}
}
/// <summary>
/// The low value in the chart
/// </summary>
public double Low
{
get { return _low; }
set
{
_low = value;
OnPointChanged();
}
}
/// <summary>
/// The close value in the chart
/// </summary>
public double Close
{
get { return _close; }
set
{
_close = value;
OnPointChanged();
}
}
/// <summary>
/// The Point changed event
/// </summary>
public event Action PointChanged;
/// <summary>
/// On point property changed method
/// </summary>
protected virtual void OnPointChanged()
{
if (PointChanged != null) PointChanged.Invoke();
}
}
}

View File

@@ -0,0 +1,93 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System;
namespace LiveCharts.Defaults
{
/// <summary>
/// An already configured chart point, this class notifies a chart to update every time a property changes
/// </summary>
public class ObservablePoint : IObservableChartPoint
{
private double _x;
private double _y;
/// <summary>
/// The point changed event
/// </summary>
public event Action PointChanged;
/// <summary>
/// Initializes a new instance of ObservablePoint class
/// </summary>
public ObservablePoint()
{
}
/// <summary>
/// Initializes a new instance of ObservablePoint class giving the x and y coordinates
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
public ObservablePoint(double x, double y)
{
X = x;
Y = y;
}
/// <summary>
/// X coordinate
/// </summary>
public double X
{
get { return _x; }
set
{
_x = value;
OnPointChanged();
}
}
/// <summary>
/// Y coordinate
/// </summary>
public double Y
{
get { return _y; }
set
{
_y = value;
OnPointChanged();
}
}
/// <summary>
/// OnPoint property changed method
/// </summary>
protected virtual void OnPointChanged()
{
if (PointChanged != null)
PointChanged.Invoke();
}
}
}

View File

@@ -0,0 +1,76 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System;
namespace LiveCharts.Defaults
{
/// <summary>
/// An already configured chart point, this class notifies the chart to update every time the value property changes
/// </summary>
public class ObservableValue : IObservableChartPoint
{
private double _value;
/// <summary>
/// Initializes a new instance of ObservableValue class
/// </summary>
public ObservableValue()
{
}
/// <summary>
/// Initializes a new instance of ObservableValue class with a given value
/// </summary>
/// <param name="value"></param>
public ObservableValue(double value)
{
Value = value;
}
/// <summary>
/// Point changed event
/// </summary>
public event Action PointChanged;
/// <summary>
/// Value in he chart
/// </summary>
public double Value
{
get { return _value; }
set
{
_value = value;
OnPointChanged();
}
}
/// <summary>
/// On point property changed event
/// </summary>
protected virtual void OnPointChanged()
{
if (PointChanged != null) PointChanged.Invoke();
}
}
}

View File

@@ -0,0 +1,93 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System;
namespace LiveCharts.Defaults
{
/// <summary>
/// An already configured chart point, this class notifies the chart to update every time a property changes
/// </summary>
public class PolarPoint : IObservableChartPoint
{
private double _radius;
private double _angle;
/// <summary>
/// The point changed event
/// </summary>
public event Action PointChanged;
/// <summary>
/// Initializes a new instance of PolarPoint class
/// </summary>
public PolarPoint()
{
}
/// <summary>
/// Initializes a new instance of PolarPoint class, giving angle and radius
/// </summary>
/// <param name="radius"></param>
/// <param name="angle"></param>
public PolarPoint(double radius, double angle)
{
Radius = radius;
Angle = angle;
}
/// <summary>
/// The radius of the point
/// </summary>
public double Radius
{
get { return _radius; }
set
{
_radius = value;
OnPointChanged();
}
}
/// <summary>
/// The angle of the point
/// </summary>
public double Angle
{
get { return _angle; }
set
{
_angle = value;
OnPointChanged();
}
}
/// <summary>
/// On point property changed method
/// </summary>
protected virtual void OnPointChanged()
{
if (PointChanged != null)PointChanged.Invoke();
}
}
}

View File

@@ -0,0 +1,120 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System;
namespace LiveCharts.Defaults
{
/// <summary>
/// An already configured weighted chart point, this class notifies the chart to update every time a property changes
/// </summary>
public class ScatterPoint : IObservableChartPoint
{
private double _x;
private double _y;
private double _weight;
/// <summary>
/// Creates a new instance of BubblePoint class
/// </summary>
public ScatterPoint()
{
}
/// <summary>
/// Create a new instance of BubblePoint class, giving x and y coordinates
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
public ScatterPoint(double x, double y)
{
X = x;
Y = y;
}
/// <summary>
/// Creates a new instance of BubblePoint class, giving x, y and weight
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="weight"></param>
public ScatterPoint(double x, double y, double weight)
{
X = x;
Y = y;
Weight = weight;
}
/// <summary>
/// X coordinate in the chart
/// </summary>
public double X
{
get { return _x; }
set
{
_x = value;
OnPointChanged();
}
}
/// <summary>
/// Y coordinate in the chart
/// </summary>
public double Y
{
get { return _y; }
set
{
_y = value;
OnPointChanged();
}
}
/// <summary>
/// Point's weight
/// </summary>
public double Weight
{
get { return _weight; }
set
{
_weight = value;
OnPointChanged();
}
}
/// <summary>
/// Point changed event
/// </summary>
public event Action PointChanged;
/// <summary>
/// On point property changed method
/// </summary>
protected virtual void OnPointChanged()
{
if (PointChanged != null) PointChanged.Invoke();
}
}
}

View File

@@ -0,0 +1,91 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Definitions.Charts
{
/// <summary>
///
/// </summary>
public interface IAxisSectionView
{
/// <summary>
/// Gets or sets the model.
/// </summary>
/// <value>
/// The model.
/// </value>
AxisSectionCore Model { get; set; }
/// <summary>
/// Gets or sets the value.
/// </summary>
/// <value>
/// The value.
/// </value>
double Value { get; set; }
/// <summary>
/// Gets or sets the width of the section.
/// </summary>
/// <value>
/// The width of the section.
/// </value>
double SectionWidth { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this <see cref="IAxisSectionView"/> is draggable.
/// </summary>
/// <value>
/// <c>true</c> if draggable; otherwise, <c>false</c>.
/// </value>
bool Draggable { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the section is animated
/// </summary>
/// <value>
/// <c>true</c> if [disable animations]; otherwise, <c>false</c>.
/// </value>
bool DisableAnimations { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the section should display a label that displays its current value.
/// </summary>
/// <value>
/// <c>true</c> if [data label]; otherwise, <c>false</c>.
/// </value>
bool DataLabel { get; set; }
/// <summary>
/// Draws the or move.
/// </summary>
/// <param name="source">The source.</param>
/// <param name="axis">The axis.</param>
void DrawOrMove(AxisOrientation source, int axis);
/// <summary>
/// Removes this instance.
/// </summary>
void Remove();
/// <summary>
/// Ases the core element.
/// </summary>
/// <param name="axis">The axis.</param>
/// <param name="source">The source.</param>
/// <returns></returns>
AxisSectionCore AsCoreElement(AxisCore axis, AxisOrientation source);
}
}

View File

@@ -0,0 +1,190 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System;
using LiveCharts.Charts;
using LiveCharts.Dtos;
namespace LiveCharts.Definitions.Charts
{
/// <summary>
///
/// </summary>
public interface IAxisView
{
/// <summary>
/// Gets or sets the model.
/// </summary>
/// <value>
/// The model.
/// </value>
AxisCore Model { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [disable animations].
/// </summary>
/// <value>
/// <c>true</c> if [disable animations]; otherwise, <c>false</c>.
/// </value>
bool DisableAnimations { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [show labels].
/// </summary>
/// <value>
/// <c>true</c> if [show labels]; otherwise, <c>false</c>.
/// </value>
bool ShowLabels { get; set; }
/// <summary>
/// Gets or sets the maximum value.
/// </summary>
/// <value>
/// The maximum value.
/// </value>
double MaxValue { get; set; }
/// <summary>
/// Gets or sets the minimum value.
/// </summary>
/// <value>
/// The minimum value.
/// </value>
double MinValue { get; set; }
/// <summary>
/// Gets or sets the minimum range.
/// </summary>
/// <value>
/// The minimum range.
/// </value>
double MinRange { get; set; }
/// <summary>
/// Gets or sets the maximum range.
/// </summary>
/// <value>
/// The maximum range.
/// </value>
double MaxRange { get; set; }
/// <summary>
/// Gets or sets the labels rotation.
/// </summary>
/// <value>
/// The labels rotation.
/// </value>
double LabelsRotation { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is merged.
/// </summary>
/// <value>
/// <c>true</c> if this instance is merged; otherwise, <c>false</c>.
/// </value>
bool IsMerged { get; set; }
/// <summary>
/// Gets or sets the bar unit.
/// </summary>
/// <value>
/// The bar unit.
/// </value>
double Unit { get; set; }
/// <summary>
/// Gets or sets the bar unit.
/// </summary>
/// <value>
/// The bar unit.
/// </value>
[Obsolete]
double BarUnit { get; set; }
/// <summary>
/// Gets the previous maximum value.
/// </summary>
/// <value>
/// The previous maximum value.
/// </value>
double PreviousMaxValue { get; }
/// <summary>
/// Gets the previous minimum value.
/// </summary>
/// <value>
/// The previous minimum value.
/// </value>
double PreviousMinValue { get; }
/// <summary>
/// Gets the axis orientation.
/// </summary>
/// <value>
/// The axis orientation.
/// </value>
AxisOrientation AxisOrientation { get; }
/// <summary>
/// Updates the title.
/// </summary>
/// <param name="chart">The chart.</param>
/// <param name="rotationAngle">The rotation angle.</param>
/// <returns></returns>
CoreSize UpdateTitle(ChartCore chart, double rotationAngle = 0);
/// <summary>
/// Sets the title top.
/// </summary>
/// <param name="value">The value.</param>
void SetTitleTop(double value);
/// <summary>
/// Sets the title left.
/// </summary>
/// <param name="value">The value.</param>
void SetTitleLeft(double value);
/// <summary>
/// Gets the title left.
/// </summary>
/// <returns></returns>
double GetTitleLeft();
/// <summary>
/// Gets the tile top.
/// </summary>
/// <returns></returns>
double GetTileTop();
/// <summary>
/// Gets the size of the label.
/// </summary>
/// <returns></returns>
CoreSize GetLabelSize();
/// <summary>
/// Ases the core element.
/// </summary>
/// <param name="chart">The chart.</param>
/// <param name="source">The source.</param>
/// <returns></returns>
AxisCore AsCoreElement(ChartCore chart, AxisOrientation source);
/// <summary>
/// Renders the separator.
/// </summary>
/// <param name="model">The model.</param>
/// <param name="chart">The chart.</param>
void RenderSeparator(SeparatorElementCore model, ChartCore chart);
/// <summary>
/// Cleans this instance.
/// </summary>
void Clean();
/// <summary>
/// Sets the range.
/// </summary>
/// <param name="min">The minimum.</param>
/// <param name="max">The maximum.</param>
void SetRange(double min, double max);
}
}

View File

@@ -0,0 +1,39 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Definitions.Charts
{
/// <summary>
///
/// </summary>
/// <seealso cref="LiveCharts.Definitions.Charts.IChartView" />
public interface ICartesianChart : IChartView
{
/// <summary>
/// Gets or sets the visual elements.
/// </summary>
/// <value>
/// The visual elements.
/// </value>
VisualElementsCollection VisualElements { get; set; }
}
}

View File

@@ -0,0 +1,71 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using LiveCharts.Charts;
namespace LiveCharts.Definitions.Charts
{
/// <summary>
///
/// </summary>
public interface ICartesianVisualElement
{
/// <summary>
/// Gets or sets the x.
/// </summary>
/// <value>
/// The x.
/// </value>
double X { get; set; }
/// <summary>
/// Gets or sets the y.
/// </summary>
/// <value>
/// The y.
/// </value>
double Y { get; set; }
/// <summary>
/// Gets or sets the axis x.
/// </summary>
/// <value>
/// The axis x.
/// </value>
int AxisX { get; set; }
/// <summary>
/// Gets or sets the axis y.
/// </summary>
/// <value>
/// The axis y.
/// </value>
int AxisY { get; set; }
/// <summary>
/// Adds the or move.
/// </summary>
/// <param name="chart">The chart.</param>
void AddOrMove(ChartCore chart);
/// <summary>
/// Removes the specified chart.
/// </summary>
/// <param name="chart">The chart.</param>
void Remove(ChartCore chart);
}
}

View File

@@ -0,0 +1,253 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System;
using System.Collections.Generic;
using LiveCharts.Charts;
using LiveCharts.Definitions.Series;
using LiveCharts.Dtos;
using LiveCharts.Events;
namespace LiveCharts.Definitions.Charts
{
/// <summary>
///
/// </summary>
public interface IChartView
{
/// <summary>
/// Gets the model.
/// </summary>
/// <value>
/// The model.
/// </value>
ChartCore Model { get; }
/// <summary>
/// Occurs when [data click].
/// </summary>
event DataClickHandler DataClick;
/// <summary>
/// Occurs when [data hover]
/// </summary>
event DataHoverHandler DataHover;
/// <summary>
/// Gets or sets the series.
/// </summary>
/// <value>
/// The series.
/// </value>
SeriesCollection Series { get; set; }
/// <summary>
/// Gets the actual series.
/// </summary>
/// <value>
/// The actual series.
/// </value>
IEnumerable<ISeriesView> ActualSeries { get; }
/// <summary>
/// Gets or sets the tooltip timeout.
/// </summary>
/// <value>
/// The tooltip timeout.
/// </value>
TimeSpan TooltipTimeout { get; set; }
/// <summary>
/// Gets or sets the zoom.
/// </summary>
/// <value>
/// The zoom.
/// </value>
ZoomingOptions Zoom { get; set; }
/// <summary>
/// Gets or sets the zoom.
/// </summary>
/// <value>
/// The zoom.
/// </value>
PanningOptions Pan { get; set; }
/// <summary>
/// Gets or sets the zooming speed.
/// </summary>
/// <value>
/// The zooming speed.
/// </value>
double ZoomingSpeed { get; set; }
/// <summary>
/// Gets or sets the legend location.
/// </summary>
/// <value>
/// The legend location.
/// </value>
LegendLocation LegendLocation { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [disable animations].
/// </summary>
/// <value>
/// <c>true</c> if [disable animations]; otherwise, <c>false</c>.
/// </value>
bool DisableAnimations { get; set; }
/// <summary>
/// Gets or sets the animations speed.
/// </summary>
/// <value>
/// The animations speed.
/// </value>
TimeSpan AnimationsSpeed { get; set; }
/// <summary>
/// Gets or sets the state of the updater.
/// </summary>
/// <value>
/// The state of the updater.
/// </value>
UpdaterState UpdaterState { get; set; }
/// <summary>
/// Gets a value indicating whether this instance has tooltip.
/// </summary>
/// <value>
/// <c>true</c> if this instance has tooltip; otherwise, <c>false</c>.
/// </value>
bool HasTooltip { get; }
/// <summary>
/// Gets a value indicating whether this instance has data click event attached.
/// </summary>
/// <value>
/// <c>true</c> if this instance has data click event attached; otherwise, <c>false</c>.
/// </value>
bool HasDataClickEventAttached { get; }
/// <summary>
/// Gets a value indicating whether this instance has data hover event attached.
/// </summary>
/// <value>
/// <c>true</c> if this instance has data hover event attached; otherwise, <c>false</c>.
/// </value>
bool HasDataHoverEventAttached { get; }
/// <summary>
/// Gets a value indicating whether this <see cref="IChartView"/> is hoverable.
/// </summary>
/// <value>
/// <c>true</c> if hoverable; otherwise, <c>false</c>.
/// </value>
bool Hoverable { get; }
/// <summary>
/// Gets a value indicating whether this instance is control loaded.
/// </summary>
/// <value>
/// <c>true</c> if this instance is control loaded; otherwise, <c>false</c>.
/// </value>
bool IsControlLoaded { get; }
/// <summary>
/// Gets a value indicating whether this instance is in design mode.
/// </summary>
/// <value>
/// <c>true</c> if this instance is in design mode; otherwise, <c>false</c>.
/// </value>
bool IsInDesignMode { get; }
/// <summary>
/// Sets the draw margin top.
/// </summary>
/// <param name="value">The value.</param>
void SetDrawMarginTop(double value);
/// <summary>
/// Sets the draw margin left.
/// </summary>
/// <param name="value">The value.</param>
void SetDrawMarginLeft(double value);
/// <summary>
/// Sets the height of the draw margin.
/// </summary>
/// <param name="value">The value.</param>
void SetDrawMarginHeight(double value);
/// <summary>
/// Sets the width of the draw margin.
/// </summary>
/// <param name="value">The value.</param>
void SetDrawMarginWidth(double value);
/// <summary>
/// Adds to view.
/// </summary>
/// <param name="element">The element.</param>
void AddToView(object element);
/// <summary>
/// Adds to draw margin.
/// </summary>
/// <param name="element">The element.</param>
void AddToDrawMargin(object element);
/// <summary>
/// Removes from view.
/// </summary>
/// <param name="element">The element.</param>
void RemoveFromView(object element);
/// <summary>
/// Removes from draw margin.
/// </summary>
/// <param name="element">The element.</param>
void RemoveFromDrawMargin(object element);
/// <summary>
/// Ensures the element belongs to current view.
/// </summary>
/// <param name="element">The element.</param>
void EnsureElementBelongsToCurrentView(object element);
/// <summary>
/// Ensures the element belongs to current draw margin.
/// </summary>
/// <param name="element">The element.</param>
void EnsureElementBelongsToCurrentDrawMargin(object element);
/// <summary>
/// Hides the tooltip.
/// </summary>
void HideTooltip();
/// <summary>
/// Shows the legend.
/// </summary>
/// <param name="at">At.</param>
void ShowLegend(CorePoint at);
/// <summary>
/// Hides the legend.
/// </summary>
void HideLegend();
/// <summary>
/// Loads the legend.
/// </summary>
/// <returns></returns>
CoreSize LoadLegend();
/// <summary>
/// Maps the x axes.
/// </summary>
/// <param name="chart">The chart.</param>
/// <returns></returns>
List<AxisCore> MapXAxes(ChartCore chart);
/// <summary>
/// Maps the y axes.
/// </summary>
/// <param name="chart">The chart.</param>
/// <returns></returns>
List<AxisCore> MapYAxes(ChartCore chart);
}
}

View File

@@ -0,0 +1,39 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Definitions.Charts
{
/// <summary>
///
/// </summary>
/// <seealso cref="LiveCharts.Definitions.Charts.IAxisView" />
public interface ILogarithmicAxisView : IAxisView
{
/// <summary>
/// Gets or sets the base.
/// </summary>
/// <value>
/// The base.
/// </value>
double Base { get; set; }
}
}

View File

@@ -0,0 +1,53 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Definitions.Charts
{
/// <summary>
///
/// </summary>
/// <seealso cref="LiveCharts.Definitions.Charts.IChartView" />
public interface IPieChart : IChartView
{
/// <summary>
/// Gets or sets the inner radius.
/// </summary>
/// <value>
/// The inner radius.
/// </value>
double InnerRadius { get; set; }
/// <summary>
/// Gets or sets the starting rotation angle.
/// </summary>
/// <value>
/// The starting rotation angle.
/// </value>
double StartingRotationAngle { get; set; }
/// <summary>
/// Gets or sets the hover push out.
/// </summary>
/// <value>
/// The hover push out.
/// </value>
double HoverPushOut { get; set; }
}
}

View File

@@ -0,0 +1,105 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using LiveCharts.Charts;
using LiveCharts.Dtos;
namespace LiveCharts.Definitions.Charts
{
/// <summary>
///
/// </summary>
public interface ISeparatorElementView
{
/// <summary>
/// Gets the model.
/// </summary>
/// <value>
/// The model.
/// </value>
SeparatorElementCore Model { get; }
/// <summary>
/// Gets the label model.
/// </summary>
/// <value>
/// The label model.
/// </value>
LabelEvaluation LabelModel { get; }
/// <summary>
/// Updates the label.
/// </summary>
/// <param name="text">The text.</param>
/// <param name="axis">The axis.</param>
/// <param name="source">The source.</param>
/// <returns></returns>
LabelEvaluation UpdateLabel(string text, AxisCore axis, AxisOrientation source);
/// <summary>
/// Clears the specified chart.
/// </summary>
/// <param name="chart">The chart.</param>
void Clear(IChartView chart);
//No animated methods
/// <summary>
/// Places the specified chart.
/// </summary>
/// <param name="chart">The chart.</param>
/// <param name="axis">The axis.</param>
/// <param name="direction">The direction.</param>
/// <param name="axisIndex">Index of the axis.</param>
/// <param name="toLabel">To label.</param>
/// <param name="toLine">To line.</param>
/// <param name="tab">The tab.</param>
void Place(ChartCore chart, AxisCore axis, AxisOrientation direction, int axisIndex, double toLabel, double toLine, double tab);
/// <summary>
/// Removes the specified chart.
/// </summary>
/// <param name="chart">The chart.</param>
void Remove(ChartCore chart);
//Animated methods
/// <summary>
/// Moves the specified chart.
/// </summary>
/// <param name="chart">The chart.</param>
/// <param name="axis">The axis.</param>
/// <param name="direction">The direction.</param>
/// <param name="axisIndex">Index of the axis.</param>
/// <param name="toLabel">To label.</param>
/// <param name="toLine">To line.</param>
/// <param name="tab">The tab.</param>
void Move(ChartCore chart, AxisCore axis, AxisOrientation direction, int axisIndex, double toLabel, double toLine, double tab);
/// <summary>
/// Fades the in.
/// </summary>
/// <param name="axis">The axis.</param>
/// <param name="chart">The chart.</param>
void FadeIn(AxisCore axis, ChartCore chart);
/// <summary>
/// Fades the out and remove.
/// </summary>
/// <param name="chart">The chart.</param>
void FadeOutAndRemove(ChartCore chart);
}
}

View File

@@ -0,0 +1,57 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Definitions.Charts
{
/// <summary>
///
/// </summary>
public interface ISeparatorView
{
/// <summary>
/// Gets or sets a value indicating whether this instance is enabled.
/// </summary>
/// <value>
/// <c>true</c> if this instance is enabled; otherwise, <c>false</c>.
/// </value>
bool IsEnabled { get; set; }
/// <summary>
/// Gets or sets separator step, this means the value between each line, use double.NaN for auto.
/// </summary>
double Step { get; set; }
/// <summary>
/// Gets the axis orientation.
/// </summary>
/// <value>
/// The axis orientation.
/// </value>
AxisOrientation AxisOrientation { get; }
/// <summary>
/// Ases the core element.
/// </summary>
/// <param name="axis">The axis.</param>
/// <param name="source">The source.</param>
/// <returns></returns>
SeparatorConfigurationCore AsCoreElement(AxisCore axis, AxisOrientation source);
}
}

View File

@@ -0,0 +1,41 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using LiveCharts.Dtos;
namespace LiveCharts.Definitions.Points
{
/// <summary>
///
/// </summary>
/// <seealso cref="LiveCharts.Definitions.Points.IChartPointView" />
public interface IBezierPointView : IChartPointView
{
/// <summary>
/// Gets or sets the data.
/// </summary>
/// <value>
/// The data.
/// </value>
BezierData Data { get; set; }
}
}

View File

@@ -0,0 +1,73 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using LiveCharts.Charts;
using LiveCharts.Dtos;
namespace LiveCharts.Definitions.Points
{
/// <summary>
///
/// </summary>
public interface IChartPointView
{
/// <summary>
/// Gets a value indicating whether this instance is new.
/// </summary>
/// <value>
/// <c>true</c> if this instance is new; otherwise, <c>false</c>.
/// </value>
bool IsNew { get; }
/// <summary>
/// Gets the valid area.
/// </summary>
/// <value>
/// The valid area.
/// </value>
CoreRectangle ValidArea { get; }
/// <summary>
/// Draws the or move.
/// </summary>
/// <param name="previousDrawn">The previous drawn.</param>
/// <param name="current">The current.</param>
/// <param name="index">The index.</param>
/// <param name="chart">The chart.</param>
void DrawOrMove(ChartPoint previousDrawn, ChartPoint current, int index, ChartCore chart);
/// <summary>
/// Removes from view.
/// </summary>
/// <param name="chart">The chart.</param>
void RemoveFromView(ChartCore chart);
/// <summary>
/// Called when [hover].
/// </summary>
/// <param name="point">The point.</param>
void OnHover(ChartPoint point);
/// <summary>
/// Called when [hover leave].
/// </summary>
/// <param name="point">The point.</param>
void OnHoverLeave(ChartPoint point);
}
}

View File

@@ -0,0 +1,55 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using LiveCharts.Dtos;
namespace LiveCharts.Definitions.Points
{
/// <summary>
///
/// </summary>
/// <seealso cref="LiveCharts.Definitions.Points.IChartPointView" />
public interface IHeatPointView : IChartPointView
{
/// <summary>
/// Gets or sets the color components.
/// </summary>
/// <value>
/// The color components.
/// </value>
CoreColor ColorComponents { get; set; }
/// <summary>
/// Gets or sets the width.
/// </summary>
/// <value>
/// The width.
/// </value>
double Width { get; set; }
/// <summary>
/// Gets or sets the height.
/// </summary>
/// <value>
/// The height.
/// </value>
double Height { get; set; }
}
}

View File

@@ -0,0 +1,81 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Definitions.Points
{
/// <summary>
///
/// </summary>
/// <seealso cref="LiveCharts.Definitions.Points.IChartPointView" />
public interface IOhlcPointView : IChartPointView
{
/// <summary>
/// Gets or sets the open.
/// </summary>
/// <value>
/// The open.
/// </value>
double Open { get; set; }
/// <summary>
/// Gets or sets the high.
/// </summary>
/// <value>
/// The high.
/// </value>
double High { get; set; }
/// <summary>
/// Gets or sets the close.
/// </summary>
/// <value>
/// The close.
/// </value>
double Close { get; set; }
/// <summary>
/// Gets or sets the low.
/// </summary>
/// <value>
/// The low.
/// </value>
double Low { get; set; }
/// <summary>
/// Gets or sets the width.
/// </summary>
/// <value>
/// The width.
/// </value>
double Width { get; set; }
/// <summary>
/// Gets or sets the left.
/// </summary>
/// <value>
/// The left.
/// </value>
double Left { get; set; }
/// <summary>
/// Gets or sets the start reference.
/// </summary>
/// <value>
/// The start reference.
/// </value>
double StartReference { get; set; }
}
}

View File

@@ -0,0 +1,60 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Definitions.Points
{
/// <summary>
///
/// </summary>
/// <seealso cref="LiveCharts.Definitions.Points.IChartPointView" />
public interface IPieSlicePointView : IChartPointView
{
/// <summary>
/// Gets or sets the rotation.
/// </summary>
/// <value>
/// The rotation.
/// </value>
double Rotation { get; set; }
/// <summary>
/// Gets or sets the wedge.
/// </summary>
/// <value>
/// The wedge.
/// </value>
double Wedge { get; set; }
/// <summary>
/// Gets or sets the inner radius.
/// </summary>
/// <value>
/// The inner radius.
/// </value>
double InnerRadius { get; set; }
/// <summary>
/// Gets or sets the radius.
/// </summary>
/// <value>
/// The radius.
/// </value>
double Radius { get; set; }
}
}

View File

@@ -0,0 +1,48 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using LiveCharts.Dtos;
namespace LiveCharts.Definitions.Points
{
/// <summary>
///
/// </summary>
/// <seealso cref="LiveCharts.Definitions.Points.IChartPointView" />
public interface IRectanglePointView : IChartPointView
{
/// <summary>
/// Gets or sets the data.
/// </summary>
/// <value>
/// The data.
/// </value>
CoreRectangle Data { get; set; }
/// <summary>
/// Gets or sets the zero reference.
/// </summary>
/// <value>
/// The zero reference.
/// </value>
double ZeroReference { get; set; }
}
}

View File

@@ -0,0 +1,39 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Definitions.Points
{
/// <summary>
///
/// </summary>
/// <seealso cref="LiveCharts.Definitions.Points.IChartPointView" />
public interface IScatterPointView : IChartPointView
{
/// <summary>
/// Gets or sets the diameter.
/// </summary>
/// <value>
/// The diameter.
/// </value>
double Diameter { get; set; }
}
}

View File

@@ -0,0 +1,46 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Definitions.Points
{
/// <summary>
///
/// </summary>
/// <seealso cref="LiveCharts.Definitions.Points.IChartPointView" />
public interface IStepPointView : IChartPointView
{
/// <summary>
/// Gets or sets the delta x.
/// </summary>
/// <value>
/// The delta x.
/// </value>
double DeltaX { get; set; }
/// <summary>
/// Gets or sets the delta y.
/// </summary>
/// <value>
/// The delta y.
/// </value>
double DeltaY { get; set; }
}
}

View File

@@ -0,0 +1,36 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Definitions.Series
{
/// <summary>
///
/// </summary>
public interface IAreaPoint
{
/// <summary>
/// Gets the point diameter.
/// </summary>
/// <returns></returns>
double GetPointDiameter();
}
}

View File

@@ -0,0 +1,63 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Definitions.Series
{
/// <summary>
///
/// </summary>
public interface ICartesianSeries
{
/// <summary>
/// Gets the view.
/// </summary>
/// <value>
/// The view.
/// </value>
ISeriesView View { get; }
/// <summary>
/// Gets the minimum x.
/// </summary>
/// <param name="axis">The axis.</param>
/// <returns></returns>
double GetMinX(AxisCore axis);
/// <summary>
/// Gets the maximum x.
/// </summary>
/// <param name="axis">The axis.</param>
/// <returns></returns>
double GetMaxX(AxisCore axis);
/// <summary>
/// Gets the minimum y.
/// </summary>
/// <param name="axis">The axis.</param>
/// <returns></returns>
double GetMinY(AxisCore axis);
/// <summary>
/// Gets the maximum y.
/// </summary>
/// <param name="axis">The axis.</param>
/// <returns></returns>
double GetMaxY(AxisCore axis);
}
}

View File

@@ -0,0 +1,53 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Definitions.Series
{
/// <summary>
///
/// </summary>
/// <seealso cref="LiveCharts.Definitions.Series.ISeriesView" />
public interface IColumnSeriesView : ISeriesView
{
/// <summary>
/// Gets or sets the maximum width of the column.
/// </summary>
/// <value>
/// The maximum width of the column.
/// </value>
double MaxColumnWidth { get; set; }
/// <summary>
/// Gets or sets the column padding.
/// </summary>
/// <value>
/// The column padding.
/// </value>
double ColumnPadding { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [shares position].
/// </summary>
/// <value>
/// <c>true</c> if [shares position]; otherwise, <c>false</c>.
/// </value>
bool SharesPosition { get; set; }
}
}

View File

@@ -0,0 +1,39 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Definitions.Series
{
/// <summary>
///
/// </summary>
/// <seealso cref="LiveCharts.Definitions.Series.ISeriesView" />
public interface IFinancialSeriesView : ISeriesView
{
/// <summary>
/// Gets or sets the maximum width of the column.
/// </summary>
/// <value>
/// The maximum width of the column.
/// </value>
double MaxColumnWidth { get; set; }
}
}

View File

@@ -0,0 +1,49 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System.Collections.Generic;
using LiveCharts.Dtos;
namespace LiveCharts.Definitions.Series
{
/// <summary>
///
/// </summary>
/// <seealso cref="LiveCharts.Definitions.Series.ISeriesView" />
public interface IHeatSeriesView : ISeriesView
{
/// <summary>
/// Gets the stops.
/// </summary>
/// <value>
/// The stops.
/// </value>
IList<CoreGradientStop> Stops { get; }
/// <summary>
/// Gets a value indicating whether [draws heat range].
/// </summary>
/// <value>
/// <c>true</c> if [draws heat range]; otherwise, <c>false</c>.
/// </value>
bool DrawsHeatRange { get; }
}
}

View File

@@ -0,0 +1,60 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using LiveCharts.Dtos;
namespace LiveCharts.Definitions.Series
{
/// <summary>
///
/// </summary>
/// <seealso cref="LiveCharts.Definitions.Series.ISeriesView" />
public interface ILineSeriesView : ISeriesView
{
/// <summary>
/// Gets or sets the line smoothness.
/// </summary>
/// <value>
/// The line smoothness.
/// </value>
double LineSmoothness { get; set; }
/// <summary>
/// Gets or sets the area limit.
/// </summary>
/// <value>
/// The area limit.
/// </value>
double AreaLimit { get; set; }
/// <summary>
/// Starts the segment.
/// </summary>
/// <param name="atIndex">At index.</param>
/// <param name="location">The location.</param>
void StartSegment(int atIndex, CorePoint location);
/// <summary>
/// Ends the segment.
/// </summary>
/// <param name="atIndex">At index.</param>
/// <param name="location">The location.</param>
void EndSegment(int atIndex, CorePoint location);
}
}

View File

@@ -0,0 +1,38 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Definitions.Series
{
/// <summary>
///
/// </summary>
public interface IPieSeries
{
/// <summary>
/// Gets the view.
/// </summary>
/// <value>
/// The view.
/// </value>
ISeriesView View { get; }
}
}

View File

@@ -0,0 +1,39 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Definitions.Series
{
/// <summary>
///
/// </summary>
/// <seealso cref="LiveCharts.Definitions.Series.ISeriesView" />
public interface IPieSeriesView : ISeriesView
{
/// <summary>
/// Gets or sets the push out.
/// </summary>
/// <value>
/// The push out.
/// </value>
double PushOut { get; set; }
}
}

View File

@@ -0,0 +1,53 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Definitions.Series
{
/// <summary>
///
/// </summary>
/// <seealso cref="LiveCharts.Definitions.Series.ISeriesView" />
public interface IRowSeriesView : ISeriesView
{
/// <summary>
/// Gets or sets the maximum row heigth.
/// </summary>
/// <value>
/// The maximum row heigth.
/// </value>
double MaxRowHeigth { get; set; }
/// <summary>
/// Gets or sets the row padding.
/// </summary>
/// <value>
/// The row padding.
/// </value>
double RowPadding { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [shares position].
/// </summary>
/// <value>
/// <c>true</c> if [shares position]; otherwise, <c>false</c>.
/// </value>
bool SharesPosition { get; set; }
}
}

View File

@@ -0,0 +1,46 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Definitions.Series
{
/// <summary>
///
/// </summary>
/// <seealso cref="LiveCharts.Definitions.Series.ISeriesView" />
public interface IScatterSeriesView : ISeriesView
{
/// <summary>
/// Gets or sets the maximum point shape diameter.
/// </summary>
/// <value>
/// The maximum point shape diameter.
/// </value>
double MaxPointShapeDiameter { get; set; }
/// <summary>
/// Gets or sets the minimum point shape diameter.
/// </summary>
/// <value>
/// The minimum point shape diameter.
/// </value>
double MinPointShapeDiameter { get; set; }
}
}

View File

@@ -0,0 +1,149 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System;
using LiveCharts.Definitions.Points;
namespace LiveCharts.Definitions.Series
{
/// <summary>
///
/// </summary>
public interface ISeriesView
{
/// <summary>
/// Gets or sets the model.
/// </summary>
/// <value>
/// The model.
/// </value>
SeriesAlgorithm Model { get; set; }
/// <summary>
/// Gets or sets the values.
/// </summary>
/// <value>
/// The values.
/// </value>
IChartValues Values { get; set; }
/// <summary>
/// Gets a value indicating whether [data labels].
/// </summary>
/// <value>
/// <c>true</c> if [data labels]; otherwise, <c>false</c>.
/// </value>
bool DataLabels { get; }
/// <summary>
/// Gets or sets the scales x at.
/// </summary>
/// <value>
/// The scales x at.
/// </value>
int ScalesXAt { get; set; }
/// <summary>
/// Gets or sets the scales y at.
/// </summary>
/// <value>
/// The scales y at.
/// </value>
int ScalesYAt { get; set; }
/// <summary>
/// Gets or sets the configuration.
/// </summary>
/// <value>
/// The configuration.
/// </value>
object Configuration { get; set; }
/// <summary>
/// Gets a value indicating whether this instance is series visible.
/// </summary>
/// <value>
/// <c>true</c> if this instance is series visible; otherwise, <c>false</c>.
/// </value>
bool IsSeriesVisible { get; }
/// <summary>
/// Gets or sets the label point.
/// </summary>
/// <value>
/// The label point.
/// </value>
Func<ChartPoint, string> LabelPoint { get; set; }
/// <summary>
/// Gets the actual values.
/// </summary>
/// <value>
/// The actual values.
/// </value>
IChartValues ActualValues { get; }
/// <summary>
/// Gets the title.
/// </summary>
/// <value>
/// The title.
/// </value>
string Title { get; }
/// <summary>
/// Gets a value indicating whether this instance is first draw.
/// </summary>
/// <value>
/// <c>true</c> if this instance is first draw; otherwise, <c>false</c>.
/// </value>
bool IsFirstDraw { get; }
/// <summary>
/// Gets the point view.
/// </summary>
/// <param name="point">The point.</param>
/// <param name="label">The label.</param>
/// <returns></returns>
IChartPointView GetPointView(ChartPoint point, string label);
/// <summary>
/// Called when [series update start].
/// </summary>
void OnSeriesUpdateStart();
/// <summary>
/// Erases the specified remove from view.
/// </summary>
/// <param name="removeFromView">if set to <c>true</c> [remove from view].</param>
void Erase(bool removeFromView);
/// <summary>
/// Called when [series updated finish].
/// </summary>
void OnSeriesUpdatedFinish();
/// <summary>
/// Initializes the colors.
/// </summary>
void InitializeColors();
/// <summary>
/// Draws the specialized elements.
/// </summary>
void DrawSpecializedElements();
/// <summary>
/// Places the specialized elements.
/// </summary>
void PlaceSpecializedElements();
/// <summary>
/// Gets the label point formatter.
/// </summary>
/// <returns></returns>
Func<ChartPoint, string> GetLabelPointFormatter();
}
}

View File

@@ -0,0 +1,38 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Definitions.Series
{
/// <summary>
///
/// </summary>
public interface IStackModelableSeriesView
{
/// <summary>
/// Gets or sets the stack mode.
/// </summary>
/// <value>
/// The stack mode.
/// </value>
StackMode StackMode { get; set; }
}
}

View File

@@ -0,0 +1,34 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Definitions.Series
{
/// <summary>
///
/// </summary>
/// <seealso cref="LiveCharts.Definitions.Series.ILineSeriesView" />
/// <seealso cref="LiveCharts.Definitions.Series.IStackModelableSeriesView" />
public interface IStackedAreaSeriesView : ILineSeriesView, IStackModelableSeriesView
{
}
}

View File

@@ -0,0 +1,47 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Definitions.Series
{
/// <summary>
///
/// </summary>
/// <seealso cref="LiveCharts.Definitions.Series.ISeriesView" />
/// <seealso cref="LiveCharts.Definitions.Series.IStackModelableSeriesView" />
public interface IStackedColumnSeriesView : ISeriesView, IStackModelableSeriesView
{
/// <summary>
/// Gets or sets the maximum width of the column.
/// </summary>
/// <value>
/// The maximum width of the column.
/// </value>
double MaxColumnWidth { get; set; }
/// <summary>
/// Gets or sets the column padding.
/// </summary>
/// <value>
/// The column padding.
/// </value>
double ColumnPadding { get; set; }
}
}

View File

@@ -0,0 +1,47 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Definitions.Series
{
/// <summary>
///
/// </summary>
/// <seealso cref="LiveCharts.Definitions.Series.ISeriesView" />
/// <seealso cref="LiveCharts.Definitions.Series.IStackModelableSeriesView" />
public interface IStackedRowSeriesView : ISeriesView, IStackModelableSeriesView
{
/// <summary>
/// Gets or sets the maximum height of the row.
/// </summary>
/// <value>
/// The maximum height of the row.
/// </value>
double MaxRowHeight { get; set; }
/// <summary>
/// Gets or sets the row padding.
/// </summary>
/// <value>
/// The row padding.
/// </value>
double RowPadding { get; set; }
}
}

View File

@@ -0,0 +1,34 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Definitions.Series
{
/// <summary>
///
/// </summary>
/// <seealso cref="LiveCharts.Definitions.Series.ILineSeriesView" />
/// <seealso cref="LiveCharts.Definitions.Series.IStackModelableSeriesView" />
public interface IVerticalStackedAreaSeriesView : ILineSeriesView, IStackModelableSeriesView
{
}
}

View File

@@ -0,0 +1,79 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Dtos
{
/// <summary>
///
/// </summary>
public class BezierData
{
/// <summary>
/// Initializes a new instance of the <see cref="BezierData"/> class.
/// </summary>
public BezierData()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="BezierData"/> class.
/// </summary>
/// <param name="point">The point.</param>
public BezierData(CorePoint point)
{
Point1 = point;
Point2 = point;
Point3 = point;
}
/// <summary>
/// Gets or sets the point1.
/// </summary>
/// <value>
/// The point1.
/// </value>
public CorePoint Point1 { get; set; }
/// <summary>
/// Gets or sets the point2.
/// </summary>
/// <value>
/// The point2.
/// </value>
public CorePoint Point2 { get; set; }
/// <summary>
/// Gets or sets the point3.
/// </summary>
/// <value>
/// The point3.
/// </value>
public CorePoint Point3 { get; set; }
/// <summary>
/// Gets or sets the start point.
/// </summary>
/// <value>
/// The start point.
/// </value>
public CorePoint StartPoint { get; set; }
}
}

View File

@@ -0,0 +1,63 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Dtos
{
/// <summary>
/// Defines a portable color
/// </summary>
public struct CoreColor
{
/// <summary>
/// Initializes a new instance of CoreColor
/// </summary>
/// <param name="a">alpha component</param>
/// <param name="r">red component</param>
/// <param name="g">green component</param>
/// <param name="b">blue component</param>
public CoreColor(byte a, byte r, byte g, byte b) : this()
{
A = a;
R = r;
G = g;
B = b;
}
/// <summary>
/// Alpha component
/// </summary>
public byte A { get; set; }
/// <summary>
/// Red component
/// </summary>
public byte R { get; set; }
/// <summary>
/// Green component
/// </summary>
public byte G { get; set; }
/// <summary>
/// Red component
/// </summary>
public byte B { get; set; }
}
}

View File

@@ -0,0 +1,40 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Dtos
{
/// <summary>
/// Portable color gradient stop
/// </summary>
public struct CoreGradientStop
{
/// <summary>
/// Offset, goes from 0 to 1
/// </summary>
public double Offset { get; set; }
/// <summary>
/// Color at Offset
/// </summary>
public CoreColor Color { get; set; }
}
}

View File

@@ -0,0 +1,54 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Dtos
{
/// <summary>
/// Defines a portable limit
/// </summary>
public struct CoreLimit
{
/// <summary>
/// Initializes a new instance of CoreLimit
/// </summary>
/// <param name="min">minimum value</param>
/// <param name="max">maximum value</param>
public CoreLimit(double min, double max) : this()
{
Max = max;
Min = min;
}
/// <summary>
/// Gets or sets the maximum value
/// </summary>
public double Max { get; set; }
/// <summary>
/// Gets or sets the minimum value
/// </summary>
public double Min { get; set; }
/// <summary>
/// Gets the range between max and min values
/// </summary>
public double Range { get { return Max - Min; } }
}
}

View File

@@ -0,0 +1,56 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Dtos
{
/// <summary>
/// Defines a portable margin
/// </summary>
public class CoreMargin
{
/// <summary>
/// Distance to top
/// </summary>
public double Top { get; set; }
/// <summary>
/// Distance to bottom
/// </summary>
public double Bottom { get; set; }
/// <summary>
/// Distance to left
/// </summary>
public double Left { get; set; }
/// <summary>
/// Distance to right
/// </summary>
public double Right { get; set; }
/// <summary>
/// Size width
/// </summary>
public double Width { get; set; }
/// <summary>
/// Size height
/// </summary>
public double Height { get; set; }
}
}

View File

@@ -0,0 +1,82 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Dtos
{
/// <summary>
///
/// </summary>
public struct CorePoint
{
/// <summary>
/// Initializes a new instance of CorePoint
/// </summary>
/// <param name="x">x coordinate</param>
/// <param name="y">y coordinate</param>
public CorePoint(double x, double y) : this()
{
X = x;
Y = y;
}
/// <summary>
/// Initializes a new instance of CorePoint
/// </summary>
/// <param name="point">source pont</param>
public CorePoint(CorePoint point) : this()
{
X = point.X;
Y = point.Y;
}
/// <summary>
/// X coordinate
/// </summary>
public double X { get; set; }
/// <summary>
/// Y coordinate
/// </summary>
public double Y { get; set; }
/// <summary>
/// Sums every property between 2 given points
/// </summary>
/// <param name="p1">point 1</param>
/// <param name="p2">point 2</param>
/// <returns></returns>
public static CorePoint operator +(CorePoint p1, CorePoint p2)
{
return new CorePoint(p1.X + p2.X, p1.Y + p2.Y);
}
/// <summary>
/// Subtracts every property between 2 given points
/// </summary>
/// <param name="p1">point 1</param>
/// <param name="p2">point 2</param>
/// <returns></returns>
public static CorePoint operator -(CorePoint p1, CorePoint p2)
{
return new CorePoint(p1.X - p2.X, p1.Y - p2.Y);
}
}
}

View File

@@ -0,0 +1,142 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System;
namespace LiveCharts.Dtos
{
/// <summary>
///
/// </summary>
public class CoreRectangle
{
private double _left;
private double _top;
private double _width;
private double _height;
/// <summary>
/// Initializes a new instance of the <see cref="CoreRectangle"/> class.
/// </summary>
public CoreRectangle()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CoreRectangle"/> class.
/// </summary>
/// <param name="left">The left.</param>
/// <param name="top">The top.</param>
/// <param name="width">The width.</param>
/// <param name="height">The height.</param>
public CoreRectangle(double left, double top, double width, double height) : this()
{
Left = left;
Top = top;
Width = width;
Height = height;
}
/// <summary>
/// Occurs when [set top].
/// </summary>
public event Action<double> SetTop;
/// <summary>
/// Occurs when [set left].
/// </summary>
public event Action<double> SetLeft;
/// <summary>
/// Occurs when [set width].
/// </summary>
public event Action<double> SetWidth;
/// <summary>
/// Occurs when [set height].
/// </summary>
public event Action<double> SetHeight;
/// <summary>
/// Gets or sets the left.
/// </summary>
/// <value>
/// The left.
/// </value>
public double Left
{
get { return _left; }
set
{
_left = value;
if (SetLeft != null) SetLeft.Invoke(value);
}
}
/// <summary>
/// Gets or sets the top.
/// </summary>
/// <value>
/// The top.
/// </value>
public double Top
{
get { return _top; }
set
{
_top = value;
if (SetTop != null) SetTop.Invoke(value);
}
}
/// <summary>
/// Gets or sets the width.
/// </summary>
/// <value>
/// The width.
/// </value>
public double Width
{
get { return _width; }
set
{
_width = value < 0 ? 0 : value;
if (SetWidth != null) SetWidth.Invoke(value);
}
}
/// <summary>
/// Gets or sets the height.
/// </summary>
/// <value>
/// The height.
/// </value>
public double Height
{
get { return _height; }
set
{
_height = value < 0 ? 0 : value;
if (SetHeight != null) SetHeight.Invoke(value);
}
}
}
}

View File

@@ -0,0 +1,56 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Dtos
{
/// <summary>
///
/// </summary>
public struct CoreSize
{
/// <summary>
/// Initializes a new instance of the <see cref="CoreSize"/> struct.
/// </summary>
/// <param name="width">The width.</param>
/// <param name="heigth">The heigth.</param>
public CoreSize(double width, double heigth) : this()
{
Width = width;
Height = heigth;
}
/// <summary>
/// Gets or sets the width.
/// </summary>
/// <value>
/// The width.
/// </value>
public double Width { get; set; }
/// <summary>
/// Gets or sets the height.
/// </summary>
/// <value>
/// The height.
/// </value>
public double Height { get; set; }
}
}

View File

@@ -0,0 +1,331 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System;
namespace LiveCharts.Dtos
{
/// <summary>
///
/// </summary>
public struct LabelEvaluation
{
/// <summary>
/// Initializes a new instance of the <see cref="LabelEvaluation"/> struct.
/// </summary>
/// <param name="angle">The angle.</param>
/// <param name="w">The w.</param>
/// <param name="h">The h.</param>
/// <param name="axis">The axis.</param>
/// <param name="source">The source.</param>
public LabelEvaluation(double angle, double w, double h, AxisCore axis, AxisOrientation source) : this()
{
const double padding = 4;
ActualWidth = w;
ActualHeight = h;
// for now there is no support for rotated and merged labels.
// the labels will be rotated but there is no warranty that they are displayed correctly
if (axis.View.IsMerged)
{
Top = 0;
Bottom = 0;
Left = 0;
Right = 0;
if (source == AxisOrientation.Y)
{
XOffset = padding;
YOffset = padding;
}
else
{
if (axis.Position == AxisPosition.LeftBottom)
{
//Bot
XOffset = padding;
YOffset = -h * 2 - padding;
}
else
{
//Top
XOffset = padding;
YOffset = padding + h * 2;
}
}
return;
}
//OK now lets evaluate the rotation angle...
// the rotation angle starts from an horizontal line, yes like this text
// - 0°, | 90°, - 180°, | 270°
// notice normally rotating a label from 90 to 270° will show the label
// in a wrong orientation
// we need to fix that angle
const double toRadians = Math.PI / 180;
// 1. width components
// 2. height components
WFromW = Math.Abs(Math.Cos(angle * toRadians) * w); // W generated from the width of the label
WFromH = Math.Abs(Math.Sin(angle * toRadians) * h); // W generated from the height of the label
HFromW = Math.Abs(Math.Sin(angle * toRadians) * w); // H generated from the width of the label
HFromH = Math.Abs(Math.Cos(angle * toRadians) * h); // H generated from the height of the label
LabelAngle = angle % 360;
if (LabelAngle < 0) LabelAngle += 360;
if (LabelAngle > 90 && LabelAngle < 270)
LabelAngle = (LabelAngle + 180) % 360;
//at this points angles should only exist in 1st and 4th quadrant
//those are the only quadrants that generates readable labels
//the other 2 quadrants display inverted labels
var quadrant = ((int)(LabelAngle / 90)) % 4 + 1;
if (source == AxisOrientation.Y)
{
// Y Axis
if (quadrant == 1)
{
if (axis.Position == AxisPosition.LeftBottom)
{
// 1, L
Top = HFromW + (HFromH / 2); //space taken from separator to top
Bottom = TakenHeight - Top; //space taken from separator to bottom
XOffset = -WFromW - padding; //distance from separator to label origin in X
YOffset = -Top; //distance from separator to label origin in Y
}
else
{
// 1, R
Bottom = HFromW + (HFromH / 2);
Top = TakenHeight - Bottom;
XOffset = padding + WFromH;
YOffset = -Top;
}
}
else
{
if (axis.Position == AxisPosition.LeftBottom)
{
// 4, L
Bottom = HFromW + (HFromH / 2);
Top = TakenHeight - Bottom;
XOffset = -TakenWidth - padding;
YOffset = HFromW - (HFromH / 2);
}
else
{
// 4, R
Top = HFromW + (HFromH / 2);
Bottom = TakenHeight - Top;
XOffset = padding;
YOffset = -Bottom;
}
}
}
else
{
// X Axis
//axis x has one exception, if labels rotation equals 0° then the label is centered
if (Math.Abs(axis.View.LabelsRotation) < .01)
{
Left = TakenWidth / 2;
Right = Left;
XOffset = -Left;
YOffset = axis.Position == AxisPosition.LeftBottom
? padding
: -padding - TakenHeight;
}
else
{
if (quadrant == 1)
{
if (axis.Position == AxisPosition.LeftBottom)
{
//1, B
Right = WFromW + (WFromH / 2); //space taken from separator to right
Left = TakenWidth - Right; //space taken from separator to left
XOffset = Left; //distance from separator to label origin in X
YOffset = padding; //distance from separator to label origin in Y
}
else
{
//1, T
Left = WFromW + (WFromH / 2);
Right = TakenWidth - Left;
XOffset = -WFromW;
YOffset = -padding - TakenHeight;
}
}
else
{
if (axis.Position == AxisPosition.LeftBottom)
{
//4, B
Left = WFromW + (WFromH / 2);
Right = TakenWidth - Left;
XOffset = -Left;
YOffset = padding + HFromW;
}
else
{
//4, T
Right = WFromW + (WFromH / 2);
Left = TakenWidth - Right;
XOffset = -Left;
YOffset = -HFromH;
}
}
}
}
}
/// <summary>
/// Gets or sets the label angle.
/// </summary>
/// <value>
/// The label angle.
/// </value>
public double LabelAngle { get; set; }
/// <summary>
/// Gets or sets the w from w.
/// </summary>
/// <value>
/// The w from w.
/// </value>
public double WFromW { get; set; }
/// <summary>
/// Gets or sets the w from h.
/// </summary>
/// <value>
/// The w from h.
/// </value>
public double WFromH { get; set; }
/// <summary>
/// Gets or sets the h from w.
/// </summary>
/// <value>
/// The h from w.
/// </value>
public double HFromW { get; set; }
/// <summary>
/// Gets or sets the h from h.
/// </summary>
/// <value>
/// The h from h.
/// </value>
public double HFromH { get; set; }
/// <summary>
/// Gets or sets the top.
/// </summary>
/// <value>
/// The top.
/// </value>
public double Top { get; set; }
/// <summary>
/// Gets or sets the bottom.
/// </summary>
/// <value>
/// The bottom.
/// </value>
public double Bottom { get; set; }
/// <summary>
/// Gets or sets the left.
/// </summary>
/// <value>
/// The left.
/// </value>
public double Left { get; set; }
/// <summary>
/// Gets or sets the right.
/// </summary>
/// <value>
/// The right.
/// </value>
public double Right { get; set; }
/// <summary>
/// Gets or sets the x offset.
/// </summary>
/// <value>
/// The x offset.
/// </value>
public double XOffset { get; set; }
/// <summary>
/// Gets or sets the y offset.
/// </summary>
/// <value>
/// The y offset.
/// </value>
public double YOffset { get; set; }
/// <summary>
/// Gets the width of the taken.
/// </summary>
/// <value>
/// The width of the taken.
/// </value>
public double TakenWidth { get { return WFromW + WFromH; } }
/// <summary>
/// Gets the height of the taken.
/// </summary>
/// <value>
/// The height of the taken.
/// </value>
public double TakenHeight { get { return HFromW + HFromH; } }
/// <summary>
/// Gets the actual width.
/// </summary>
/// <value>
/// The actual width.
/// </value>
public double ActualWidth { get; private set; }
/// <summary>
/// Gets the actual height.
/// </summary>
/// <value>
/// The actual height.
/// </value>
public double ActualHeight { get; private set; }
/// <summary>
/// Gets the offset by source.
/// </summary>
/// <param name="source">The source.</param>
/// <returns></returns>
public double GetOffsetBySource(AxisOrientation source)
{
return source == AxisOrientation.X
? XOffset
: YOffset;
}
}
}

View File

@@ -0,0 +1,42 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Dtos
{
internal struct StackedSum
{
public StackedSum(double value) : this()
{
if (value < 0)
{
Left = value;
}
else
{
Right = value;
}
}
public double Left { get; set; }
public double Right { get; set; }
}
}

View File

@@ -0,0 +1,62 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System;
using System.Collections.Generic;
namespace LiveCharts.Dtos
{
/// <summary>
///
/// </summary>
public struct TooltipDataViewModel
{
/// <summary>
/// Gets or sets the points.
/// </summary>
/// <value>
/// The points.
/// </value>
public IEnumerable<ChartPoint> Points { get; set; }
/// <summary>
/// Gets or sets the shares.
/// </summary>
/// <value>
/// The shares.
/// </value>
public double? Shares { get; set; }
/// <summary>
/// Gets or sets the x formatter.
/// </summary>
/// <value>
/// The x formatter.
/// </value>
public Func<double, string> XFormatter { get; set; }
/// <summary>
/// Gets or sets the y formatter.
/// </summary>
/// <value>
/// The y formatter.
/// </value>
public Func<double, string> YFormatter { get; set; }
}
}

View File

@@ -0,0 +1,56 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Events
{
/// <summary>
///
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="chartPoint">The chart point.</param>
public delegate void DataClickHandler(object sender, ChartPoint chartPoint);
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="chartPoint"></param>
public delegate void DataHoverHandler(object sender, ChartPoint chartPoint);
/// <summary>
///
/// </summary>
/// <param name="sender">The sender.</param>
public delegate void UpdaterTickHandler(object sender);
/// <summary>
///
/// </summary>
/// <param name="eventArgs">The <see cref="RangeChangedEventArgs"/> instance containing the event data.</param>
public delegate void RangeChangedHandler(RangeChangedEventArgs eventArgs);
/// <summary>
///
/// </summary>
/// <param name="eventArgs">The <see cref="PreviewRangeChangedEventArgs"/> instance containing the event data.</param>
public delegate void PreviewRangeChangedHandler(PreviewRangeChangedEventArgs eventArgs);
}

View File

@@ -0,0 +1,73 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Events
{
/// <summary>
///
/// </summary>
/// <seealso cref="LiveCharts.Events.RangeChangedEventArgs" />
public class PreviewRangeChangedEventArgs : RangeChangedEventArgs
{
/// <summary>
/// Initializes a new instance of the <see cref="PreviewRangeChangedEventArgs"/> class.
/// </summary>
public PreviewRangeChangedEventArgs()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="PreviewRangeChangedEventArgs"/> class.
/// </summary>
/// <param name="args">The <see cref="RangeChangedEventArgs"/> instance containing the event data.</param>
public PreviewRangeChangedEventArgs(RangeChangedEventArgs args)
{
LeftLimitChange = args.LeftLimitChange;
RightLimitChange = args.RightLimitChange;
Range = args.Range;
Axis = args.Axis;
}
/// <summary>
/// Gets or sets a value indicating whether the axis change was canceled by the user.
/// </summary>
/// <value>
/// <c>true</c> if cancel; otherwise, <c>false</c>.
/// </value>
public bool Cancel { get; set; }
/// <summary>
/// Gets the preview minimum value.
/// </summary>
/// <value>
/// The preview minimum value.
/// </value>
public double PreviewMinValue { get; internal set; }
/// <summary>
/// Gets the preview maximum value.
/// </summary>
/// <value>
/// The preview maximum value.
/// </value>
public double PreviewMaxValue { get; internal set; }
}
}

View File

@@ -0,0 +1,47 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts.Events
{
/// <summary>
///
/// </summary>
public class RangeChangedEventArgs
{
/// <summary>
/// Gets the min limit difference compared with previous state
/// </summary>
public double LeftLimitChange { get; internal set; }
/// <summary>
/// Gets the max limit difference compared with previous state
/// </summary>
public double RightLimitChange { get; internal set; }
/// <summary>
/// Gets the current axis range
/// </summary>
public double Range { get; internal set; }
/// <summary>
/// Gets the axis that fired the change
/// </summary>
public object Axis { get; internal set; }
}
}

View File

@@ -0,0 +1,138 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System;
using System.Collections.Generic;
using LiveCharts.Definitions.Series;
using LiveCharts.Dtos;
namespace LiveCharts.Helpers
{
/// <summary>
/// LiveCharts extensions methods
/// </summary>
public static class Extentions
{
/// <summary>
/// Executes an Action in every item of a collection
/// </summary>
/// <typeparam name="T">type to iterate with</typeparam>
/// <param name="source">collection to iterate</param>
/// <param name="predicate">action to execute</param>
internal static void ForEach<T>(this IEnumerable<T> source, Action<T> predicate)
{
foreach (var item in source) predicate(item);
}
/// <summary>
/// Splits a collection of points every double.Nan
/// </summary>
/// <param name="toSplit">collection to split</param>
/// <returns>collection of collections</returns>
internal static IEnumerable<IList<ChartPoint>> SplitEachNaN(this IList<ChartPoint> toSplit)
{
var l = new List<ChartPoint>(toSplit.Count);
var acum = -1;
foreach (var point in toSplit)
{
if (double.IsNaN(point.X) || double.IsNaN(point.Y))
{
yield return l;
acum += l.Count;
l = new List<ChartPoint>(toSplit.Count - acum);
}
else
{
l.Add(point);
}
}
yield return l;
}
/// <summary>
/// Return the inverse axis orientation
/// </summary>
/// <param name="axis">current orientation</param>
/// <returns>inverted axis orientation</returns>
internal static AxisOrientation Invert(this AxisOrientation axis)
{
return axis == AxisOrientation.X
? AxisOrientation.Y
: AxisOrientation.X;
}
/// <summary>
/// Converts any collection to chart values
/// </summary>
/// <typeparam name="T">type to convert</typeparam>
/// <param name="values">values to convert</param>
/// <returns>a new ChartValues instance containing the passed collection</returns>
public static ChartValues<T> AsChartValues<T>(this IEnumerable<T> values)
{
var l = new ChartValues<T>();
l.AddRange(values);
return l;
}
/// <summary>
/// Converts an enumeration of series to a SeriesCollection instance.
/// </summary>
/// <param name="series">The series.</param>
/// <returns></returns>
public static SeriesCollection AsSeriesCollection(this IEnumerable<ISeriesView> series)
{
var collection = new SeriesCollection();
collection.AddRange(series);
return collection;
}
/// <summary>
/// Gets the closest chart point with a given value.
/// </summary>
/// <param name="series">The target series.</param>
/// <param name="value">The value.</param>
/// <param name="orientation">the axis orientation</param>
/// <returns></returns>
public static ChartPoint ClosestPointTo(this ISeriesView series, double value, AxisOrientation orientation)
{
ChartPoint t = null;
var delta = double.PositiveInfinity;
foreach (var point in series.Values.GetPoints(series))
{
var i = orientation == AxisOrientation.X ? point.X : point.Y;
var di = Math.Abs(i - value);
if (di < delta)
{
t = point;
delta = di;
}
}
return t;
}
}
}

View File

@@ -0,0 +1,69 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System;
namespace LiveCharts.Helpers
{
/// <summary>
///
/// </summary>
/// <seealso cref="System.Exception" />
public class LiveChartsException : Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="LiveChartsException"/> class.
/// </summary>
public LiveChartsException()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="LiveChartsException"/> class.
/// </summary>
/// <param name="message">The message that describes the error.</param>
public LiveChartsException(string message) : base(message)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="LiveChartsException"/> class.
/// </summary>
/// <param name="message">The error message that explains the reason for the exception.</param>
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified.</param>
public LiveChartsException(string message, Exception innerException)
: base(message, innerException)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="LiveChartsException"/> class.
/// </summary>
/// <param name="format">The format.</param>
/// <param name="innerException">The inner exception.</param>
/// <param name="args">The arguments.</param>
public LiveChartsException(string format, Exception innerException, params object[] args)
: base(string.Format(format, args), innerException)
{
}
}
}

View File

@@ -0,0 +1,615 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
namespace LiveCharts.Helpers
{
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="oldItems">The old items.</param>
/// <param name="newItems">The new items.</param>
public delegate void NoisyCollectionCollectionChanged<in T>(
IEnumerable<T> oldItems, IEnumerable<T> newItems);
/// <summary>
///
/// </summary>
/// <seealso cref="System.Collections.IList" />
public interface INoisyCollection : IList, INotifyPropertyChanged, INotifyCollectionChanged
{
/// <summary>
/// Occurs when [noisy collection changed].
/// </summary>
event NoisyCollectionCollectionChanged<object> NoisyCollectionChanged;
/// <summary>
/// Adds the range.
/// </summary>
/// <param name="items">The items.</param>
void AddRange(IEnumerable<object> items);
/// <summary>
/// Inserts the range.
/// </summary>
/// <param name="index">The index.</param>
/// <param name="collection">The collection.</param>
void InsertRange(int index, IEnumerable<object> collection);
}
/// <summary>
/// A collection that notifies every time a value is added or removed
/// </summary>
/// <typeparam name="T"></typeparam>
public class NoisyCollection<T> : INoisyCollection, IList<T>
{
#region Private Fields
private readonly object _sync = new object();
private readonly List<T> _source;
private const string CountString = "Count";
private const string IndexerString = "Item[]";
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of NoisyCollection class
/// </summary>
public NoisyCollection()
{
_source = new List<T>();
}
/// <summary>
/// Initializes a new instance of NoisyCollection class with a given collection
/// </summary>
/// <param name="collection">given collection</param>
public NoisyCollection(IEnumerable<T> collection)
{
_source = new List<T>(collection);
}
/// <summary>
/// Initializes a new instance of NoisiCollection class with a given capacity
/// </summary>
/// <param name="capacity">given capacity</param>
public NoisyCollection(int capacity)
{
_source = new List<T>(capacity);
}
#endregion
#region Events
/// <summary>
/// Occurs when [collection reset].
/// </summary>
public event Action CollectionReset;
/// <summary>
/// Occurs when [noisy collection changed].
/// </summary>
event NoisyCollectionCollectionChanged<object> INoisyCollection.NoisyCollectionChanged
{
add { NoisyCollectionChanged += value as NoisyCollectionCollectionChanged<T>; }
remove { NoisyCollectionChanged -= value as NoisyCollectionCollectionChanged<T>; }
}
/// <summary>
/// Occurs when [noisy collection changed].
/// </summary>
public event NoisyCollectionCollectionChanged<T> NoisyCollectionChanged;
/// <summary>
/// Occurs when the collection changes.
/// </summary>
public virtual event NotifyCollectionChangedEventHandler CollectionChanged;
/// <summary>
/// Occurs when a property value changes.
/// </summary>
protected virtual event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// Occurs when a property value changes.
/// </summary>
event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged
{
add
{
PropertyChanged += value;
}
remove
{
PropertyChanged -= value;
}
}
#endregion
#region Properties
/// <summary>
/// Gets or sets an item from/in a specific index
/// </summary>
/// <param name="index">index to get/set</param>
/// <returns></returns>
public T this[int index]
{
get
{
lock (_sync)
{
return _source[index];
}
}
set
{
var original = this[index];
lock (_sync)
{
_source[index] = value;
}
ReplaceItem(original, value, index);
}
}
/// <summary>
/// Gets or sets an item from/in a specific index
/// </summary>
/// <param name="index">index to get/set</param>
/// <returns></returns>
object IList.this[int index]
{
get
{
lock (_sync)
{
return _source[index];
}
}
set
{
var original = this[index];
lock (_sync)
{
_source[index] = (T)value;
}
ReplaceItem(original, value, index);
}
}
/// <summary>
/// Enumerates the collection
/// </summary>
/// <returns>collection enumeration</returns>
public IEnumerator<T> GetEnumerator()
{
lock (_sync)
{
return new List<T>(_source).GetEnumerator();
}
}
/// <summary>
/// Enumerates the collection
/// </summary>
/// <returns>collection enumeration</returns>
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
/// <summary>
/// Gets the number of items in the array
/// </summary>
/// <returns>items count</returns>
public int Count
{
get { return _source.Count; }
}
/// <summary>
/// Gets whether the collection is read only
/// </summary>
/// <returns>result</returns>
bool ICollection<T>.IsReadOnly
{
get { return ((ICollection<T>)_source).IsReadOnly; }
}
/// <summary>
/// Gets the number of items in the array
/// </summary>
/// <returns>result</returns>
bool IList.IsReadOnly
{
get { return ((IList)_source).IsReadOnly; }
}
/// <summary>
/// Gets whether the collection is synchronized
/// </summary>
/// <returns>result</returns>
public bool IsSynchronized
{
get { return ((ICollection)_source).IsSynchronized; }
}
/// <summary>
/// Gets the collections's sync root
/// </summary>
public object SyncRoot
{
get { return ((ICollection)_source).SyncRoot; }
}
/// <summary>
/// Gets whether the collection is fixed
/// </summary>
public bool IsFixedSize { get { return ((IList)_source).IsFixedSize; } }
#endregion
#region Public Methods
/// <summary>
/// Adds an object to the collection, and notifies the change
/// </summary>
/// <param name="value">item to add</param>
/// <returns>number of items in the collection</returns>
int IList.Add(object value)
{
var v = (T)value;
Add(v);
lock (_sync)
{
return _source.IndexOf(v);
}
}
/// <summary>
/// Add an item to the collection, and notifies the change
/// </summary>
/// <returns>number of items in the collection</returns>
public void Add(T item)
{
lock (_sync)
{
_source.Add(item);
}
OnNoisyCollectionChanged(null, new[] { item });
OnPropertyChanged(CountString);
OnPropertyChanged(IndexerString);
OnCollectionChanged(new NotifyCollectionChangedEventArgs(
NotifyCollectionChangedAction.Add, item, _source.Count - 1));
}
/// <summary>
/// Adds many items to the collection, and notifies the change
/// </summary>
/// <param name="items">collection to add</param>
public void AddRange(IEnumerable<object> items)
{
AddRange(items.Cast<T>());
}
/// <summary>
/// Adds many items to the collection, and notifies the change
/// </summary>
/// <param name="items">collection to add</param>
public void AddRange(IEnumerable<T> items)
{
var newItems = items as T[] ?? items.ToArray();
lock (_sync)
{
_source.AddRange(newItems);
}
OnNoisyCollectionChanged(null, newItems);
OnPropertyChanged(CountString);
OnPropertyChanged(IndexerString);
//This scenario is not supported normally in ObservableCollections
//in this case we'll send a reset action.
OnCollectionChanged(new NotifyCollectionChangedEventArgs(
NotifyCollectionChangedAction.Reset));
}
/// <summary>
/// Insert an item in a specific index, then notifies the change
/// </summary>
/// <param name="index">index to insert at</param>
/// <param name="item">item to insert</param>
public void Insert(int index, T item)
{
lock (_sync)
{
_source.Insert(index, item);
}
OnNoisyCollectionChanged(null, new[] { item });
OnPropertyChanged(CountString);
OnPropertyChanged(IndexerString);
OnCollectionChanged(new NotifyCollectionChangedEventArgs(
NotifyCollectionChangedAction.Add, item, index));
}
/// <summary>
/// Insert an item in a specific index, then notifies the change
/// </summary>
/// <param name="index">index to insert at</param>
/// <param name="value">item to insert</param>
public void Insert(int index, object value)
{
Insert(index, (T)value);
}
/// <summary>
/// Insert a range of values, starting in a specific index, then notifies the change
/// </summary>
/// <param name="index">index to start at</param>
/// <param name="collection">collection to insert</param>
public void InsertRange(int index, IEnumerable<object> collection)
{
InsertRange(index, collection.Cast<T>());
}
/// <summary>
/// Insert a range of values, starting in a specific index, then notifies the change
/// </summary>
/// <param name="index">index to start at</param>
/// <param name="collection">collection to insert</param>
public void InsertRange(int index, IEnumerable<T> collection)
{
var newItems = collection as T[] ?? collection.ToArray();
lock (_sync)
{
_source.InsertRange(index, newItems);
}
OnNoisyCollectionChanged(null, newItems);
OnPropertyChanged(CountString);
OnPropertyChanged(IndexerString);
//This scenario is not supported normally in ObservableCollections
//in this case we'll send a reset action.
OnCollectionChanged(new NotifyCollectionChangedEventArgs(
NotifyCollectionChangedAction.Reset));
}
/// <summary>
/// Removes an item from a collection, then notifies the change
/// </summary>
/// <param name="value">item to remove</param>
public void Remove(object value)
{
Remove((T)value);
}
/// <summary>
/// Remove an item from a collection, then notifies the change
/// </summary>
/// <param name="item">item to remove</param>
/// <returns>number of items in the collection</returns>
public bool Remove(T item)
{
int index;
lock (_sync)
{
index = _source.IndexOf(item);
}
if (index < 0) return false;
RemoveAt(index);
return true;
}
/// <summary>
/// Removes an item at a specific index, then notifies the change
/// </summary>
/// <param name="index">index to remove at</param>
void IList.RemoveAt(int index)
{
RemoveAt(index);
}
/// <summary>
/// Removes an item at a specific index, then notifies the change
/// </summary>
/// <param name="index">index to remove at</param>
void IList<T>.RemoveAt(int index)
{
RemoveAt(index);
}
/// <summary>
/// Removes an item at a specific index, then notifies the change
/// </summary>
/// <param name="index">index to remove at</param>
public void RemoveAt(int index)
{
T item;
lock (_sync)
{
item = _source[index];
_source.RemoveAt(index);
}
OnNoisyCollectionChanged(new[] { item }, null);
OnPropertyChanged(CountString);
OnPropertyChanged(IndexerString);
OnCollectionChanged(new NotifyCollectionChangedEventArgs(
NotifyCollectionChangedAction.Remove, item, index));
}
/// <summary>
/// Removes all the items from the collection, then notifies the change
/// </summary>
void IList.Clear()
{
Clear();
}
/// <summary>
/// Removes all the items from the collection, then notifies the change
/// </summary>
void ICollection<T>.Clear()
{
Clear();
}
/// <summary>
/// Removes all the items from the collection, then notifies the change
/// </summary>
public void Clear()
{
T[] backup;
lock (_sync)
{
backup = _source.ToArray();
_source.Clear();
}
OnNoisyCollectionChanged(backup, null);
OnNoisyCollectionReset();
OnPropertyChanged(CountString);
OnCollectionChanged(new NotifyCollectionChangedEventArgs(
NotifyCollectionChangedAction.Reset));
}
/// <summary>
/// Evaluates whether an item is in this collection
/// </summary>
/// <param name="value">object to look for</param>
/// <returns>evaluation</returns>
public bool Contains(object value)
{
return Contains((T)value);
}
/// <summary>
/// Evaluates whether an item is in this collection
/// </summary>
/// <param name="item">item to look for</param>
/// <returns>evaluation</returns>
public bool Contains(T item)
{
lock (_sync)
{
return _source.Contains(item);
}
}
/// <summary>
/// Copies the collection to another array
/// </summary>
/// <param name="array">backup array</param>
/// <param name="index">array index</param>
public void CopyTo(Array array, int index)
{
CopyTo(array.Cast<T>().ToArray(), index);
}
/// <summary>
/// Copies the collection to another array
/// </summary>
/// <param name="array">backup array</param>
/// <param name="index">array index</param>
public void CopyTo(T[] array, int index)
{
lock (_sync)
{
_source.CopyTo(array, index);
}
}
/// <summary>
/// Returns the index of an item in the collection
/// </summary>
/// <param name="value">item to look for</param>
/// <returns></returns>
public int IndexOf(object value)
{
return IndexOf((T)value);
}
/// <summary>
/// Returns the index of an item in the collection
/// </summary>
/// <param name="item">item to look for</param>
/// <returns></returns>
public int IndexOf(T item)
{
lock (_sync)
{
return _source.IndexOf(item);
}
}
#endregion
#region Protected Methods
/// <summary>
/// Raises the <see cref="E:PropertyChanged" /> event.
/// </summary>
/// <param name="e">The <see cref="PropertyChangedEventArgs"/> instance containing the event data.</param>
protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
{
if (PropertyChanged != null)
{
PropertyChanged.Invoke(this, e);
}
}
/// <summary>
/// Raises the <see cref="E:CollectionChanged" /> event.
/// </summary>
/// <param name="e">The <see cref="NotifyCollectionChangedEventArgs"/> instance containing the event data.</param>
protected virtual void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
{
if (CollectionChanged != null)
{
CollectionChanged.Invoke(this, e);
}
}
#endregion
#region Private Methods
private void OnNoisyCollectionChanged(IEnumerable<T> olditems, IEnumerable<T> newItems)
{
if (NoisyCollectionChanged != null)
NoisyCollectionChanged.Invoke(olditems, newItems);
}
private void OnNoisyCollectionReset()
{
if (CollectionReset != null)
CollectionReset.Invoke();
}
private void OnPropertyChanged(string propertyName)
{
OnPropertyChanged(new PropertyChangedEventArgs(propertyName));
}
private void ReplaceItem(object original, object item, int index)
{
OnPropertyChanged(IndexerString);
OnNoisyCollectionChanged(new List<T> { (T)original }, new List<T> { (T)item });
OnCollectionChanged(new NotifyCollectionChangedEventArgs(
NotifyCollectionChangedAction.Replace, original, item, index));
}
#endregion
}
}

View File

@@ -0,0 +1,7 @@
namespace LiveChartsCore
{
public interface IBezierData
{
BezierData Data { get; set; }
}
}

View File

@@ -0,0 +1,60 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System.Collections.Generic;
using LiveCharts.Definitions.Series;
using LiveCharts.Helpers;
namespace LiveCharts
{
/// <summary>
///
/// </summary>
/// <seealso cref="LiveCharts.Helpers.INoisyCollection" />
public interface IChartValues : INoisyCollection
{
/// <summary>
/// Forces values to calculate max, min and index data.
/// </summary>
void Initialize(ISeriesView seriesView);
/// <summary>
/// Gets the current chart points in the view, the view is required as an argument, because an instance of IChartValues could hold many ISeriesView instances.
/// </summary>
/// <param name="seriesView">The series view</param>
/// <returns></returns>
IEnumerable<ChartPoint> GetPoints(ISeriesView seriesView);
/// <summary>
/// Initializes the garbage collector
/// </summary>
void InitializeStep(ISeriesView seriesView);
/// <summary>
/// Removes all unnecessary points from the view
/// </summary>
void CollectGarbage(ISeriesView seriesView);
/// <summary>
/// Gets series that owns the values
/// </summary>
PointTracker GetTracker(ISeriesView view);
}
}

View File

@@ -0,0 +1,36 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System;
namespace LiveCharts
{
/// <summary>
///
/// </summary>
public interface IObservableChartPoint
{
/// <summary>
/// Occurs when [point changed].
/// </summary>
event Action PointChanged;
}
}

View File

@@ -0,0 +1,51 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts
{
/// <summary>
/// Charts legend locations
/// </summary>
public enum LegendLocation
{
/// <summary>
/// Disables legend
/// </summary>
None,
/// <summary>
/// PLaces legend at top
/// </summary>
Top,
/// <summary>
/// Places legend at bottom
/// </summary>
Bottom,
/// <summary>
/// Places legend at left
/// </summary>
Left,
/// <summary>
/// Places legend at right
/// </summary>
Right
}
}

View File

@@ -0,0 +1,157 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System;
using LiveCharts.Charts;
using LiveCharts.Definitions.Charts;
using LiveCharts.Dtos;
namespace LiveCharts
{
/// <summary>
///
/// </summary>
/// <seealso cref="LiveCharts.AxisCore" />
public class LogarithmicAxisCore : AxisCore
{
/// <summary>
/// Initializes a new instance of the <see cref="LogarithmicAxisCore"/> class.
/// </summary>
/// <param name="view">The view.</param>
public LogarithmicAxisCore(IAxisView view) : base(view)
{
CleanFactor = 1.5;
}
internal override CoreMargin PrepareChart(AxisOrientation source, ChartCore chart)
{
if (!(Math.Abs(TopLimit - BotLimit) > S * .01) || !ShowLabels) return new CoreMargin();
CalculateSeparator(chart, source);
var f = GetFormatter();
var currentMargin = new CoreMargin();
if (S < 1) S = 1;
var tolerance = S / 10;
InitializeGarbageCollector();
var bl = Math.Ceiling(BotLimit / Magnitude) * Magnitude;
var @base = ((ILogarithmicAxisView) View).Base;
for (var i = bl; i <= TopLimit - (EvaluatesUnitWidth ? 1 : 0); i += S)
{
var minTolerance = tolerance/10;
if (Math.Abs(i - bl) > tolerance)
{
var step = Math.Pow(@base, i - 1);
for (var j = Math.Pow(@base, i - 1) + step;
j < Math.Pow(@base, i);
j += step)
{
SeparatorElementCore minorAsc;
var scaledJ = Math.Log(j, @base);
var minorKey = Math.Round(scaledJ / minTolerance) * minTolerance;
if (!Cache.TryGetValue(minorKey, out minorAsc))
{
minorAsc = new SeparatorElementCore { IsNew = true };
Cache[minorKey] = minorAsc;
}
else
{
minorAsc.IsNew = false;
}
View.RenderSeparator(minorAsc, Chart);
minorAsc.Key = minorKey;
minorAsc.Value = scaledJ;
minorAsc.GarbageCollectorIndex = GarbageCollectorIndex;
minorAsc.View.UpdateLabel(string.Empty, this, source);
if (LastAxisMax == null)
{
minorAsc.State = SeparationState.InitialAdd;
continue;
}
minorAsc.State = SeparationState.Keep;
}
}
SeparatorElementCore asc;
var key = Math.Round(i / tolerance) * tolerance;
if (!Cache.TryGetValue(key, out asc))
{
asc = new SeparatorElementCore { IsNew = true };
Cache[key] = asc;
}
else
{
asc.IsNew = false;
}
View.RenderSeparator(asc, Chart);
asc.Key = key;
asc.Value = i;
asc.GarbageCollectorIndex = GarbageCollectorIndex;
var labelsMargin = asc.View.UpdateLabel(f(i), this, source);
currentMargin.Width = labelsMargin.TakenWidth > currentMargin.Width
? labelsMargin.TakenWidth
: currentMargin.Width;
currentMargin.Height = labelsMargin.TakenHeight > currentMargin.Height
? labelsMargin.TakenHeight
: currentMargin.Height;
currentMargin.Left = labelsMargin.Left > currentMargin.Left
? labelsMargin.Left
: currentMargin.Left;
currentMargin.Right = labelsMargin.Right > currentMargin.Right
? labelsMargin.Right
: currentMargin.Right;
currentMargin.Top = labelsMargin.Top > currentMargin.Top
? labelsMargin.Top
: currentMargin.Top;
currentMargin.Bottom = labelsMargin.Bottom > currentMargin.Bottom
? labelsMargin.Bottom
: currentMargin.Bottom;
if (LastAxisMax == null)
{
asc.State = SeparationState.InitialAdd;
continue;
}
asc.State = SeparationState.Keep;
}
return currentMargin;
}
}
}

View File

@@ -0,0 +1,96 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System.Collections.Generic;
namespace LiveCharts.Maps
{
/// <summary>
///
/// </summary>
public class LvcMap
{
/// <summary>
/// Gets or sets the width of the desired.
/// </summary>
/// <value>
/// The width of the desired.
/// </value>
public double DesiredWidth { get; set; }
/// <summary>
/// Gets or sets the height of the desired.
/// </summary>
/// <value>
/// The height of the desired.
/// </value>
public double DesiredHeight { get; set; }
/// <summary>
/// Gets or sets the data.
/// </summary>
/// <value>
/// The data.
/// </value>
public List<MapData> Data { get; set; }
}
/// <summary>
///
/// </summary>
public class MapData
{
/// <summary>
/// Gets or sets the identifier.
/// </summary>
/// <value>
/// The identifier.
/// </value>
public string Id { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>
/// The name.
/// </value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the data.
/// </summary>
/// <value>
/// The data.
/// </value>
public string Data { get; set; }
/// <summary>
/// Gets or sets the shape.
/// </summary>
/// <value>
/// The shape.
/// </value>
public object Shape { get; set; }
/// <summary>
/// Gets or sets the LVC map.
/// </summary>
/// <value>
/// The LVC map.
/// </value>
public LvcMap LvcMap { get; set; }
}
}

View File

@@ -0,0 +1,51 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts
{
/// <summary>
/// Chart Panning Options
/// </summary>
public enum PanningOptions
{
/// <summary>
/// By default chart Panning is Unset, this means it will be based the Chart Zooming selection
/// </summary>
Unset,
/// <summary>
/// Not panning allowed
/// </summary>
None,
/// <summary>
/// Panning only in the X axis
/// </summary>
X,
/// <summary>
/// Panning only in the Y axis
/// </summary>
Y,
/// <summary>
/// Panning in both X and Y axes
/// </summary>
Xy
}
}

View File

@@ -0,0 +1,39 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts
{
/// <summary>
/// Describes where a label should be placed
/// </summary>
public enum PieLabelPosition
{
/// <summary>
/// Places the label inside the pie slice
/// </summary>
InsideSlice,
/// <summary>
/// Places the label outside the pie slice
/// </summary>
OutsideSlice
}
}

View File

@@ -0,0 +1,85 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System.Collections.Generic;
using LiveCharts.Dtos;
namespace LiveCharts
{
/// <summary>
///
/// </summary>
public class PointTracker
{
/// <summary>
/// Initializes a new instance of the <see cref="PointTracker"/> class.
/// </summary>
public PointTracker()
{
Indexed = new Dictionary<int, ChartPoint>();
Referenced = new Dictionary<object, ChartPoint>();
}
/// <summary>
/// Gets the x limit.
/// </summary>
/// <value>
/// The x limit.
/// </value>
public CoreLimit XLimit { get; internal set; }
/// <summary>
/// Gets the y limit.
/// </summary>
/// <value>
/// The y limit.
/// </value>
public CoreLimit YLimit { get; internal set; }
/// <summary>
/// Gets the w limit.
/// </summary>
/// <value>
/// The w limit.
/// </value>
public CoreLimit WLimit { get; internal set; }
/// <summary>
/// Gets the gci.
/// </summary>
/// <value>
/// The gci.
/// </value>
public int Gci { get; internal set; }
/// <summary>
/// Gets or sets the indexed.
/// </summary>
/// <value>
/// The indexed.
/// </value>
public Dictionary<int, ChartPoint> Indexed { get; set; }
/// <summary>
/// Gets or sets the referenced.
/// </summary>
/// <value>
/// The referenced.
/// </value>
public Dictionary<object, ChartPoint> Referenced { get; set; }
}
}

View File

@@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue">CSharp50</s:String></wpf:ResourceDictionary>

View File

@@ -0,0 +1,38 @@
using System.Resources;
using System.Reflection;
using System.Runtime.CompilerServices;
// 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("LiveCharts")]
[assembly: AssemblyDescription("Core library for LiveCharts")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LiveCharts")]
[assembly: AssemblyCopyright("Copyright © 2016 Alberto Rodríguez Orozco")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// 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("0.9.5")]
[assembly: AssemblyFileVersion("0.9.5")]
[assembly: InternalsVisibleTo("LiveCharts.Wpf")]
[assembly: InternalsVisibleTo("LiveCharts.Uwp")]
[assembly: InternalsVisibleTo("LiveCharts.Geared")]
[assembly: InternalsVisibleTo("LiveCharts.Uwp,PublicKey=0024000004800000940000000602000000240000525341310004000001000100c31220a192bc8693eeb2f3f2249efc31ff40fbcc2a64e14fc6bee54a89fc063f22a9038a25a073f554409e61d083e8be0ee279d91be333ce5471f67e4189d023fc8ef9b8ab83b2080921a65061c32584d33fcfb1dc44495bcf794dec5f7421fd9d03a165b7efd460c84d70fa9eab5dd7da28d1083bd325f94a87193ac989d1cf")]
[assembly: InternalsVisibleTo("LiveCharts.Wpf,PublicKey=0024000004800000940000000602000000240000525341310004000001000100fd75e78956f97c7369ca28eb4214633471da9d13357dc192414bec59b911c99718d9d16a803e527a40a42f947bb297e9d2236d9e541937c4acfc0bc1ca8ee57114963445259b14532d56951de47e773d790110f63b04721bb853c23d9db25c45b83b45dea9aa4157aba95ad890bf69a7d2583e711c786a32817ab1937f43e7d5")]
[assembly: InternalsVisibleTo("LiveCharts.Geared,PublicKey=0024000004800000940000000602000000240000525341310004000001000100bd2e66fab8ce9a4900047ffda57d2f525cf6313dcc9d20994c5e6b3cd8fca906ba7ccd54bea5f7bd6cb503deb81d685259e355e3a9b5c21e5bc80091f08846246371b2a71ab306655651261e910adfa61be236b77d11df23a44d48f00a0e07c689f9a2daaff16d505a1c861d9854d92ed5a8a38fb28c1343fb691462873e71a1")]

View File

@@ -0,0 +1,47 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts
{
/// <summary>
/// Gets or sets a chart scroll mode
/// </summary>
public enum ScrollMode
{
/// <summary>
/// Disables Chart Scroll bars
/// </summary>
None,
/// <summary>
/// Enables scroll mode at the X axis
/// </summary>
X,
/// <summary>
/// Enables scroll mode at the Y axis
/// </summary>
Y,
/// <summary>
/// Enables scroll mode in both, X and Y axis
/// </summary>
XY
}
}

View File

@@ -0,0 +1,43 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts
{
/// <summary>
/// Separator current state
/// </summary>
public enum SeparationState
{
/// <summary>
/// Remove the separator from the chart
/// </summary>
Remove,
/// <summary>
/// Kepp the separator in the chart
/// </summary>
Keep,
/// <summary>
/// no animated add
/// </summary>
InitialAdd
}
}

View File

@@ -0,0 +1,64 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
namespace LiveCharts
{
/// <summary>
///
/// </summary>
public class SeparatorConfigurationCore
{
/// <summary>
/// Initializes a new instance of the <see cref="SeparatorConfigurationCore"/> class.
/// </summary>
/// <param name="axis">The axis.</param>
public SeparatorConfigurationCore(AxisCore axis)
{
Axis = axis;
}
/// <summary>
/// Gets or sets the axis.
/// </summary>
/// <value>
/// The axis.
/// </value>
public AxisCore Axis { get; set; }
/// <summary>
/// Gets or sets if separators are enabled (will be drawn)
/// </summary>
public bool IsEnabled { get; set; }
/// <summary>
/// Gets or sets sepator step, this means the value between each line, use null for auto.
/// </summary>
public double Step { get; set; }
/// <summary>
/// Gets or sets the source.
/// </summary>
/// <value>
/// The source.
/// </value>
public AxisOrientation Source { get; set; }
}
}

View File

@@ -0,0 +1,75 @@
//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using LiveCharts.Definitions.Charts;
namespace LiveCharts
{
/// <summary>
///
/// </summary>
public class SeparatorElementCore
{
/// <summary>
/// Gets or sets a value indicating whether this instance is new.
/// </summary>
/// <value>
/// <c>true</c> if this instance is new; otherwise, <c>false</c>.
/// </value>
public bool IsNew { get; set; }
/// <summary>
/// Gets or sets the state.
/// </summary>
/// <value>
/// The state.
/// </value>
public SeparationState State { get; set; }
/// <summary>
/// Gets or sets the index of the garbage collector.
/// </summary>
/// <value>
/// The index of the garbage collector.
/// </value>
public int GarbageCollectorIndex { get; set; }
/// <summary>
/// Gets or sets the key.
/// </summary>
/// <value>
/// The key.
/// </value>
public double Key { get; set; }
/// <summary>
/// Gets or sets the value.
/// </summary>
/// <value>
/// The value.
/// </value>
public double Value { get; set; }
/// <summary>
/// Gets or sets the view.
/// </summary>
/// <value>
/// The view.
/// </value>
public ISeparatorElementView View { get; set; }
}
}

Some files were not shown because too many files have changed in this diff Show More