Radar frequency

I would like to draw a radar chart using the MS Chart control in a WinForms application.

This chart contains data for 1 day, I have data for every second, so I have 86,400 xy value pairs. The x axis contains dates, y are my int values.

My test code is as follows:

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;

The result is as follows: enter image description here

I think the reason for the black circle effect is that it draws the y axis for every 86,400 points. How can I set it to draw these axes only at any time?

Labels (dates set by me) for the x-axis are not displayed. How can I show them?

thanks in advance!

.net4 / C # / winforms / vs2010

+5
1

, "" "". - , , :

chart1.Series["Default"].ChartType = SeriesChartType.Polar;
chart1.Series[0]["PolarDrawingStyle"] = "Line";
// setup the X grid
chart1.ChartAreas["Default"].AxisX.MajorGrid.Enabled = true;
chart1.ChartAreas["Default"].AxisX.MajorGrid.IntervalType = DateTimeIntervalType.Hours;
chart1.ChartAreas["Default"].AxisX.MajorGrid.Interval = 1;
chart1.ChartAreas["Default"].AxisX.Crossing = 0;
// setupthe Y grid
chart1.ChartAreas["Default"].AxisY.MajorGrid.Enabled = true;

Polar plot

+3

All Articles