Skip to content

Commit

Permalink
Merge pull request Live-Charts#424 from beto-rodriguez/develop
Browse files Browse the repository at this point in the history
081 release
  • Loading branch information
beto-rodriguez authored Dec 22, 2016
2 parents 6d906fa + 5416e8b commit 2328c5e
Show file tree
Hide file tree
Showing 11 changed files with 90 additions and 86 deletions.
16 changes: 8 additions & 8 deletions Core/Charts/ChartCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -632,20 +632,20 @@ protected void StackPoints(IEnumerable<ISeriesView> stackables, AxisOrientation

if (mode == StackMode.Percentage)
{
if (double.IsNaN(ax.BotLimit)) ax.BotLimit = 0;
if (double.IsNaN(ax.TopLimit)) ax.TopLimit = 1;
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.BotLimit))
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.TopLimit))
if (double.IsNaN(ax.MaxValue))
ax.TopLimit = mostRight == 0
? 0
: ((int) (mostRight/ax.S) + 1)*ax.S;
Expand All @@ -658,20 +658,20 @@ protected void StackPoints(IEnumerable<ISeriesView> stackables, AxisOrientation

if (mode == StackMode.Percentage)
{
if (double.IsNaN(ay.BotLimit)) ay.BotLimit = 0;
if (double.IsNaN(ay.TopLimit)) ay.TopLimit = 1;
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.BotLimit))
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.TopLimit))
if (double.IsNaN(ay.MaxValue))
ay.TopLimit = mostRight == 0
? 0
: ((int) (mostRight/ay.S) + 1)*ay.S;
Expand Down
4 changes: 2 additions & 2 deletions Core/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
// 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.8.0")]
[assembly: AssemblyFileVersion("0.8.0")]
[assembly: AssemblyVersion("0.8.1")]
[assembly: AssemblyFileVersion("0.8.1")]

[assembly: InternalsVisibleTo("LiveCharts.Wpf")]
[assembly: InternalsVisibleTo("LiveCharts.Uwp")]
Expand Down
9 changes: 6 additions & 3 deletions Core/SeriesAlgorithms/LineAlgorithm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,17 @@ public override void Update()
p3 = new CorePoint(p3.X + uw.X, p3.Y - uw.Y);
}

lineView.StartSegment(segmentPosition, p1);
segmentPosition += segmentPosition == 0 ? 1 : 2;

ChartPoint previousDrawn = null;
var isOpen = false;

for (var index = 0; index < segment.Count; index++)
{
if (!isOpen)
{
lineView.StartSegment(segmentPosition, p1);
segmentPosition += segmentPosition == 0 ? 1 : 2;
}

var chartPoint = segment[index];

chartPoint.ChartLocation = p1;
Expand Down
24 changes: 12 additions & 12 deletions Core40/Charts/ChartCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -632,23 +632,23 @@ protected void StackPoints(IEnumerable<ISeriesView> stackables, AxisOrientation

if (mode == StackMode.Percentage)
{
if (double.IsNaN(ax.BotLimit)) ax.BotLimit = 0;
if (double.IsNaN(ax.TopLimit)) ax.TopLimit = 1;
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.BotLimit))
if (double.IsNaN(ax.MinValue))
ax.BotLimit = mostLeft == 0
? 0
: ((int) (mostLeft/ax.S) - 1)*ax.S;
: ((int)(mostLeft / ax.S) - 1) * ax.S;
if (mostRight > ax.TopLimit)
// ReSharper disable once CompareOfFloatsByEqualityOperator
if (double.IsNaN(ax.TopLimit))
if (double.IsNaN(ax.MaxValue))
ax.TopLimit = mostRight == 0
? 0
: ((int) (mostRight/ax.S) + 1)*ax.S;
: ((int)(mostRight / ax.S) + 1) * ax.S;
}
}

Expand All @@ -658,23 +658,23 @@ protected void StackPoints(IEnumerable<ISeriesView> stackables, AxisOrientation

if (mode == StackMode.Percentage)
{
if (double.IsNaN(ay.BotLimit)) ay.BotLimit = 0;
if (double.IsNaN(ay.TopLimit)) ay.TopLimit = 1;
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.BotLimit))
if (double.IsNaN(ay.MinValue))
ay.BotLimit = mostLeft == 0
? 0
: ((int) (mostLeft/ay.S) - 1)*ay.S;
: ((int)(mostLeft / ay.S) - 1) * ay.S;
if (mostRight > ay.TopLimit)
// ReSharper disable once CompareOfFloatsByEqualityOperator
if (double.IsNaN(ay.TopLimit))
if (double.IsNaN(ay.MaxValue))
ay.TopLimit = mostRight == 0
? 0
: ((int) (mostRight/ay.S) + 1)*ay.S;
: ((int)(mostRight / ay.S) + 1) * ay.S;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Core40/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
// 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.8.0")]
[assembly: AssemblyFileVersion("0.8.0")]
[assembly: AssemblyVersion("0.8.1")]
[assembly: AssemblyFileVersion("0.8.1")]

[assembly: InternalsVisibleTo("LiveCharts.Wpf")]
[assembly: InternalsVisibleTo("LiveCharts.Uwp")]
Expand Down
9 changes: 6 additions & 3 deletions Core40/SeriesAlgorithms/LineAlgorithm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,17 @@ public override void Update()
p3 = new CorePoint(p3.X + uw.X, p3.Y - uw.Y);
}

lineView.StartSegment(segmentPosition, p1);
segmentPosition += segmentPosition == 0 ? 1 : 2;

ChartPoint previousDrawn = null;
var isOpen = false;

for (var index = 0; index < segment.Count; index++)
{
if (isOpen)
{
lineView.StartSegment(segmentPosition, p1);
segmentPosition += segmentPosition == 0 ? 1 : 2;
}

var chartPoint = segment[index];

chartPoint.ChartLocation = p1;
Expand Down
49 changes: 24 additions & 25 deletions UwpView/LineSeries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ public LineSeries(object configuration)
/// The splitters collector.
/// </value>
protected int SplittersCollector { get; set; }
/// <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>
private bool IsNew { get; set; }
#endregion

#region Properties
Expand Down Expand Up @@ -181,26 +188,6 @@ public override void OnSeriesUpdateStart()

SplittersCollector++;

var uw = Model.Chart.AxisX[ScalesXAt].EvaluatesUnitWidth
? ChartFunctions.GetUnitWidth(AxisOrientation.X, Model.Chart, ScalesXAt) / 2
: 0;
var areaLimit = Model.Chart.DrawMargin.Height;
if (!double.IsNaN(AreaLimit))
areaLimit = ChartFunctions.ToDrawMargin(AreaLimit, AxisOrientation.Y, Model.Chart, ScalesYAt);

if (Figure != null && Values != null)
{
var xi = (ActualValues.GetPoints(this).FirstOrDefault() ?? new ChartPoint()).X;
xi = ChartFunctions.ToDrawMargin(xi, AxisOrientation.X, Model.Chart, ScalesXAt);
xi += uw;

if (Model.Chart.View.DisableAnimations)
Figure.StartPoint = new Point(xi, areaLimit);
else
Figure.BeginPointAnimation(nameof(PathFigure.StartPoint),
new Point(xi, areaLimit), Model.Chart.View.AnimationsSpeed);
}

if (IsPathInitialized)
{
Model.Chart.View.EnsureElementBelongsToCurrentDrawMargin(Path);
Expand Down Expand Up @@ -232,11 +219,6 @@ public override void OnSeriesUpdateStart()
Path.Data = geometry;

Model.Chart.View.EnsureElementBelongsToCurrentDrawMargin(Path);

var x = (ActualValues.GetPoints(this).FirstOrDefault() ?? new ChartPoint()).X;
x = ChartFunctions.ToDrawMargin(x, AxisOrientation.X, Model.Chart, ScalesXAt);
x += uw;
Figure.StartPoint = new Point(x, areaLimit);
}

/// <summary>
Expand Down Expand Up @@ -384,6 +366,21 @@ public virtual void StartSegment(int atIndex, CorePoint location)
var animSpeed = Model.Chart.View.AnimationsSpeed;
var noAnim = Model.Chart.View.DisableAnimations;

var areaLimit = Model.Chart.DrawMargin.Height;
if (!double.IsNaN(AreaLimit))
areaLimit = ChartFunctions.ToDrawMargin(AreaLimit, AxisOrientation.Y, Model.Chart, ScalesYAt);

if (Values != null)
{
if (Model.Chart.View.DisableAnimations || IsNew)
Figure.StartPoint = new Point(location.X, areaLimit);
else
Figure.BeginPointAnimation(nameof(PathFigure.StartPoint),
new Point(location.X, areaLimit), Model.Chart.View.AnimationsSpeed);

IsNew = false;
}

if (atIndex != 0)
{
Figure.Segments.Remove(splitter.Bottom);
Expand Down Expand Up @@ -469,6 +466,8 @@ private void InitializeDefuaults()

DefaultFillOpacity = 0.15;
Splitters = new List<LineSegmentSplitter>();

IsNew = true;
}

#endregion
Expand Down
4 changes: 2 additions & 2 deletions UwpView/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
// 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.8.0")]
[assembly: AssemblyFileVersion("0.8.0")]
[assembly: AssemblyVersion("0.8.1")]
[assembly: AssemblyFileVersion("0.8.1")]
[assembly: ComVisible(false)]
4 changes: 2 additions & 2 deletions WinFormsView/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// 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.8.0")]
[assembly: AssemblyFileVersion("0.8.0")]
[assembly: AssemblyVersion("0.8.1")]
[assembly: AssemblyFileVersion("0.8.1")]
49 changes: 24 additions & 25 deletions WpfView/LineSeries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ public LineSeries(object configuration)
/// The splitters collector.
/// </value>
protected int SplittersCollector { get; set; }
/// <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>
private bool IsNew { get; set; }
#endregion

#region Properties
Expand Down Expand Up @@ -181,26 +188,6 @@ public override void OnSeriesUpdateStart()

SplittersCollector++;

var uw = Model.Chart.AxisX[ScalesXAt].EvaluatesUnitWidth
? ChartFunctions.GetUnitWidth(AxisOrientation.X, Model.Chart, ScalesXAt)/2
: 0;
var areaLimit = Model.Chart.DrawMargin.Height;
if (!double.IsNaN(AreaLimit))
areaLimit = ChartFunctions.ToDrawMargin(AreaLimit, AxisOrientation.Y, Model.Chart, ScalesYAt);

if (Figure != null && Values != null)
{
var xi = (ActualValues.GetPoints(this).FirstOrDefault() ?? new ChartPoint()).X;
xi = ChartFunctions.ToDrawMargin(xi, AxisOrientation.X, Model.Chart, ScalesXAt);
xi += uw;

if (Model.Chart.View.DisableAnimations)
Figure.StartPoint = new Point(xi, areaLimit);
else
Figure.BeginAnimation(PathFigure.StartPointProperty,
new PointAnimation(new Point(xi, areaLimit), Model.Chart.View.AnimationsSpeed));
}

if (IsPathInitialized)
{
Model.Chart.View.EnsureElementBelongsToCurrentDrawMargin(Path);
Expand Down Expand Up @@ -232,11 +219,6 @@ public override void OnSeriesUpdateStart()
Path.Data = geometry;

Model.Chart.View.EnsureElementBelongsToCurrentDrawMargin(Path);

var x = (ActualValues.GetPoints(this).FirstOrDefault() ?? new ChartPoint()).X;
x = ChartFunctions.ToDrawMargin(x, AxisOrientation.X, Model.Chart, ScalesXAt);
x += uw;
Figure.StartPoint = new Point(x, areaLimit);
}

/// <summary>
Expand Down Expand Up @@ -388,6 +370,21 @@ public virtual void StartSegment(int atIndex, CorePoint location)
var animSpeed = Model.Chart.View.AnimationsSpeed;
var noAnim = Model.Chart.View.DisableAnimations;

var areaLimit = Model.Chart.DrawMargin.Height;
if (!double.IsNaN(AreaLimit))
areaLimit = ChartFunctions.ToDrawMargin(AreaLimit, AxisOrientation.Y, Model.Chart, ScalesYAt);

if (Values != null)
{
if (Model.Chart.View.DisableAnimations || IsNew)
Figure.StartPoint = new Point(location.X, areaLimit);
else
Figure.BeginAnimation(PathFigure.StartPointProperty,
new PointAnimation(new Point(location.X, areaLimit), Model.Chart.View.AnimationsSpeed));

IsNew = false;
}

if (atIndex != 0)
{
Figure.Segments.Remove(splitter.Bottom);
Expand Down Expand Up @@ -482,6 +479,8 @@ private void InitializeDefuaults()

DefaultFillOpacity = 0.15;
Splitters = new List<LineSegmentSplitter>();

IsNew = true;
}

#endregion
Expand Down
4 changes: 2 additions & 2 deletions WpfView/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
// 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.8.0")]
[assembly: AssemblyFileVersion("0.8.0")]
[assembly: AssemblyVersion("0.8.1")]
[assembly: AssemblyFileVersion("0.8.1")]

[assembly: InternalsVisibleTo("LiveCharts.Geared")]
[assembly: InternalsVisibleTo("LiveCharts.WinForms")]

0 comments on commit 2328c5e

Please sign in to comment.