Skip to content

Commit

Permalink
优化图标控件
Browse files Browse the repository at this point in the history
  • Loading branch information
noberumotto committed Aug 6, 2021
1 parent 6e6878f commit 357dc76
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Local/Project1.UI/Controls/ChartControl/Chart.cs
Original file line number Diff line number Diff line change
@@ -589,12 +589,13 @@ private void Calculate()
{
averageValue = Data.Count() > 0 ? Data.Average(m => m.Value) : 0;
}
AverageVisibility = averageValue > 0 ? Visibility.Visible : Visibility.Hidden;
AverageVisibility = averageValue >= 1 ? Visibility.Visible : Visibility.Hidden;
if (averageValue > MaxValue)
{
//如果平均值超过了最大值时需要调整最大值
MaxValue = Math.Round(averageValue / 1.5, MidpointRounding.AwayFromZero) * 2;
}
averageValue = averageValue >= 1 ? averageValue : 0;
}
#region 渲染刻度
/// <summary>
@@ -710,7 +711,7 @@ private void InitAnimation()
Storyboard.SetTarget(averageLabelValueAnimation, this);
Storyboard.SetTargetProperty(averageLabelValueAnimation, new PropertyPath(AverageProperty));

averageAnimation.Duration= new Duration(TimeSpan.FromSeconds(.8));
averageAnimation.Duration = new Duration(TimeSpan.FromSeconds(.8));
averageLabelAnimation.Duration = new Duration(TimeSpan.FromSeconds(.8));
averageLabelValueAnimation.Duration = new Duration(TimeSpan.FromSeconds(.8));

0 comments on commit 357dc76

Please sign in to comment.