private void UpdateAxes() { NPolarChart polarChart = nChartControl1.Charts[0] as NPolarChart; if (polarChart == null) { return; } NAxis angleAxis = polarChart.Axis(StandardAxis.PolarAngle); // configure the red axis NAxis redAxis = polarChart.Axis(StandardAxis.Polar); NPolarAxisAnchor redAnchor; RedAxisAngleUpDown.Enabled = !DockRedAxisCheckBox.Checked; if (DockRedAxisCheckBox.Checked) { redAnchor = new NDockPolarAxisAnchor(PolarAxisDockZone.Bottom); RedAxisAngleUpDown.Enabled = false; } else { NCrossPolarAxisAnchor crossAnchor = new NCrossPolarAxisAnchor(); crossAnchor.Crossings.Add(new NValueAxisCrossing(angleAxis, (float)RedAxisAngleUpDown.Value)); redAnchor = crossAnchor; } redAnchor.PaintReflection = RedAxisPaintReflectionCheckBox.Checked; redAnchor.BeginPercent = (float)RedBeginUpDown.Value; redAnchor.EndPercent = (float)RedEndUpDown.Value; redAxis.Anchor = redAnchor; // configure the green axis NAxis greenAxis = polarChart.Axis(m_CustomAxisId); NPolarAxisAnchor greenAnchor; GreenAxisAngleUpDown.Enabled = !DockGreenAxisCheckBox.Checked; if (DockGreenAxisCheckBox.Checked) { NDockPolarAxisAnchor dockAnchor = new NDockPolarAxisAnchor(PolarAxisDockZone.Left); greenAnchor = dockAnchor; } else { NCrossPolarAxisAnchor crossAnchor = new NCrossPolarAxisAnchor(); crossAnchor.Crossings.Add(new NValueAxisCrossing(angleAxis, (float)GreenAxisAngleUpDown.Value)); greenAnchor = crossAnchor; } greenAnchor.PaintReflection = GreenAxisReflectionPaintCheckBox.Checked; greenAnchor.BeginPercent = (float)GreenBeginUpDown.Value; greenAnchor.EndPercent = (float)GreenEndUpDown.Value; greenAxis.Anchor = greenAnchor; nChartControl1.Refresh(); }
private void UpdateAxes() { NPolarChart polarChart = nChartControl1.Charts[0] as NPolarChart; if (polarChart == null) { return; } NAxis valueAxis = polarChart.Axis(StandardAxis.Polar); NAxis degreeAxis = polarChart.Axis(StandardAxis.PolarAngle); NAxis gradAxis = polarChart.Axis(m_CustomAxisId); if (DockDegreeAxisCheckBox.Checked) { degreeAxis.Anchor = new NDockPolarAxisAnchor(); DegreeAxisCrossValueUpDown.Enabled = false; } else { degreeAxis.Anchor = new NCrossPolarAxisAnchor(PolarAxisOrientation.Angle, new NValueAxisCrossing(valueAxis, (double)DegreeAxisCrossValueUpDown.Value)); DegreeAxisCrossValueUpDown.Enabled = true; } if (DockGradAxisCheckBox.Checked) { gradAxis.Anchor = new NDockPolarAxisAnchor(); GradAxisCrossValueUpDown.Enabled = false; } else { gradAxis.Anchor = new NCrossPolarAxisAnchor(PolarAxisOrientation.Angle, new NValueAxisCrossing(valueAxis, (double)GradAxisCrossValueUpDown.Value)); GradAxisCrossValueUpDown.Enabled = true; } nChartControl1.Refresh(); }
private void RadianAngleStepComboBox_SelectedIndexChanged(object sender, EventArgs e) { NPolarChart polarChart = nChartControl1.Charts[0] as NPolarChart; if (polarChart == null) { return; } NAngularScaleConfigurator angleScale = polarChart.Axis(StandardAxis.PolarAngle).ScaleConfigurator as NAngularScaleConfigurator; switch (RadianAngleStepComboBox.SelectedIndex) { case 0: angleScale.MajorTickMode = MajorTickMode.CustomStep; angleScale.CustomStep = new NAngle(15, NAngleUnit.Degree); break; case 1: angleScale.MajorTickMode = MajorTickMode.CustomStep; angleScale.CustomStep = new NAngle(30, NAngleUnit.Degree); break; case 2: angleScale.MajorTickMode = MajorTickMode.CustomStep; angleScale.CustomStep = new NAngle(45, NAngleUnit.Degree); break; case 3: angleScale.MajorTickMode = MajorTickMode.CustomStep; angleScale.CustomStep = new NAngle(90, NAngleUnit.Degree); break; default: Debug.Assert(false); break; } nChartControl1.Refresh(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithValues(BeginAngleDropDownList, 0, 360, 15); DockRedAxisCheckBox.Checked = false; PaintReflectionOfRedAxisCheckBox.Checked = false; DockGreenAxisCheckBox.Checked = true; PaintReflectionOfGreenAxisCheckBox.Checked = true; } // nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Polar Value Axis Position"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; 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.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal); polarChart.DisplayOnLegend = nChartControl1.Legends[0]; polarChart.Location = new NPointL(new NLength(5, NRelativeUnit.ParentPercentage), new NLength(10, NRelativeUnit.ParentPercentage)); polarChart.Size = new NSizeL(new NLength(95, NRelativeUnit.ParentPercentage), new NLength(87, 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); // setup polar angle axis NAngularScaleConfigurator angularScale = (NAngularScaleConfigurator)polarChart.Axis(StandardAxis.PolarAngle).ScaleConfigurator; angularScale.MajorGridStyle.SetShowAtWall(ChartWallType.Polar, true); angularScale.MinTickDistance = new NLength(50); angularScale.LabelStyle.TextStyle.FontStyle.EmSize = new NLength(8); NScaleStripStyle strip = new NScaleStripStyle(); strip.FillStyle = new NColorFillStyle(Color.FromArgb(64, 192, 192, 192)); strip.Interlaced = true; strip.SetShowAtWall(ChartWallType.Polar, true); angularScale.StripStyles.Add(strip); // add a const line NAxisConstLine line = polarChart.Axis(StandardAxis.Polar).ConstLines.Add(); line.Value = 50; line.StrokeStyle.Color = Color.SlateBlue; line.StrokeStyle.Width = new NLength(1, NGraphicsUnit.Pixel); // create a polar line series NPolarLineSeries series1 = new NPolarLineSeries(); polarChart.Series.Add(series1); series1.Name = "Series 1"; series1.CloseContour = true; series1.DataLabelStyle.Visible = false; series1.MarkerStyle.Visible = false; series1.MarkerStyle.Width = new NLength(1, NRelativeUnit.ParentPercentage); series1.MarkerStyle.Height = new NLength(1, NRelativeUnit.ParentPercentage); Curve1(series1, 50); // create a polar line series NPolarLineSeries series2 = new NPolarLineSeries(); polarChart.Series.Add(series2); series2.Name = "Series 2"; series2.CloseContour = true; series2.DataLabelStyle.Visible = false; series2.MarkerStyle.Visible = false; series2.MarkerStyle.Width = new NLength(1, NRelativeUnit.ParentPercentage); series2.MarkerStyle.Height = new NLength(1, NRelativeUnit.ParentPercentage); Curve2(series2, 100); // add a second value axes NPolarAxis primaryAxis = (NPolarAxis)polarChart.Axis(StandardAxis.Polar); NPolarAxis secondaryAxis = ((NPolarAxisCollection)polarChart.Axes).AddCustomAxis(PolarAxisOrientation.Value); m_CustomAxisId = secondaryAxis.AxisId; NCrossPolarAxisAnchor secondaryAnchor = secondaryAxis.Anchor as NCrossPolarAxisAnchor; secondaryAnchor.Crossings.Clear(); secondaryAnchor.Crossings.Add(new NValueAxisCrossing(primaryAxis, 90)); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // color code the axes and series after the stylesheet is applied ApplyColorToAxis(primaryAxis, Color.Red); ApplyColorToAxis(secondaryAxis, Color.Green); series1.BorderStyle.Color = Color.DarkRed; series1.BorderStyle.Width = new NLength(2); series2.BorderStyle.Color = Color.DarkGreen; series2.BorderStyle.Width = new NLength(2); series2.DisplayOnAxis(StandardAxis.Polar, false); series2.DisplayOnAxis(m_CustomAxisId, true); // apply the polar orientation polarChart.BeginAngle = BeginAngleDropDownList.SelectedIndex * 15; // set angle of axis labels NAxis angleAxis = polarChart.Axis(StandardAxis.PolarAngle); NStandardScaleConfigurator scale = (NStandardScaleConfigurator)angleAxis.ScaleConfigurator; scale.LabelStyle.Angle = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0); // configure the red axis NAxis redAxis = polarChart.Axis(StandardAxis.Polar); NPolarAxisAnchor redAnchor; if (DockRedAxisCheckBox.Checked) { redAnchor = new NDockPolarAxisAnchor(PolarAxisDockZone.Bottom); } else { NCrossPolarAxisAnchor crossAnchor = new NCrossPolarAxisAnchor(); crossAnchor.Crossings.Add(new NValueAxisCrossing(angleAxis, 0)); redAnchor = crossAnchor; } redAnchor.PaintReflection = PaintReflectionOfRedAxisCheckBox.Checked; redAxis.Anchor = redAnchor; // configure the green axis NAxis greenAxis = polarChart.Axis(m_CustomAxisId); NPolarAxisAnchor greenAnchor; if (DockGreenAxisCheckBox.Checked) { NDockPolarAxisAnchor dockAnchor = new NDockPolarAxisAnchor(PolarAxisDockZone.Left); greenAnchor = dockAnchor; } else { NCrossPolarAxisAnchor crossAnchor = new NCrossPolarAxisAnchor(); crossAnchor.Crossings.Add(new NValueAxisCrossing(angleAxis, 90)); greenAnchor = crossAnchor; } greenAnchor.PaintReflection = PaintReflectionOfGreenAxisCheckBox.Checked; greenAxis.Anchor = greenAnchor; }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Polar Angle Axis Position"); 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 polar = new NPolarChart(); nChartControl1.Charts.Clear(); nChartControl1.Charts.Add(polar); polar.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal); polar.DisplayOnLegend = nChartControl1.Legends[0]; polar.Depth = 5; polar.Width = 70.0f; polar.Height = 70.0f; // create a polar line series NPolarLineSeries series1 = new NPolarLineSeries(); polar.Series.Add(series1); series1.Name = "Series 1"; series1.CloseContour = true; series1.DataLabelStyle.Visible = false; series1.MarkerStyle.Visible = false; series1.MarkerStyle.Width = new NLength(1, NRelativeUnit.ParentPercentage); series1.MarkerStyle.Height = new NLength(1, NRelativeUnit.ParentPercentage); Curve1(series1, 50); // create a polar line series NPolarLineSeries series2 = new NPolarLineSeries(); polar.Series.Add(series2); series2.Name = "Series 2"; series2.CloseContour = true; series2.DataLabelStyle.Visible = false; series2.MarkerStyle.Visible = false; series2.MarkerStyle.Width = new NLength(1, NRelativeUnit.ParentPercentage); series2.MarkerStyle.Height = new NLength(1, NRelativeUnit.ParentPercentage); Curve2(series2, 100); // setup polar axis NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)polar.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.Beige); strip.Interlaced = true; strip.SetShowAtWall(ChartWallType.Polar, true); linearScale.StripStyles.Add(strip); // setup polar angle axis NAngularScaleConfigurator degreeScale = (NAngularScaleConfigurator)polar.Axis(StandardAxis.PolarAngle).ScaleConfigurator; degreeScale.MajorGridStyle.SetShowAtWall(ChartWallType.Polar, true); degreeScale.LabelStyle.Angle = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0); degreeScale.SetPredefinedScaleStyle(PredefinedScaleStyle.Scientific); // add a second value axes NPolarAxis valueAxis = (NPolarAxis)polar.Axis(StandardAxis.Polar); NPolarAxis primaryAxis = (NPolarAxis)polar.Axis(StandardAxis.PolarAngle); NPolarAxis secondaryAxis = ((NPolarAxisCollection)polar.Axes).AddCustomAxis(PolarAxisOrientation.Angle); NAngularScaleConfigurator gradScale = new NAngularScaleConfigurator(); gradScale.AngleUnit = NAngleUnit.Grad; gradScale.LabelStyle.Angle = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0); gradScale.SetPredefinedScaleStyle(PredefinedScaleStyle.Scientific); secondaryAxis.ScaleConfigurator = gradScale; m_CustomAxisId = secondaryAxis.AxisId; NCrossPolarAxisAnchor secondaryAnchor = new NCrossPolarAxisAnchor(PolarAxisOrientation.Angle); secondaryAnchor.Crossings.Add(new NValueAxisCrossing(valueAxis, 10)); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // color code the axes and series after the stylesheet is applied ApplyColorToAxis(primaryAxis, Color.Red); ApplyColorToAxis(secondaryAxis, Color.Green); series1.BorderStyle.Width = new NLength(2); series2.BorderStyle.Width = new NLength(2); DockDegreeAxisCheckBox.Checked = true; DockGradAxisCheckBox.Checked = false; DegreeAxisCrossValueUpDown.Value = 70; GradAxisCrossValueUpDown.Value = 50; }
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; }
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(); }
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.ViewRangeInflateMode = ScaleViewRangeInflateMode.MajorTick; linearScale.InflateViewRangeBegin = true; linearScale.InflateViewRangeEnd = 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)polarChart.Axis(StandardAxis.PolarAngle).ScaleConfigurator; 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); // create a polar line series NPolarVectorSeries vectorSeries = new NPolarVectorSeries(); polarChart.Series.Add(vectorSeries); vectorSeries.Name = "Series 1"; vectorSeries.DataLabelStyle.Visible = false; vectorSeries.ShadowStyle.Type = ShadowType.LinearBlur; vectorSeries.ShadowStyle.Color = Color.Red; int dataPointIndex = 0; for (int i = 0; i < 360; i += 30) { for (int j = 10; j <= 100; j += 10) { vectorSeries.Angles.Add(i); vectorSeries.Values.Add(j); vectorSeries.X2Values.Add(i + j / 10); vectorSeries.Y2Values.Add(j); vectorSeries.BorderStyles[dataPointIndex] = new NStrokeStyle(1.0f, ColorFromValue(j)); dataPointIndex++; } } // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // apply settings polarChart.BeginAngle = BeginAngleDropDownList.SelectedIndex * 15.0f; }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Polar Area"); 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.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 AngleStepCombo.Items.Add("15"); AngleStepCombo.Items.Add("30"); AngleStepCombo.Items.Add("45"); AngleStepCombo.Items.Add("90"); AngleStepCombo.SelectedIndex = 0; }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Polar Point"); 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.Charts.Clear(); nChartControl1.Charts.Add(chart); chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal); chart.DisplayOnLegend = nChartControl1.Legends[0]; chart.Depth = 5; chart.Width = 70.0f; chart.Height = 70.0f; // 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); // add a const line NAxisConstLine line = chart.Axis(StandardAxis.Polar).ConstLines.Add(); line.Value = 50; line.StrokeStyle.Color = Color.SlateBlue; line.StrokeStyle.Width = new NLength(1, NGraphicsUnit.Pixel); // create three polar point series NSeries s1 = CreatePolarPointSeries("Sample 1", PointShape.Sphere); NSeries s2 = CreatePolarPointSeries("Sample 2", PointShape.Bar); NSeries s3 = CreatePolarPointSeries("Sample 3", PointShape.Pyramid); // add the series to the chart chart.Series.Add(s1); chart.Series.Add(s2); chart.Series.Add(s3); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // init form controls AngleStepCombo.Items.Add("15"); AngleStepCombo.Items.Add("30"); AngleStepCombo.Items.Add("45"); AngleStepCombo.Items.Add("90"); AngleStepCombo.SelectedIndex = 0; }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Polar Value Axis Position"); 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 polar = new NPolarChart(); polar.InnerRadius = new NLength(20); nChartControl1.Charts.Clear(); nChartControl1.Charts.Add(polar); polar.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal); polar.DisplayOnLegend = nChartControl1.Legends[0]; // setup polar axis NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)polar.Axis(StandardAxis.Polar).ScaleConfigurator; linearScale.RoundToTickMax = true; linearScale.RoundToTickMin = true; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); // setup polar angle axis NAngularScaleConfigurator angularScale = (NAngularScaleConfigurator)polar.Axis(StandardAxis.PolarAngle).ScaleConfigurator; angularScale.MajorGridStyle.SetShowAtWall(ChartWallType.Polar, true); angularScale.LabelStyle.Angle = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0); NScaleStripStyle 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); // add a const line NAxisConstLine line = polar.Axis(StandardAxis.Polar).ConstLines.Add(); line.Value = 50; line.StrokeStyle.Color = Color.SlateBlue; line.StrokeStyle.Width = new NLength(1, NGraphicsUnit.Pixel); // create a polar line series NPolarLineSeries series1 = new NPolarLineSeries(); polar.Series.Add(series1); series1.Name = "Series 1"; series1.CloseContour = true; series1.DataLabelStyle.Visible = false; series1.MarkerStyle.Visible = false; series1.MarkerStyle.Width = new NLength(1, NRelativeUnit.ParentPercentage); series1.MarkerStyle.Height = new NLength(1, NRelativeUnit.ParentPercentage); Curve1(series1, 50); // create a polar line series NPolarLineSeries series2 = new NPolarLineSeries(); polar.Series.Add(series2); series2.Name = "Series 2"; series2.CloseContour = true; series2.DataLabelStyle.Visible = false; series2.MarkerStyle.Visible = false; series2.MarkerStyle.Width = new NLength(1, NRelativeUnit.ParentPercentage); series2.MarkerStyle.Height = new NLength(1, NRelativeUnit.ParentPercentage); Curve2(series2, 100); // add a second value axes NPolarAxis primaryAxis = (NPolarAxis)polar.Axis(StandardAxis.Polar); NPolarAxis secondaryAxis = ((NPolarAxisCollection)polar.Axes).AddCustomAxis(PolarAxisOrientation.Value); m_CustomAxisId = secondaryAxis.AxisId; // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // color code the axes and series after the stylesheet is applied ApplyColorToAxis(primaryAxis, Color.Red); ApplyColorToAxis(secondaryAxis, Color.Green); series1.BorderStyle.Color = Color.DarkRed; series1.BorderStyle.Width = new NLength(2); series2.BorderStyle.Color = Color.DarkGreen; series2.BorderStyle.Width = new NLength(2); series2.DisplayOnAxis(StandardAxis.Polar, false); series2.DisplayOnAxis(m_CustomAxisId, true); // init form controls RadianAngleStepComboBox.Items.Add("15"); RadianAngleStepComboBox.Items.Add("30"); RadianAngleStepComboBox.Items.Add("45"); RadianAngleStepComboBox.Items.Add("90"); RadianAngleStepComboBox.SelectedIndex = 0; RedAxisAngleUpDown.Value = (decimal)0; RedBeginUpDown.Value = (decimal)0; RedEndUpDown.Value = (decimal)100; GreenAxisAngleUpDown.Value = (decimal)90; GreenBeginUpDown.Value = (decimal)0; GreenEndUpDown.Value = (decimal)100; }
/// <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 Line"); 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.Depth = 5; chart.Width = 70.0f; chart.Height = 70.0f; // 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); // add a const line NAxisConstLine line = chart.Axis(StandardAxis.Polar).ConstLines.Add(); line.Value = 50; line.StrokeStyle.Color = Color.SlateBlue; line.StrokeStyle.Width = new NLength(1, NGraphicsUnit.Pixel); // create a polar line series NPolarLineSeries series1 = new NPolarLineSeries(); chart.Series.Add(series1); series1.Name = "Series 1"; series1.CloseContour = true; series1.DataLabelStyle.Visible = false; series1.MarkerStyle.Visible = false; series1.MarkerStyle.Width = new NLength(1, NRelativeUnit.ParentPercentage); series1.MarkerStyle.Height = new NLength(1, NRelativeUnit.ParentPercentage); Curve1(series1, 50); // create a polar line series NPolarLineSeries series2 = new NPolarLineSeries(); chart.Series.Add(series2); series2.Name = "Series 2"; series2.CloseContour = true; series2.DataLabelStyle.Visible = false; series2.MarkerStyle.Visible = false; series2.MarkerStyle.Width = new NLength(1, NRelativeUnit.ParentPercentage); series2.MarkerStyle.Height = new NLength(1, NRelativeUnit.ParentPercentage); Curve2(series2, 100); // create a polar line series NPolarLineSeries series3 = new NPolarLineSeries(); chart.Series.Add(series3); series3.Name = "Series 3"; series3.CloseContour = false; series3.DataLabelStyle.Visible = false; series3.MarkerStyle.Visible = false; series3.MarkerStyle.Width = new NLength(1, NRelativeUnit.ParentPercentage); series3.MarkerStyle.Height = new NLength(1, NRelativeUnit.ParentPercentage); Curve3(series3, 100); // 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; }
/// <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; }
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; }
/// <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 Vector"); 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(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; 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); // create a polar line series NPolarVectorSeries vectorSeries = new NPolarVectorSeries(); chart.Series.Add(vectorSeries); vectorSeries.Name = "Series 1"; vectorSeries.DataLabelStyle.Visible = false; vectorSeries.ShadowStyle.Type = ShadowType.LinearBlur; vectorSeries.ShadowStyle.Color = Color.Red; int dataPointIndex = 0; for (int i = 0; i < 360; i += 30) { for (int j = 10; j <= 100; j += 10) { vectorSeries.Angles.Add(i); vectorSeries.Values.Add(j); vectorSeries.X2Values.Add(i + j / 10); vectorSeries.Y2Values.Add(j); vectorSeries.BorderStyles[dataPointIndex] = new NStrokeStyle(1.0f, ColorFromValue(j)); dataPointIndex++; } } // init form controls BeginAngleScrollBar.Value = 0.0f; }
protected void Page_Load(object sender, EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; if (!IsPostBack) { WebExamplesUtilities.FillComboWithValues(BeginAngleDropDownList, 0, 360, 15); DockDegreeAxisCheckBox.Checked = true; DockGradAxisCheckBox.Checked = false; } // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Polar Angle Axis Position"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; 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.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal); polarChart.DisplayOnLegend = nChartControl1.Legends[0]; polarChart.Location = new NPointL(new NLength(5, NRelativeUnit.ParentPercentage), new NLength(10, NRelativeUnit.ParentPercentage)); polarChart.Size = new NSizeL(new NLength(90, NRelativeUnit.ParentPercentage), new NLength(87, NRelativeUnit.ParentPercentage)); // create a polar line series NPolarLineSeries series1 = new NPolarLineSeries(); polarChart.Series.Add(series1); series1.Name = "Series 1"; series1.CloseContour = true; series1.DataLabelStyle.Visible = false; series1.MarkerStyle.Visible = false; series1.MarkerStyle.Width = new NLength(1, NRelativeUnit.ParentPercentage); series1.MarkerStyle.Height = new NLength(1, NRelativeUnit.ParentPercentage); Curve1(series1, 50); // create a polar line series NPolarLineSeries series2 = new NPolarLineSeries(); polarChart.Series.Add(series2); series2.Name = "Series 2"; series2.CloseContour = true; series2.DataLabelStyle.Visible = false; series2.MarkerStyle.Visible = false; series2.MarkerStyle.Width = new NLength(1, NRelativeUnit.ParentPercentage); series2.MarkerStyle.Height = new NLength(1, NRelativeUnit.ParentPercentage); Curve2(series2, 100); // 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); NScaleStripStyle strip = new NScaleStripStyle(); strip.FillStyle = new NColorFillStyle(Color.Beige); strip.Interlaced = true; strip.SetShowAtWall(ChartWallType.Polar, true); linearScale.StripStyles.Add(strip); // setup polar angle axis NAngularScaleConfigurator degreeScale = (NAngularScaleConfigurator)polarChart.Axis(StandardAxis.PolarAngle).ScaleConfigurator; degreeScale.MajorGridStyle.SetShowAtWall(ChartWallType.Polar, true); degreeScale.LabelStyle.Angle = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0); degreeScale.SetPredefinedScaleStyle(PredefinedScaleStyle.Scientific); // add a second value axes NPolarAxis valueAxis = (NPolarAxis)polarChart.Axis(StandardAxis.Polar); NPolarAxis degreeAxis = (NPolarAxis)polarChart.Axis(StandardAxis.PolarAngle); NPolarAxis gradAxis = ((NPolarAxisCollection)polarChart.Axes).AddCustomAxis(PolarAxisOrientation.Angle); NAngularScaleConfigurator gradScale = new NAngularScaleConfigurator(); gradScale.AngleUnit = NAngleUnit.Grad; gradScale.LabelStyle.Angle = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0); gradScale.SetPredefinedScaleStyle(PredefinedScaleStyle.Scientific); gradAxis.ScaleConfigurator = gradScale; m_CustomAxisId = gradAxis.AxisId; NCrossPolarAxisAnchor secondaryAnchor = new NCrossPolarAxisAnchor(PolarAxisOrientation.Angle); secondaryAnchor.Crossings.Add(new NValueAxisCrossing(valueAxis, 10)); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // color code the axes and series after the stylesheet is applied ApplyColorToAxis(degreeAxis, Color.Red); ApplyColorToAxis(gradAxis, Color.Green); series1.BorderStyle.Width = new NLength(2); series2.BorderStyle.Width = new NLength(2); // set the begin angle polarChart.BeginAngle = BeginAngleDropDownList.SelectedIndex * 15; // configure axis docking / crossing if (DockDegreeAxisCheckBox.Checked) { degreeAxis.Anchor = new NDockPolarAxisAnchor(); } else { degreeAxis.Anchor = new NCrossPolarAxisAnchor(PolarAxisOrientation.Angle, new NValueAxisCrossing(valueAxis, 0.0)); } if (DockGradAxisCheckBox.Checked) { gradAxis.Anchor = new NDockPolarAxisAnchor(); } else { gradAxis.Anchor = new NCrossPolarAxisAnchor(PolarAxisOrientation.Angle, new NValueAxisCrossing(valueAxis, 100.0)); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithValues(BeginAngleDropDownList, 0, 360, 15); AngleStepDropDownList.Items.Add("15"); AngleStepDropDownList.Items.Add("30"); AngleStepDropDownList.Items.Add("45"); AngleStepDropDownList.Items.Add("90"); AngleStepDropDownList.SelectedIndex = 0; } // disable frame nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Polar Area"); 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); // setup polar angle axis NAngularScaleConfigurator angularScale = (NAngularScaleConfigurator)polarChart.Axis(StandardAxis.PolarAngle).ScaleConfigurator; angularScale.MajorGridStyle.SetShowAtWall(ChartWallType.Polar, true); NScaleStripStyle strip = new NScaleStripStyle(); strip.FillStyle = new NColorFillStyle(Color.FromArgb(64, 192, 192, 192)); strip.Interlaced = true; strip.SetShowAtWall(ChartWallType.Polar, true); angularScale.StripStyles.Add(strip); // polar area series 1 NPolarAreaSeries series1 = new NPolarAreaSeries(); polarChart.Series.Add(series1); series1.Name = "Theoretical"; series1.DataLabelStyle.Visible = false; GenerateData(series1, 100, 15.0); // polar area series 2 NPolarAreaSeries series2 = new NPolarAreaSeries(); polarChart.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); // apply settings polarChart.BeginAngle = BeginAngleDropDownList.SelectedIndex * 15.0f; NAngularScaleConfigurator angleScale = polarChart.Axis(StandardAxis.PolarAngle).ScaleConfigurator as NAngularScaleConfigurator; angleScale.LabelStyle.Angle = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0); switch (AngleStepDropDownList.SelectedIndex) { case 0: angleScale.MajorTickMode = MajorTickMode.CustomStep; angleScale.CustomStep = new NAngle(15, NAngleUnit.Degree); break; case 1: angleScale.MajorTickMode = MajorTickMode.CustomStep; angleScale.CustomStep = new NAngle(30, NAngleUnit.Degree); break; case 2: angleScale.MajorTickMode = MajorTickMode.CustomStep; angleScale.CustomStep = new NAngle(45, NAngleUnit.Degree); break; case 3: angleScale.MajorTickMode = MajorTickMode.CustomStep; angleScale.CustomStep = new NAngle(90, NAngleUnit.Degree); break; } }
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); }