/// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Polar Area");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic);
            title.ContentAlignment    = ContentAlignment.BottomCenter;
            title.Location            = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage));

            // setup chart
            NPolarChart chart = new NPolarChart();

            nChartControl1.Charts.Clear();
            nChartControl1.Charts.Add(chart);
            chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal);
            chart.DisplayOnLegend = nChartControl1.Legends[0];
            chart.Width           = 70.0f;
            chart.Height          = 70.0f;
            chart.Depth           = 5;

            // setup polar axis
            NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)chart.Axis(StandardAxis.Polar).ScaleConfigurator;

            linearScale.RoundToTickMax = true;
            linearScale.RoundToTickMin = true;
            linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Polar, true);

            NScaleStripStyle strip = new NScaleStripStyle();

            strip.FillStyle  = new NColorFillStyle(Color.FromArgb(125, Color.Beige));
            strip.Interlaced = true;
            strip.SetShowAtWall(ChartWallType.Polar, true);
            linearScale.StripStyles.Add(strip);

            // setup polar angle axis
            NAngularScaleConfigurator angularScale = (NAngularScaleConfigurator)chart.Axis(StandardAxis.PolarAngle).ScaleConfigurator;

            angularScale.MajorGridStyle.SetShowAtWall(ChartWallType.Polar, true);
            strip            = new NScaleStripStyle();
            strip.FillStyle  = new NColorFillStyle(Color.FromArgb(125, 192, 192, 192));
            strip.Interlaced = true;
            strip.SetShowAtWall(ChartWallType.Polar, true);
            angularScale.StripStyles.Add(strip);

            // polar area series 1
            NPolarAreaSeries series1 = new NPolarAreaSeries();

            chart.Series.Add(series1);
            series1.Name = "Theoretical";
            series1.DataLabelStyle.Visible = false;
            GenerateData(series1, 100, 15.0);

            // polar area series 2
            NPolarAreaSeries series2 = new NPolarAreaSeries();

            chart.Series.Add(series2);
            series2.Name = "Experimental";
            series2.DataLabelStyle.Visible = false;
            GenerateData(series2, 100, 10.0);

            // apply style sheet
            NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh);

            styleSheet.Apply(nChartControl1.Document);

            // init form controls
            RadianAngleStepComboBox.Items.Add("15");
            RadianAngleStepComboBox.Items.Add("30");
            RadianAngleStepComboBox.Items.Add("45");
            RadianAngleStepComboBox.Items.Add("90");
            RadianAngleStepComboBox.SelectedIndex = 0;
            BeginAngleScrollBar.Value             = 0.0f;
        }
Example #2
0
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            nChartControl1.Panels.Clear();

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader(this.Title);

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic);
            title.ContentAlignment    = ContentAlignment.BottomCenter;
            title.Location            = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage));

            // setup chart
            NPolarChart chart = new NPolarChart();

            nChartControl1.Panels.Add(chart);
            chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal);
            chart.InnerRadius = new NLength(10, NGraphicsUnit.Point);
            chart.Width       = 70.0f;
            chart.Height      = 70.0f;

            Color gridColor = Color.Green;

            NPolarAxis polarAngleAxis            = (NPolarAxis)chart.Axis(StandardAxis.PolarAngle);
            NAngularScaleConfigurator angleScale = (NAngularScaleConfigurator)polarAngleAxis.ScaleConfigurator;

            angleScale.MajorGridStyle.SetShowAtWall(ChartWallType.Polar, true);
            angleScale.MajorGridStyle.LineStyle.Color      = gridColor;
            angleScale.OuterMajorTickStyle.LineStyle.Color = gridColor;
            angleScale.InnerMajorTickStyle.LineStyle.Color = gridColor;
            angleScale.LabelStyle.TextStyle.FillStyle      = new NColorFillStyle(gridColor);
            angleScale.RulerStyle.BorderStyle.Color        = gridColor;
            angleScale.LabelFitModes = new LabelFitMode[0];

            m_RadarRay = new NAxisConstLine[10];

            for (int i = 0; i < m_RadarRay.Length; i++)
            {
                m_RadarRay[i] = new NAxisConstLine();
                m_RadarRay[i].StrokeStyle.Color = Color.FromArgb((byte)((1.0 - ((float)i / m_RadarRay.Length)) * 255), gridColor);
                polarAngleAxis.ConstLines.Add(m_RadarRay[i]);
            }

            // setup polar axis
            NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)chart.Axis(StandardAxis.Polar).ScaleConfigurator;

            linearScale.RoundToTickMax = true;
            linearScale.RoundToTickMin = true;
            linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;
            linearScale.AutoLabels = false;
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Polar, true);
            linearScale.MajorGridStyle.LineStyle.Color = gridColor;
            linearScale.InnerMajorTickStyle.Width      = new NLength(0);
            linearScale.OuterMajorTickStyle.Width      = new NLength(0);
            linearScale.RulerStyle.BorderStyle.Width   = new NLength(0);

            // create three polar point series
            m_PolarSeries      = new NPolarPointSeries();
            m_PolarSeries.Name = "Polar";
            m_PolarSeries.BorderStyle.Width = new NLength(0);
            m_PolarSeries.PointShape        = PointShape.Bar;
            m_PolarSeries.Size = new NLength(4, NGraphicsUnit.Point);
            m_PolarSeries.Angles.ValueFormatter  = new NNumericValueFormatter("0.00");
            m_PolarSeries.DataLabelStyle.Visible = false;
            m_PolarSeries.DataLabelStyle.Format  = "<value> - <angle_in_degrees>";

            // change the storage type to array to increase performance
            m_PolarSeries.FillStyles.StorageType = IndexedStorageType.Array;

            Random rand = new Random();

            for (int i = 0; i < 360; i++)
            {
                m_PolarSeries.Values.Add(rand.Next(100));
                m_PolarSeries.Angles.Add(i);
                m_PolarSeries.FillStyles[i] = new NColorFillStyle(Color.FromArgb(0, Color.Green));
            }

            // add the series to the chart
            chart.Series.Add(m_PolarSeries);

            UseHardwareAccelerationCheckBox.IsChecked = true;
            nChartControl1.Settings.RenderSurface     = RenderSurface.Window;
            StartTimer();

            ConfigureStandardLayout(chart, title, null);
        }