コード例 #1
0
        void GenerateData(NPolarPointSeries series)
        {
            int    randSeed = int.Parse(HiddenField1.Value);
            Random rand     = new Random(randSeed);

            series.Values.FillRandomRange(rand, 10, 0.0, 100.0);
            series.Angles.FillRandomRange(rand, 10, 0.0, 360.0);
        }
コード例 #2
0
        private void GenerateDataButton_Click(object sender, System.EventArgs e)
        {
            NChart            chart  = nChartControl1.Charts[0];
            NPolarPointSeries series = (NPolarPointSeries)chart.Series[0];

            GenerateData(series);

            nChartControl1.Refresh();
        }
コード例 #3
0
        private NSeries CreatePolarPointSeries(string name, PointShape shape)
        {
            NPolarPointSeries series = new NPolarPointSeries();

            series.Name = name;
            series.Angles.ValueFormatter  = new NNumericValueFormatter("0.00");
            series.DataLabelStyle.Visible = false;
            series.DataLabelStyle.Format  = "<value> - <angle_in_degrees>";
            series.PointShape             = shape;
            series.Size = new NLength(1.5f, NRelativeUnit.ParentPercentage);

            // add data
            series.Values.FillRandomRange(Random, 10, 0, 100);
            series.Angles.FillRandomRange(Random, 10, 0, 360);

            return(series);
        }
コード例 #4
0
        private NSeries CreatePolarPointSeries(string name, ENPointShape shape, Random random)
        {
            NPolarPointSeries series = new NPolarPointSeries();

            series.Name           = name;
            series.InflateMargins = false;

            NDataLabelStyle dataLabelStyle = new NDataLabelStyle();

            dataLabelStyle.Visible = false;
            dataLabelStyle.Format  = "<value> - <angle_in_degrees>";
            series.DataLabelStyle  = dataLabelStyle;
            series.Shape           = shape;
            series.Size            = 3.0;

            // add data
            for (int i = 0; i < 1000; i++)
            {
                series.DataPoints.Add(new NPolarPointDataPoint(random.Next(360), random.Next(100)));
            }

            return(series);
        }
コード例 #5
0
 void GenerateData(NPolarPointSeries series)
 {
     series.Values.FillRandomRange(Random, 25, 0.0, 100.0);
     series.Angles.FillRandomRange(Random, 25, 0.0, 360.0);
 }
コード例 #6
0
        public override void Initialize()
        {
            base.Initialize();

            nChartControl1.Panels.Clear();

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Polar Chart");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic);

            // configure the chart
            NPolarChart chart = new NPolarChart();

            nChartControl1.Charts.Add(chart);

            chart.LabelLayout.EnableInitialPositioning = true;
            chart.LabelLayout.EnableLabelAdjustment    = true;

            // setup polar value 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);

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

            angularScale.MajorGridStyle.SetShowAtWall(ChartWallType.Polar, true);

            // polar point series
            NPolarPointSeries series1 = (NPolarPointSeries)chart.Series.Add(SeriesType.PolarPoint);

            series1.PointShape     = PointShape.Ellipse;
            series1.Size           = new NLength(1.2f, NRelativeUnit.ParentPercentage);
            series1.InflateMargins = true;
            series1.FillStyle      = new NColorFillStyle(DarkOrange);

            series1.DataLabelStyle.Visible                = true;
            series1.DataLabelStyle.VertAlign              = VertAlign.Center;
            series1.DataLabelStyle.ArrowLength            = new NLength(12);
            series1.DataLabelStyle.ArrowStrokeStyle.Color = DarkOrange;
            series1.DataLabelStyle.TextStyle.BackplaneStyle.StandardFrameStyle.InnerBorderColor = DarkOrange;

            series1.LabelLayout.EnableDataPointSafeguard = true;
            series1.LabelLayout.DataPointSafeguardSize   = new NSizeL(
                new NLength(1.3f, NRelativeUnit.ParentPercentage),
                new NLength(1.3f, NRelativeUnit.ParentPercentage));
            series1.LabelLayout.UseLabelLocations        = true;
            series1.LabelLayout.OutOfBoundsLocationMode  = OutOfBoundsLocationMode.PushWithinBounds;
            series1.LabelLayout.InvertLocationsIfIgnored = true;

            // fill with random data
            GenerateData(series1);

            // apply layout
            ConfigureStandardLayout(chart, title, null);

            // init form controls
            EnableLabelAdjustmentCheck.Checked    = true;
            RemoveOverlappedLabelsCheck.Checked   = false;
            EnableInitialPositioningCheck.Checked = true;
            EnableDataPointSafeguardCheck.Checked = true;
            SafeguardSizeNumericUpDown.Value      = 12;
        }
コード例 #7
0
        public override void Initialize()
        {
            base.Initialize();

            nChartControl1.Panels.Clear();

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Real Time Polar");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, 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);

            ConfigureStandardLayout(chart, title, null);

            UseHardwareAccelerationCheckBox.Checked = true;
            StartTimer();
        }
コード例 #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                EnableInitialPositioningCheckBox.Checked = true;
                RemoveOverlappedLabelsCheckBox.Checked   = false;
                EnableLabelAdjustmentCheckBox.Checked    = true;
                EnableDataPointSafeguardCheckBox.Checked = true;

                WebExamplesUtilities.FillComboWithValues(SafeguardSizeDropDownList, 0, 20, 1);
                SafeguardSizeDropDownList.SelectedIndex = 12;

                HiddenField1.Value = Random.Next().ToString();
            }

            nChartControl1.Settings.JitterMode = JitterMode.Enabled;
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            nChartControl1.Panels.Clear();

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Polar Chart");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.ContentAlignment    = ContentAlignment.BottomRight;
            title.Location            = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage));

            // configure the chart
            NPolarChart chart = new NPolarChart();

            chart.Location = new NPointL(new NLength(5, NRelativeUnit.ParentPercentage), new NLength(5, NRelativeUnit.ParentPercentage));
            chart.Size     = new NSizeL(new NLength(90, NRelativeUnit.ParentPercentage), new NLength(90, NRelativeUnit.ParentPercentage));
            nChartControl1.Charts.Add(chart);

            // setup polar value 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);

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

            angularScale.MajorGridStyle.SetShowAtWall(ChartWallType.Polar, true);

            // polar point series
            NPolarPointSeries series1 = (NPolarPointSeries)chart.Series.Add(SeriesType.PolarPoint);

            series1.PointShape     = PointShape.Ellipse;
            series1.Size           = new NLength(2.0f, NRelativeUnit.ParentPercentage);
            series1.InflateMargins = true;
            series1.FillStyle      = new NColorFillStyle(DarkOrange);

            series1.DataLabelStyle.Visible                = true;
            series1.DataLabelStyle.VertAlign              = VertAlign.Center;
            series1.DataLabelStyle.ArrowLength            = new NLength(12);
            series1.DataLabelStyle.ArrowStrokeStyle.Color = DarkOrange;
            series1.DataLabelStyle.TextStyle.BackplaneStyle.StandardFrameStyle.InnerBorderColor = DarkOrange;
            series1.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(8);

            chart.LabelLayout.EnableInitialPositioning = EnableInitialPositioningCheckBox.Checked;
            chart.LabelLayout.RemoveOverlappedLabels   = RemoveOverlappedLabelsCheckBox.Checked;
            chart.LabelLayout.EnableLabelAdjustment    = EnableLabelAdjustmentCheckBox.Checked;

            series1.LabelLayout.EnableDataPointSafeguard = EnableDataPointSafeguardCheckBox.Checked;

            float   safeguardSize = (float)SafeguardSizeDropDownList.SelectedIndex;
            NLength sz            = new NLength(safeguardSize, NGraphicsUnit.Point);

            series1.LabelLayout.DataPointSafeguardSize = new NSizeL(sz, sz);

            series1.LabelLayout.UseLabelLocations        = true;
            series1.LabelLayout.OutOfBoundsLocationMode  = OutOfBoundsLocationMode.PushWithinBounds;
            series1.LabelLayout.InvertLocationsIfIgnored = true;

            // fill with random data
            GenerateData(series1);
        }