为什么AddGantt或AddGanttColor为不同的调用返回相同的索引? [英] Why AddGantt or AddGanttColor returns the same index for different invocations?

查看:58
本文介绍了为什么AddGantt或AddGanttColor为不同的调用返回相同的索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于某些原因,在使用方法AddGanttColor或AddGantt将甘特图添加到TGanttSeries实例时,对于两个不同的调用,返回相同的索引.

For some reason for certain cases when adding gantts to a TGanttSeries instance using method AddGanttColor or AddGantt the same index is returned for two different calls.

例如,以下代码段说明了最后两个调用都返回值1的情况.

For example, the following snippet illustrates the case where the last two calls both return index of value 1.

Series.AddGanttColor(0, 100, 0, 'WA #234', clGreen);   // returns value 0
Series.AddGanttColor(100, 200, 1, 'WA #235', clGreen); // returns value 1 
Series.AddGanttColor(50, 200, 2, 'WA #237', clGreen);  // returns value 1!

但是,将显示所有三个甘特图.因此,似乎第三行将gantt添加为列表中的第二行,并将第二行添加的gantt移至最后一行(第三行,并具有索引2).

However, all three gantts are displayed. So, it seems that the third line added gantt as the second in the list, and moved the gantt added on the second line to be the last one (third, and having index 2).

任何人都可以解释一下如何解决此问题,以确保根据AddGanttColor调用,返回的索引与gantts保持关联.在上面的示例中,我希望索引值0、1和2分别与第一个,第二个和第三个添加的甘特关联.

Could anyone please explain how could this be remedied to ensure that returned indexes stay associated with gantts as per AddGanttColor calls. In the above example, I would expect index values 0, 1, and 2 to be associated with the first, second and third added gantt respectively.

刚刚确认对于在Delphi 5下运行的TeeChart 5和8版本,这种情况仍然适用.

Have just confirmed that this situation holds true for TeeChart versions 5 and 8 running under Delphi 5.

推荐答案

好吧...经过一些研究,问题的原因被缩小到属性 Series.XValues.Order 的值.此属性应设置为 loNone ,以保留从AddGantt返回的索引值和相应的gantts之间的关联.

Well... after some research the cause of the problem was narrowed down to the value of property Series.XValues.Order. This property should be set to loNone in order to preserve association between index values returned from AddGantt and corresponding gantts.

IMO,这是API缺陷.

IMO this is an API deficiency.

这篇关于为什么AddGantt或AddGanttColor为不同的调用返回相同的索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆