【问题标题】:MetroChart Animation extremly slowMetroChart 动画非常慢
【发布时间】:2018-10-28 16:54:39
【问题描述】:

我在这里找到了我的问题:Disable Animation in ModernUI Charts

但没有人回答。

我正在编写一个(Mvvm)应用程序并想使用 Torsten Mandelkows MetroChart。它终于运行了(在许多错误之后),但现在仪表图非常慢,直到它的最终价值。

例如,它需要将近 20 秒才能达到 50%。 有没有办法立即达到其最终价值?

这是我的片段:

查看:

    <Viewbox Height="190">
            <metroChart:RadialGaugeChart Background="{x:Null}" ChartTitle="Einzelteile" ChartSubTitle="" Foreground="LightGray" Height="300" Width="300" Margin="0,0,0,0" >
                <metroChart:RadialGaugeChart.Series>
                    <metroChart:ChartSeries
                    DisplayMember="Title"
                    ItemsSource="{Binding Status}"
                    SeriesTitle="Status"
                    HorizontalAlignment="Stretch"
                    ValueMember="Percent" 
                    VerticalAlignment="Stretch">
                    </metroChart:ChartSeries>
                </metroChart:RadialGaugeChart.Series>
            </metroChart:RadialGaugeChart>
        </Viewbox>`

视图模型:

...

            Status c = new Status();
            c.Title = "Parts";
            if (RecievedArticle != null) c.Percent = RecievedArticle.CalcPercentStatus();
            Status.Add(c);
...
public ObservableCollection<Status> Status { get; private set; } = new ObservableCollection<Status>();
}

public class Status
{
    public string Title { get; set; }
    public int Percent { get; set; }

}

`

【问题讨论】:

    标签: c# wpf user-interface mvvm charts


    【解决方案1】:

    我找到了一种加快速度的方法。 认为这是一个非常肮脏的解决方案,但对我有用:

    在 TorstenMandelkow.MetroChart 中是一个名为 RadialGaugePiece 的类

    我编辑了两个方法:

        public RadialGaugePiece()
    {
      //this.timer = new DispatcherTimer();
      //this.timer.Tick += new EventHandler(this.timer_Tick);
      this.Loaded += new RoutedEventHandler(this.RadialGaugePiece_Loaded);
    }
    
        private void UpdatePie()
    {
      if (this.AnimatedValue == this.Value)
        return;
      this.animationCounter = 0.0;
      this.animationStartValue = this.AnimatedValue;
            //this.timer.Interval = TimeSpan.FromMilliseconds(33.3);
        this.timer.Interval = TimeSpan.FromMilliseconds(0);
            this.timer.Start();
      this.Tick();
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-12-25
      • 2014-04-02
      • 1970-01-01
      • 1970-01-01
      • 2013-04-24
      • 1970-01-01
      相关资源
      最近更新 更多