C#中MS图表中的#VALX值不在"M/d H:mm"中,格式 [英] #VALX value in MS Chart in C# isn't coming in "M/d H:mm" format
问题描述
我编写了以下Winforms代码:
I wrote the following Winforms code:
chart1.ChartAreas[0].AxisX.LabelStyle.Format = "M/d H:mm ";
这使我的X轴显示为例如11/25 8:00.但是,当我为数据点提供工具提示时,它仅提供日期,而不是格式"M/d H:mm". 这是我的代码:
This makes my X-axis seen as, for example 11/25 8:00. But when I provide the tooltip for the datapoints it just provides the date and not the format "M/d H:mm". Here is my code:
chart1.Series[0].ToolTip = "Computer Name: #SERIESNAME \nDate & Time: #VALX \nLevel: #VALY";`
我得到的工具提示结果是这样的:
And the tooltip result which I got was this:
计算机名称: COMP NAME
日期和时间: 11/25/2013
级别: 4
Computer Name: COMP NAME
Date & Time: 11/25/2013
Level: 4
我希望日期和时间"值为"11/25 8:00",该值在X轴上显示,但在#VALX工具提示中不显示.
I want the "Date & Time" value as " 11/25 8:00", which is being showed in the X-axis but not in the #VALX tooltip.
推荐答案
请尝试以下操作:#VALX{M/d H:mm}
.
因此您的代码将是:
Try this: #VALX{M/d H:mm}
.
So your code will be:
chart1.Series[0].ToolTip = "Computer Name: #SERIESNAME \nDate & Time: #VALX{M/d H:mm} \nLevel: #VALY";
这篇关于C#中MS图表中的#VALX值不在"M/d H:mm"中,格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!