Пример #1
0
        /// <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 Range");

            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 polar chart
            NPolarChart chart = new NPolarChart();

            nChartControl1.Charts.Clear();
            nChartControl1.Charts.Add(chart);

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

            linearScale.ViewRangeInflateMode  = ScaleViewRangeInflateMode.MajorTick;
            linearScale.InflateViewRangeBegin = true;
            linearScale.InflateViewRangeEnd   = true;

            NScaleStripStyle strip = new NScaleStripStyle();

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

            // setup polar angle axis
            NPolarAxis angleAxis = (NPolarAxis)chart.Axis(StandardAxis.PolarAngle);

            NOrdinalScaleConfigurator ordinalScale = new NOrdinalScaleConfigurator();

            strip            = new NScaleStripStyle();
            strip.FillStyle  = new NColorFillStyle(Color.FromArgb(100, Color.DarkGray));
            strip.Interlaced = true;
            strip.SetShowAtWall(ChartWallType.Polar, true);
            ordinalScale.StripStyles.Add(strip);
            ordinalScale.MajorGridStyle.SetShowAtWall(ChartWallType.Polar, true);

            ordinalScale.InflateContentRange           = false;
            ordinalScale.MajorTickMode                 = MajorTickMode.CustomTicks;
            ordinalScale.DisplayDataPointsBetweenTicks = false;

            ordinalScale.MajorTickMode = MajorTickMode.CustomStep;
            ordinalScale.CustomStep    = 1;
            string[] labels = new string[] { "E", "NE", "N", "NW", "W", "SW", "S", "SE" };

            ordinalScale.AutoLabels = false;
            ordinalScale.Labels.AddRange(labels);
            ordinalScale.DisplayLastLabel = false;

            angleAxis.ScaleConfigurator = ordinalScale;
            angleAxis.View = new NRangeAxisView(new NRange1DD(0, 8));

            NPolarRangeSeries polarRange = new NPolarRangeSeries();

            polarRange.DataLabelStyle.Visible = false;
            chart.Series.Add(polarRange);

            Random rand = new Random();

            for (int i = 0; i < 8; i++)
            {
                polarRange.Values.Add(0);
                polarRange.Angles.Add(i - 0.4);

                polarRange.Y2Values.Add(rand.Next(80) + 20.0);
                polarRange.X2Values.Add(i + 0.4);
            }

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

            styleSheet.Apply(nChartControl1.Document);

            // init form controls
            BeginAngleScrollBar.Value = 0.0f;
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreatePolarChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Polar Range";

            // configure chart
            m_Chart = (NPolarChart)chartView.Surface.Charts[0];

            m_Chart.SetPredefinedPolarAxes(ENPredefinedPolarAxes.AngleValue);

            // setup polar axis
            NLinearScale linearScale = (NLinearScale)m_Chart.Axes[ENPolarAxis.PrimaryValue].Scale;

            linearScale.ViewRangeInflateMode   = ENScaleViewRangeInflateMode.MajorTick;
            linearScale.InflateViewRangeBegin  = true;
            linearScale.InflateViewRangeEnd    = true;
            linearScale.MajorGridLines.Visible = true;

            NScaleStrip strip = new NScaleStrip();

            strip.Fill       = new NColorFill(new NColor(NColor.Gray, 100));
            strip.Interlaced = true;
            linearScale.Strips.Add(strip);
            linearScale.MajorGridLines.Visible = true;

            // setup polar angle axis
            NPolarAxis angleAxis = m_Chart.Axes[ENPolarAxis.PrimaryAngle];

            NOrdinalScale ordinalScale = new NOrdinalScale();

            strip            = new NScaleStrip();
            strip.Fill       = new NColorFill(new NColor(NColor.DarkGray, 100));
            strip.Interlaced = true;
            ordinalScale.Strips.Add(strip);

            ordinalScale.InflateContentRange           = false;
            ordinalScale.MajorTickMode                 = ENMajorTickMode.CustomTicks;
            ordinalScale.DisplayDataPointsBetweenTicks = false;

            ordinalScale.MajorTickMode = ENMajorTickMode.CustomStep;
            ordinalScale.CustomStep    = 1;
            string[] labels = new string[] { "E", "NE", "N", "NW", "W", "SW", "S", "SE" };

            ordinalScale.Labels.TextProvider = new NOrdinalScaleLabelTextProvider(labels);
            ordinalScale.Labels.DisplayLast  = false;

            angleAxis.Scale             = ordinalScale;
            angleAxis.ViewRangeMode     = ENAxisViewRangeMode.FixedRange;
            angleAxis.MinViewRangeValue = 0;
            angleAxis.MaxViewRangeValue = 8;

            NPolarRangeSeries polarRange = new NPolarRangeSeries();

            polarRange.DataLabelStyle = new NDataLabelStyle(false);
            m_Chart.Series.Add(polarRange);

            Random rand = new Random();

            for (int i = 0; i < 8; i++)
            {
                polarRange.DataPoints.Add(new NPolarRangeDataPoint(i - 0.4, 0.0, i + 0.4, rand.Next(80) + 20.0));
            }

            chartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, false));

            return(chartView);
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                WebExamplesUtilities.FillComboWithValues(BeginAngleDropDownList, 0, 360, 15);
            }

            // disable frame
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

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

            title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;
            title.TextStyle.FillStyle        = new NColorFillStyle(Color.FromArgb(60, 90, 108));
            title.ContentAlignment           = ContentAlignment.BottomRight;
            title.Location = new NPointL(
                new NLength(2, NRelativeUnit.ParentPercentage),
                new NLength(2, NRelativeUnit.ParentPercentage));

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

            nChartControl1.Charts.Clear();
            nChartControl1.Charts.Add(polarChart);
            polarChart.DisplayOnLegend  = nChartControl1.Legends[0];
            polarChart.DisplayAxesOnTop = true;
            polarChart.Location         = new NPointL(new NLength(5, NRelativeUnit.ParentPercentage), new NLength(5, NRelativeUnit.ParentPercentage));
            polarChart.Size             = new NSizeL(new NLength(90, NRelativeUnit.ParentPercentage), new NLength(90, NRelativeUnit.ParentPercentage));

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

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

            NOrdinalScaleConfigurator ordinalScale = new NOrdinalScaleConfigurator();

            NScaleStripStyle strip = new NScaleStripStyle();

            strip.FillStyle  = new NColorFillStyle(Color.FromArgb(100, Color.DarkGray));
            strip.Interlaced = true;
            strip.SetShowAtWall(ChartWallType.Polar, true);
            ordinalScale.StripStyles.Add(strip);
            ordinalScale.MajorGridStyle.SetShowAtWall(ChartWallType.Polar, true);

            ordinalScale.InflateContentRange           = false;
            ordinalScale.MajorTickMode                 = MajorTickMode.CustomTicks;
            ordinalScale.DisplayDataPointsBetweenTicks = false;

            ordinalScale.MajorTickMode = MajorTickMode.CustomStep;
            ordinalScale.CustomStep    = 1;
            string[] labels = new string[] { "E", "NE", "N", "NW", "W", "SW", "S", "SE" };

            ordinalScale.AutoLabels = false;
            ordinalScale.Labels.AddRange(labels);
            ordinalScale.DisplayLastLabel = false;

            polarChart.Axis(StandardAxis.PolarAngle).ScaleConfigurator = ordinalScale;
            polarChart.Axis(StandardAxis.PolarAngle).View = new NRangeAxisView(new NRange1DD(0, 8));

            NPolarRangeSeries polarRange = new NPolarRangeSeries();

            polarRange.DataLabelStyle.Visible = false;
            polarChart.Series.Add(polarRange);

            Random rand = new Random();

            for (int i = 0; i < 8; i++)
            {
                polarRange.Values.Add(0);
                polarRange.Angles.Add(i - 0.4);

                polarRange.Y2Values.Add(rand.Next(80) + 20.0);
                polarRange.X2Values.Add(i + 0.4);
            }

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

            styleSheet.Apply(nChartControl1.Document);

            // apply settings
            polarChart.BeginAngle = BeginAngleDropDownList.SelectedIndex * 15.0f;
        }