简体   繁体   中英

How to Manipulate X-axis of chart

I have made a chart and added the points on runtime. The data is plotted as Chart1.ChartAreas(0).AxisX.IntervalType = DateTimeIntervalType.Weeks Chart1.Series("PH").Points.AddXY(DateTime.Parse(dr.Item("readtime")).ToString("MM-dd"), dr.Item("ph")) The data that is plotted holds 7 days of data. As shown below, the date is repeated. 在此处输入图片说明

How to achieve the x axis showing only 11-08, 11-13, 11-14 in this case?

Here is a sample data 在此处输入图片说明

When you get data from database, use like this,

SELECT SUM(ph),SUM(tmp),SUM(orp),SUM(sal),SUM(ec),SUM(tds),SUM(do),readtime
FROM <your tables>
GROUP BY readtime

The results set returned from this query is the thing you are looking for....

The data that you show is obviously invalid data.

You have several zero readings occurring at exactly the same time - midnight.

I suspect these are not even real readings.

You need to exclude them (and you should probably find out why this is happening - maybe a parsing error?)

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