简体   繁体   English

绑定后更新MSChart中的数据值

[英]Updating data values in MSChart after binding

I have a line chart that loads a set of daily values. 我有一个折线图,它加载一组每日值。 Some days there is no data, so if I just load the set of values I have, the line chart connects the non-contiguous days with a straight line which renders the chart misleading. 有时候,没有数据,因此,如果我仅加载自己拥有的一组值,则折线图会将不连续的日子与一条直线连接起来,这会导致图表产生误导。

I then adjusted my query to fill in the blank days with null values (using a left join) and that works fine. 然后,我调整了查询​​以使用空值(使用左联接)填充空白天,并且工作正常。

The problem I'm having now is that when there is a single day that has a value, but the previous and successive days do not have values, the data is not rendered (it would be a single point). 我现在遇到的问题是,当有一天有一个值,但是前几天和后续几天没有值时,就不会呈现数据(这将是一个点)。 Bar charts would address that particular issue but are not appropriate for this chart. 条形图可以解决该特定问题,但不适用于该图。

Example: 例:

在此处输入图片说明

If ranking was not measured on the 'gap' days except for 12/15, you would not know there was a value on 12/15. 如果除12/15之外的“间隔”天未衡量排名,您将不知道12/15的值。

So one way I believe I can address this is to replace the null values with a value equal to the lowest value in my dataset, which would then show neighborless days as spikes off of the bottom axis. 因此,我认为可以解决此问题的一种方法是将空值替换为等于我的数据集中的最低值的值,然后它将显示无邻居的日子,即下轴的峰值。 At least I think this will work unless a better idea surfaces. 至少我认为,除非有更好的主意,否则这将起作用。

So my question is: how can I replace the null values with my MIN value after the chart has been bound (or can I bind the data to an intermediate control first to manipulate it and then bind the chart to that). 所以我的问题是:在绑定图表之后,如何用MIN值替换空值(或者可以先将数据绑定到中间控件以对其进行操作,然后再将其绑定到该中间控件)。 I currently bind the chart to a stored procedure so while i suppose i could do the manipulation there, I suspect it would be much more complicated than iterating through the data set after it was created. 我目前将图表绑定到存储过程,因此尽管我想可以在其中进行操作,但我怀疑它比在创建数据集后对其进行遍历要复杂得多。

If this were a gridview, I could do it easily in the OnRowUpdating code, but I don't know of any equivalent for the chart control. 如果这是gridview,则可以在OnRowUpdating代码中轻松实现,但我不知道该图表控件是否具有等效功能。

Any thoughts? 有什么想法吗?

Thanks. 谢谢。

如何在图中的每个点添加标记?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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