Telerik Chart UI的1000个值很慢

时间:2019-06-26 22:20:44

标签: c# xaml uwp telerik telerik-charting

因此,我有一个带有telerik图表的简单xaml(UWP)页面:

<Grid>
        <telerikChart:RadCartesianChart Background="Beige" >
            <telerikChart:RadCartesianChart.Behaviors>
                <telerikChart:ChartPanAndZoomBehavior   ZoomMode="Both" PanMode="Both"/>
                <telerikChart:ChartTooltipBehavior  />
            </telerikChart:RadCartesianChart.Behaviors>
            <telerikChart:RadCartesianChart.VerticalAxis>
                <telerikChart:LinearAxis Padding="0" Title=" (m/s/s)"  Foreground="Black"/>
            </telerikChart:RadCartesianChart.VerticalAxis>
            <telerikChart:RadCartesianChart.HorizontalAxis>
                <telerikChart:LinearAxis Title="Time (s)" Foreground="Black"/>
            </telerikChart:RadCartesianChart.HorizontalAxis>
            <telerikChart:RadCartesianChart.Grid>
                <telerikChart:CartesianChartGrid MajorLinesVisibility="XY"/>
            </telerikChart:RadCartesianChart.Grid>



            <telerikChart:ScatterLineSeries   ItemsSource="{x:Bind Values, Mode=OneWay}">
                <telerikChart:ScatterLineSeries.XValueBinding>
                    <telerikChart:PropertyNameDataPointBinding PropertyName="XValue" />
                </telerikChart:ScatterLineSeries.XValueBinding>
                <telerikChart:ScatterLineSeries.YValueBinding>
                    <telerikChart:PropertyNameDataPointBinding PropertyName="YValue" />
                </telerikChart:ScatterLineSeries.YValueBinding>
            </telerikChart:ScatterLineSeries>


        </telerikChart:RadCartesianChart>

    </Grid>

后面的代码为图表控件创建1000个值:

        public MainPage()
        {
            this.InitializeComponent();
            for (int i = 0; i < 1000; i++)
            {
                var val = new ValueForChart() { XValue = i, YValue = Math.Sin( i / 2d )};
                Values.Add(val);
            }
        }

        public List<ValueForChart> Values { get; set; } = new List<ValueForChart>();
//...
  public class ValueForChart
    {
        public double XValue { get; set; }
        public double YValue { get; set; }
    }

UI渲染速度很快,但是在调整窗口大小时无法用于平移,缩放或冻结。 1000个值不是很多...我认为RadChart应该处理更多。.

我做错什么了吗?

0 个答案:

没有答案