【发布时间】:2014-02-19 05:34:46
【问题描述】:
我有一个来自 dbgrid 显示的查询的动态表,看起来像这样
code | Name | Date | Time |Score
1 | Alex | 01-Feb-14 | 0600 |5
1 | Alex | 01-Feb-14 | 0700 |7
1 | Alex | 01-Feb-14 | 0800 |8
1 | Alex | 02-Feb-14 | 0600 |7
1 | Alex | 02-Feb-14 | 0800 |8
1 | Alex | 02-Feb-14 | 0900 |8
1 | Alex | 03-Feb-14 | 0700 |7
1 | Alex | 03-Feb-14 | 0800 |5
1 | Alex | 03-Feb-14 | 0900 |8
查询的输入是code=1, date1=01-feb-14, date2=03-feb-14
如何制作具有多个系列的折线图,按日期分组,xlabel = time 和 y value = score? 我的伪代码是:
for date1 to date 2
chart1.addseries
for time=lowesttime to highesttime do
begin
series.xlabel = time
series.yvalue = score
end
它看起来像这样
【问题讨论】:
-
感谢 Rufo 先生的图片,无论如何这是我的第一个问题,如果我需要提供更多数据,或者请告诉我。谢谢
-
我真的不想要标签的系统时间,我的意思是我表中记录的时间。另外,每次日期更改时,我都需要制作一个新系列,但如果我问错了问题,我很抱歉。
-
只需将 x 值替换为您的表格时间(作为 TDateTime 值),并定义您的 x 轴应如何显示。
Chart1.Series[dateX].XValues.DateTime := True; Chart1.BottomAxis.DateTimeFormat := 'hh:nn';