MS图雷达轴频率
我想在 WinForms 应用程序中使用 MS Chart 控件绘制雷达图。
该图表包含 1 天的数据,我有每秒的数据,所以我有 86 400 个 xy 值对。 X 轴包含日期,y 轴包含 int 值。
我的测试代码是这样的:
var fromDate = new DateTime(DateTime.Now.Year,
DateTime.Now.Month,
DateTime.Now.Day,
0,
0,
0);
var toDate = new DateTime(DateTime.Now.Year,
DateTime.Now.Month,
DateTime.Now.Day,
23,
59,
59);
List<DateTime> xValues = new List<DateTime>();
List<double> yValues = new List<double>();
var iterDate = fromDate;
var i = 0;
while (iterDate <= toDate)
{
xValues.Add(iterDate);
yValues.Add(i);
iterDate = iterDate.AddSeconds(1);
i++;
}
chart1.Series["Default"].Points.DataBindXY(xValues, yValues);
var dateLabelStyle = new LabelStyle();
dateLabelStyle.Format = "HH:mm:ss";
chart1.ChartAreas["Default"].AxisX.LabelStyle = dateLabelStyle;
chart1.ChartAreas["Default"].AxisX.Minimum = fromDate.ToOADate();
chart1.ChartAreas["Default"].AxisX.Maximum = toDate.ToOADate();
chart1.Series["Default"].IsXValueIndexed = true;
chart1.Series["Default"].ChartType = SeriesChartType.Radar;
chart1.Series["Default"]["RadarDrawingStyle"] = "Line";
chart1.Series["Default"]["AreaDrawingStyle"] = "Circle";
chart1.Series["Default"]["CircularLabelsStyle"] = "Horizontal";
chart1.ChartAreas["Default"].Area3DStyle.Enable3D = false;
结果视图是这样的:
我认为“黑圈效应”的原因是它每 86 400 个点绘制 y 轴。我怎样才能设置它只在每小时绘制这些轴?
x 轴的标签(我设置的日期)不会出现。我怎样才能向他们展示?
提前谢谢!
.net4/c#/winforms/vs2010
I'd like to draw a radar chart using MS Chart control in a WinForms app.
This chart contains data for 1 day, I have data for every seconds, so I have 86 400 x-y value pairs. X axis contains dates, y my int values.
My test code is like this:
var fromDate = new DateTime(DateTime.Now.Year,
DateTime.Now.Month,
DateTime.Now.Day,
0,
0,
0);
var toDate = new DateTime(DateTime.Now.Year,
DateTime.Now.Month,
DateTime.Now.Day,
23,
59,
59);
List<DateTime> xValues = new List<DateTime>();
List<double> yValues = new List<double>();
var iterDate = fromDate;
var i = 0;
while (iterDate <= toDate)
{
xValues.Add(iterDate);
yValues.Add(i);
iterDate = iterDate.AddSeconds(1);
i++;
}
chart1.Series["Default"].Points.DataBindXY(xValues, yValues);
var dateLabelStyle = new LabelStyle();
dateLabelStyle.Format = "HH:mm:ss";
chart1.ChartAreas["Default"].AxisX.LabelStyle = dateLabelStyle;
chart1.ChartAreas["Default"].AxisX.Minimum = fromDate.ToOADate();
chart1.ChartAreas["Default"].AxisX.Maximum = toDate.ToOADate();
chart1.Series["Default"].IsXValueIndexed = true;
chart1.Series["Default"].ChartType = SeriesChartType.Radar;
chart1.Series["Default"]["RadarDrawingStyle"] = "Line";
chart1.Series["Default"]["AreaDrawingStyle"] = "Circle";
chart1.Series["Default"]["CircularLabelsStyle"] = "Horizontal";
chart1.ChartAreas["Default"].Area3DStyle.Enable3D = false;
Result view is like this:
I think the reason of the 'black circle effect' is that it draws y axis for every 86 400 points. How can I set it to draw these axes only at every hours?
Labels (dates as I set) for x axes do not appear. How can I show them?
Thx in advance!
.net4/c#/winforms/vs2010
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能想使用“极地”图而不是“雷达”。类似的东西会让你更接近你想要的我认为:
You probably want to use a "Polar" plot instead of "Radar". Something like that will get you closer to what you want I think: