图表任意维度的矩形 [英] Charting Rectangles of arbitrary dimensions
问题描述
我需要在C#应用程序中绘制不同高度和宽度的矩形。矩形可能重叠,也可能不重叠。
I need to graph rectangles of different heights and widths in a C# application. The rectangles may or may not overlap.
我认为 System.Windows.Forms.DataVisualization.Charting
我需要的,但是我探索的每个图表类型都需要一个维度中的单个值和另一个维度中的多个值组成的数据点。
I thought the System.Windows.Forms.DataVisualization.Charting
would have what I need, but every chart type I've explored wants data points composed of a single value in one dimension and multiple values in the other.
我考虑过: Box,Bubble和Range Bar
I've considered: Box, Bubble, and Range Bar
.
推荐答案
理查德·埃里克森有最接近的答案,因为图表包不包含我需要的。我向前移动的解决方案是使用点图来管理轴和什么,但重载PostPaint事件有效地绘制我需要的矩形顶部。图表提供了从值到像素(反之亦然)的转换。
It turns out that Richard Eriksson has the closest answer in that the Charting package doesn't contain what I needed. The solution I'm moving forward with is to use a Point chart to manage axes and whatnot, but overload the PostPaint event to effectively draw the rectangles I need on top. The Chart provides value-to-pixel (and vice versa) conversions.
这篇关于图表任意维度的矩形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!