如何到0.5秒之内提请十千点与WPF行? [英] How to draw line of ten thousands of points with WPF within 0.5 second?

查看:137
本文介绍了如何到0.5秒之内提请十千点与WPF行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写 WPF 代码来显示实时情节它是一个包含连接线
10000点。它需要约5秒,以显示在计算机的画面。有没有人有一个想法,使人们更快和0.5第二个

 类电子电气设备中:FrameworkElement的
{

酒店的公共EEE()
{
_children =新VisualCollection(本);
随机兰特=新的随机();
DrawingVisual DV =新DrawingVisual();
使用(DX的DrawingContext = dv.RenderOpen())
{
笔drawingPen =新朋(Brushes.Black,1);
双X = rand.Next(300);
双Y = rand.Next(300);
表示(双I = 0; I&下; 1000; I = I + 0.1)
{
Y = 100 + rand.Next(100);
dx.DrawLine(drawingPen,新点(I,X),新点第(i + 1,Y));
X = Y;
}
}
_children.Add(DV);
}


解决方案

查尔斯Petzold的正是这么做的。这是更快我的主机(小于0.3秒),并点的甚至是数据绑定! ;)



塔米尔Khason 这是否也与线路和这里进入关于位风格表现WPF 更深入



波多黎各马里亚尼对3D高性能显卡,基本上是利用值类型可以提高你的吞吐量是否经过深思熟虑的一些指导



Jianzhong张给出了关于这个问题我的新favourate教程,3D散点图数万动画和交互的数据点。


I am writing WPF code to show a real-time plot which is a connected line containing about 10,000 points. It takes about 5 seconds to show a picture in my computer. Does anyone have an idea to make it quicker and within 0.5 second?

class eee : FrameworkElement
{

    public eee()
    {
        _children = new VisualCollection(this);
        Random rand = new Random();
        DrawingVisual dv = new DrawingVisual();
        using (DrawingContext dx = dv.RenderOpen())
        {
            Pen drawingPen = new Pen(Brushes.Black, 1);
            double x=rand.Next(300);
            double y = rand.Next(300);
            for (double i = 0; i < 1000; i = i + 0.1)
            {
                y = 100 + rand.Next(100);
                dx.DrawLine(drawingPen, new Point(i, x), new Point(i + 1, y));
                x = y;
            }
        }
         _children.Add(dv);
    }

解决方案

Charles Petzold does exactly that. It is even faster on my host (< 0.3 secs), and the point's are even DataBound!! ;)

Tamir Khason does this also, with lines and goes into more depth about Bitmap style performance WPF here.

Rico Mariani has some guidance for 3D high performance graphics, essentially leveraging value types can improve your throughput if well thought out.

Jianzhong Zhang gives my new favourate tutorials on this subject, 3D scatter plot several tens of thousands of data points animated and interactive.

这篇关于如何到0.5秒之内提请十千点与WPF行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆