如何在ms chart axisX标签上显示毫秒数? [英] How to show milliseconds on ms chart axisX labels?

查看:200
本文介绍了如何在ms chart axisX标签上显示毫秒数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在图表(Windows窗体,VS2010,C ++,.NET)上显示数据,其中axisX标签显示它的x值,以毫秒为单位。

使用X数据类型:DateTime。

我将图表属性设置为

I'm trying to show data on Chart (Windows Forms, VS2010, C++, .NET) with axisX labels showing it's x-value with milliseconds.
Using X-data type: DateTime.
I set chart properties to

chartArea1->AxisX->LabelStyle->Format = L"HH:mm:ss.fffffff";




chartArea1->AxisX->LabelStyle->IntervalType = System::Windows::Forms::DataVisualization::Charting::DateTimeIntervalType::Milliseconds;



我正在向DateTime结构添加毫秒,例如


I'm adding milliseconds to DateTime structure like

dt = dt->AddMilliseconds(1345768.0);



所以


so by

dt->ToString("HH:mm:ss.fffffff")



我看到了正确的00:22:25.7680000价值

和图表显示se根据毫秒值正确分隔的veral点。

但是axisX标签显示x值,如00:22:25.0000000这些是段的值。 />


我还能做些什么来使图表显示正确的标签毫秒?也许更多的轴x轴?



更新:

我找到了间隔问题的解决方案(参见sol .1到这个问题)但是出现了另外一个问题!

现在我每隔250ms有一个标签,如AxisX-> Interval设置为250


i'm seeing a correct "00:22:25.7680000" value
and chart displays several points correctly separated according to milliseconds value.
But the axisX labels show x-value like this "00:22:25.0000000" that are the values of segments.

What else should I do to make chart show labels correctly with milliseconds??? Maybe more segments of axisX?

UPDATE:
I found the solution of the interval problev (see sol.1 to this question) but there appear another one problem!
Now I have labels every 250ms as AxisX->Interval is set to 250

chartArea1->AxisX->Interval = 250;



但标签仅出现在圆形上值 22:25.000 - 22:25.250 - 22:25.500 - 22:25.750

虽然我的axisX最小值和最大值是动态变化的,但是从非圆值开始导致标签移动。



我需要的是X轴上相同位置的5或6个标签:一个在开头,一个在结尾,3-4个在中间。

如何???


but labels appear only on round values like 22:25.000 - 22:25.250 - 22:25.500 - 22:25.750
Though my axisX minimum and maximum are dynamically changed and start from not round value that leads to labels moving.

What I need is 5 or 6 labels on X axis in same places: one at the start, one at the end, and 3-4 in the middle.
How to???

推荐答案

好吧,我做了一个明确的任务,找到了一个解决方案=))

重点是图表仅显示其段的axisX标签,而不是每个点(尽管可能是e为每个点制作标签。)

因此,只需将间隔设置为非自动值

Well, I made a clear task and found a solution =))
The point is that the chart displays axisX labels for its segments only, not for each point (though it is possible to make label for each point).
So, simply by setting interval to not Auto value
chartArea1->AxisX->Interval = 250;



它使得axisX标签每250毫秒,所以我得到了像

00:22:25.0000000 <的标签/ b> 00:22:25.2500000 00:22:25.5000000 等......


这篇关于如何在ms chart axisX标签上显示毫秒数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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