绑定后更新 MSChart 中的数据值

发布于 2024-11-01 23:48:49 字数 640 浏览 5 评论 0原文

我有一个加载一组每日值的折线图。有时没有数据,所以如果我只加载我拥有的一组值,折线图会用一条直线连接不连续的日期,这会使图表产生误导。

然后,我调整查询以使用空值填充空白天(使用左连接),效果很好。

我现在遇到的问题是,当有一天有一个值,但前一天和连续几天没有值时,数据不会呈现(它将是一个点)。条形图可以解决该特定问题,但不适合此图表。

示例:

在此处输入图像描述

如果排名不是在除 12/15 之外的“间隔”日测量的,则您不会知道 12/15 有一个值。

因此,我认为可以解决此问题的一种方法是将空值替换为等于数据集中最低值的值,然后将无邻日显示为底部轴的峰值。至少我认为除非有更好的想法出现,否则这会起作用。

所以我的问题是:在绑定图表后,如何用 MIN 值替换空值(或者我可以先将数据绑定到中间控件以对其进行操作,然后将图表绑定到该控件)。我目前将图表绑定到存储过程,因此虽然我想我可以在那里进行操作,但我怀疑它会比创建数据集后对其进行迭代要复杂得多。

如果这是一个 gridview,我可以在 OnRowUpdating 代码中轻松完成,但我不知道图表控件有任何等效项。

有什么想法吗?

谢谢。

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:

enter image description here

If ranking was not measured on the 'gap' days except for 12/15, you would not know there was a value on 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). 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.

Any thoughts?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

雨轻弹 2024-11-08 23:48:49

为图中的每个点添加一个标记怎么样?

How about adding a marker to each point in the plot?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文