图表x轴意外行为 [英] Charts x axis unexpected behavior

查看:72
本文介绍了图表x轴意外行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含4个系列的图表。每个系列都会在不同时间添加,具体取决于应用功能的打开/关闭功能。所有系列都在x轴上:

I have a chart with 4 series. Each series is added at different times, depending on what is switched on/off of the app features. All series have on the x axis:

DateTime.Now.ToString("mm:ss")



so我认为在任何时候系列数据都可用,它们将被添加到图表中,当时发生在x轴上。看起来不是那样的。此图表显示蓝线和红线。蓝色线首先开始,然后几秒钟后我检查了激活红线的checkBox2,这恰好发生在27:38(在蓝线上可以看到一个小滴)。我不明白为什么红线从图表的最左边开始而不是在触发时(27:38)。



这是我的代码:


so I thought that at any time the series data are available, they will be added to the chart at that time that happens on x axis. Looks like is not like that. This chart shows a blue line and a red line. The blue line started first then after few seconds I checked checkBox2 which activate the red line, that happened exactly at 27:38 (where you can see a small drop on the blue line). I do not understand why the red line starts at the far left of the chart and not at the time that was triggered (27:38).

This is my code:

string reqTemp = textBox9.Text;
        textBox2.Text = avTemp.ToString("F");
        this.chart1.Series["Actual Temperature"].Points.AddXY(DateTime.Now.ToString("mm:ss"), avTemp);
        if (checkBox2.Checked == true)
        {
            this.chart1.Series["Requested Temperature"].Points.AddXY(DateTime.Now.ToString("mm:ss"), reqTemp);
        }   





图表图片 http://i41.tinypic.com/wwd7nk.jpg [ ^ ]



如何在第一个系列已经运行后添加系列,从他们开机的时间?基本上所有系列共享相同的x轴。



Chart picturehttp://i41.tinypic.com/wwd7nk.jpg[^]

How can I have the series added after the first one was already running, starting at the time they are switched on? Basically all series sharing the same x axis.

推荐答案

它有几件事情,但最有可能的是你没有绑定你的系列是最小和最大你的x轴。你的第一个系列从0开始,然后在你检查时,x轴从0延伸到27:38+。你的第二个系列x轴没有绑定到你的第一个系列x轴,所以它的最小值是27:38,这就是它从左边开始的原因。在x轴上没有显示的原因是你将图表x轴与第一个系列相关联。

您需要创建一些点类,进行绑定或绑定系列2系列1最大最小值的最大分钟
There are several things it can be, but the most likely given that you are not binding your series is minimum and maximum of your x axis. Your first series starts at say 0 and at the point you check then box the x axis extends from 0 to 27:38+. Your second series x axis is not bound to your first series x axis so it's minimum value is 27:38, that is why it starts on the left. The reason this doesn't show on the x axis is that you have the charts x axis tied to the first series.
You either need to create some point classes, do binding, or tie the series 2 max min to the series 1 max min


这实际上取决于你如何构建图表,你有代码还是你使用设计师?

很可能你需要同时添加所有系列,然后只在选中复选框时填充。
It really depends on how you built the chart, do you have the code for that or did you use the designer?
Most likely you need to have the series all added at the same time, then only populate when you check the box.


这篇关于图表x轴意外行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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