简体   繁体   中英

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.

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.

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.

Is there any way I can rectify this?

Thanks.

This is how my current chart looks like.

在此处输入图片说明

Solution1:

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.

Solution 2:

  • Define/calculate the minimal distance (X-Delta) between two existing data points
  • whenever a series contains a gap larger than this delta, start a new series for drawing purposes.

This will produce "gaps" in the chart whenever two points have a distance larger than your delta.

Solution 3:

Some charting packages allow to set an Y-Value of NULL and draw a "Gap" in thois case. So just add some more datapoints with Y=Null to produce the desired gaps. 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. It is not possible to simply "bind" to data from the database.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM