[英]How to display multiple series with different number of data points on the same x-axis in C# using Microsoft Visual Studio?
Since I have multiple series with varying data points which I want to plot on the same axis, the points overlap each other. 由于我有多个要在同一轴上绘制的不同数据点的序列,因此这些点彼此重叠。 Hence, the date which is my x-axis is not in ascending order and may even be repeated depending on the choices selected.
因此,作为我的x轴的日期不是按升序排列的,甚至可能会根据选择的内容而重复。
I would like for the x-axis to be in ascending order and the series to be broken if need be, as long as the points are plotted according to the date on the a-xis and not repeated. 我希望x轴按升序排列,并在需要时将其破坏,只要根据a-xis上的日期绘制点,并且不再重复。
The data points have been plotted from my Microsoft Access database and contain 100+ data which means I can't hard code it in the program if that's a possible solution. 数据点是从Microsoft Access数据库中绘制的,包含100多个数据,这意味着如果可以的话,我无法在程序中对其进行硬编码。
Is there any way I can rectify this? 有什么办法可以纠正这个问题?
Thanks. 谢谢。
This is how my current chart looks like. 这就是我当前的图表。
Solution1: 解决方法1:
You could use "symbols" for each data point and a thinner line beteen this symbols to make clear where actual data points are found and where the lines just connect existing data points. 您可以对每个数据点使用“符号”,并在该符号之间使用较细的线,以明确找到实际数据点的位置以及仅连接现有数据点的线的位置。 If there are many data points this requires some careful "Design Choices".
如果有许多数据点,则需要进行一些仔细的“设计选择”。 Probably very small symbols (2 point) and very thin lines (1 point) create a readable chart.
可能非常小的符号(2点)和非常细的线(1点)创建了可读的图表。
Solution 2: 解决方案2:
This will produce "gaps" in the chart whenever two points have a distance larger than your delta. 只要两点的距离大于您的增量,就会在图表中产生“间隙”。
Solution 3: 解决方案3:
Some charting packages allow to set an Y-Value of NULL and draw a "Gap" in thois case. 在某些情况下,某些图表包允许将Y值设置为NULL并绘制一个“间隙”。 So just add some more datapoints with Y=Null to produce the desired gaps.
因此,只需添加更多Y = Null的数据点即可产生所需的间隙。 This works for some charting libraries while others produce an exception.
这适用于某些图表库,而另一些则产生异常。 Reading the docs or (faster) experiments may help.
阅读文档或(更快)实验可能会有所帮助。
Note: 注意:
For solutions 2 and 3 it is necessary to create special series for charting purposes. 对于解决方案2和3,有必要创建特殊的图表系列。 It is not possible to simply "bind" to data from the database.
无法简单地“绑定”到数据库中的数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.