2011-08-08 15 views
5

मैं एक WinForms ऐप में एमएस चार्ट नियंत्रण का उपयोग कर एक रडार चार्ट आकर्षित करना चाहता हूं।एमएस चार्ट रडार अक्ष आवृत्ति

इस चार्ट में 1 दिन का डेटा है, मेरे पास प्रत्येक सेकंड के लिए डेटा है, इसलिए मेरे पास 86 400 x-y मान जोड़े हैं। एक्स अक्ष में तारीखें हैं, 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; 

परिणाम देखने के इस तरह है: enter image description here

मुझे लगता है कि 'काला घेरा प्रभाव' का कारण यह है कि यह हर 86 के लिए y अक्ष खींचता है 400 अंक मैं इन अक्षों को केवल हर घंटों में खींचने के लिए कैसे सेट कर सकता हूं?

एक्स अक्ष के लिए लेबल (सेट के रूप में सेट) दिखाई नहीं देते हैं। मैं उन्हें कैसे दिखा सकता हूं?

अग्रिम में Thx!

.net4/सी #/WinForms/VS2010

उत्तर

3

आप शायद बजाय "रडार" का एक "ध्रुवीय" साजिश का उपयोग करना चाहते। ऐसा ही कुछ आप मैं क्या आप चाहते हैं लगता है के करीब मिल जाएगा:

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

+0

आपकी मदद के लिए धन्यवाद! – Tom

संबंधित मुद्दे