English 中文(简体)
如何在小图上绘制多点图
原标题:How to chart graph with many points on small graph

我有100000个x/y点(海拔超过距离)要在一张高400px、宽600px的图上绘制。

如何创建一条“估计”曲线,使10万个点看起来像一张图,而不是很多成束的线?

有没有图表控件可以通过缩放为我做到这一点?

问题回答

I did this once by dividing the data into pixel segments (in your case 400) along the x axis. I would find the max and min value within each set and the draw a vertical line on that x point. It is very simple and you ll be amazed by the result. It only works when you have more datapoints than x cordinates within the plot area. But that is the time when you need the optimization, anyhow.

例如,在x偏移量233内,您有以下数据点。

(1000202, 40) (1000203, 43) (1000204, 47) (1000205, 43) (1000206, 38) (1000208, 35)

这将导致从点(233,35)到(233,47)绘制一条垂直线

我不知道你是否找到了这个问题的答案,但我开发了一个控件,它可以对输入数据进行奈奎斯特重采样(所以你只渲染你能看到的)和即时模式渲染(所以你能获得最佳性能)。结果是,它可以以30FPS平滑地渲染100000个xy点。

Tormod提出的答案适用于折线图——将输入数据划分为多个区间,找到最小值/最大值,然后绘制这些区间,但对于其他图表类型,你需要更先进的技术。您将看到的另一个效果是锯齿。为了解决这个问题,你可以a.)重新采样到更多的bin(例如2x pixelWidth,4x pixel Width),b.)在绘图时使用抗锯齿,或者c.)使用重新采样算法,在下采样之前对数据进行低通滤波。这些技术在数字信号处理中很常见,适用于2D绘图。





相关问题
Manually implementing high performance algorithms in .NET

As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...

Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How do I compare two decimals to 10 decimal places?

I m using decimal type (.net), and I want to see if two numbers are equal. But I only want to be accurate to 10 decimal places. For example take these three numbers. I want them all to be equal. 0....

Exception practices when creating a SynchronizationContext?

I m creating an STA version of the SynchronizationContext for use in Windows Workflow 4.0. I m wondering what to do about exceptions when Post-ing callbacks. The SynchronizationContext can be used ...

Show running instance in single instance application

I am building an application with C#. I managed to turn this into a single instance application by checking if the same process is already running. Process[] pname = Process.GetProcessesByName("...

How to combine DataTrigger and EventTrigger?

NOTE I have asked the related question (with an accepted answer): How to combine DataTrigger and Trigger? I think I need to combine an EventTrigger and a DataTrigger to achieve what I m after: when ...

热门标签