private void SafeguardSizeNumericUpDown_ValueChanged(object sender, EventArgs e) { if (nChartControl1 == null) { return; } float sizeValue = (float)SafeguardSizeNumericUpDown.Value; NSizeL size = new NSizeL(new NLength(sizeValue, NGraphicsUnit.Point), new NLength(sizeValue, NGraphicsUnit.Point)); NChart chart = nChartControl1.Charts[0]; chart.Series[0].LabelLayout.DataPointSafeguardSize = size; nChartControl1.Refresh(); }
private void UpdateRulerStyleForAxis(NAxis axis) { NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator; // apply style to begin and end caps scale.RulerStyle.BeginCapStyle.Style = (CapStyle)BeginCapComboBox.SelectedIndex; scale.RulerStyle.EndCapStyle.Style = (CapStyle)EndCapComboBox.SelectedIndex; scale.RulerStyle.ScaleBreakCapStyle.Style = (CapStyle)ScaleBreakCapComboBox.SelectedIndex; scale.RulerStyle.PaintOnScaleBreaks = PaintOnScaleBreaks.Checked; // apply cap style sizes NSizeL capSize = new NSizeL((float)WidthNumericUpDown.Value, (float)HeightNumericUpDown.Value); scale.RulerStyle.BeginCapStyle.Size = capSize; scale.RulerStyle.EndCapStyle.Size = capSize; scale.RulerStyle.ScaleBreakCapStyle.Size = capSize; }
private void CellSizeComboBox_SelectedIndexChanged(object sender, System.EventArgs e) { NLength segmentWidth = new NLength(0); NLength segmentGap = new NLength(0); NSizeL cellSize = new NSizeL(new NLength(0), new NLength(0)); switch (CellSizeComboBox.SelectedIndex) { case 0: // small segmentWidth = new NLength(2, NGraphicsUnit.Point); segmentGap = new NLength(1, NGraphicsUnit.Point); cellSize = new NSizeL(new NLength(15, NGraphicsUnit.Point), new NLength(30, NGraphicsUnit.Point)); break; case 1: // normal segmentWidth = new NLength(3, NGraphicsUnit.Point); segmentGap = new NLength(1, NGraphicsUnit.Point); cellSize = new NSizeL(new NLength(20, NGraphicsUnit.Point), new NLength(40, NGraphicsUnit.Point)); break; case 2: // large segmentWidth = new NLength(4, NGraphicsUnit.Point); segmentGap = new NLength(2, NGraphicsUnit.Point); cellSize = new NSizeL(new NLength(25, NGraphicsUnit.Point), new NLength(50, NGraphicsUnit.Point)); break; } m_NumericDisplay1.CellSize = cellSize; m_NumericDisplay2.CellSize = cellSize; m_NumericDisplay3.CellSize = cellSize; m_NumericDisplay1.DecimalCellSize = cellSize; m_NumericDisplay2.DecimalCellSize = cellSize; m_NumericDisplay3.DecimalCellSize = cellSize; m_NumericDisplay1.SegmentGap = segmentGap; m_NumericDisplay2.SegmentGap = segmentGap; m_NumericDisplay3.SegmentGap = segmentGap; m_NumericDisplay1.SegmentWidth = segmentWidth; m_NumericDisplay2.SegmentWidth = segmentWidth; m_NumericDisplay3.SegmentWidth = segmentWidth; nChartControl1.Refresh(); }
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; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("XYZ Point Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); // configure the chart NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.SoftCameraLight); chart.Depth = 55.0f; chart.Width = 55.0f; chart.Height = 55.0f; // set automatic walls foreach (NChartWall wall in chart.Walls) { wall.VisibilityMode = WallVisibilityMode.Auto; } // set auto axis anchors chart.Axis(StandardAxis.PrimaryX).Anchor = new NBestVisibilityAxisAnchor(AxisOrientation.Horizontal); chart.Axis(StandardAxis.PrimaryY).Anchor = new NBestVisibilityAxisAnchor(AxisOrientation.Vertical); chart.Axis(StandardAxis.Depth).Anchor = new NBestVisibilityAxisAnchor(AxisOrientation.Depth); // configure X axis NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator(); scaleX.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; scaleX.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back, ChartWallType.Floor, ChartWallType.Top, ChartWallType.Front }; chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; // configure Y axis NLinearScaleConfigurator scaleY = new NLinearScaleConfigurator(); scaleY.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; scaleY.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back, ChartWallType.Left, ChartWallType.Right, ChartWallType.Front }; chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = scaleY; // add interlaced stripe for Y axis NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back, ChartWallType.Left, ChartWallType.Front, ChartWallType.Right }; scaleY.StripStyles.Add(stripStyle); // configure Z axis NLinearScaleConfigurator scaleZ = new NLinearScaleConfigurator(); scaleZ.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; scaleZ.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Top, ChartWallType.Left, ChartWallType.Right }; chart.Axis(StandardAxis.Depth).ScaleConfigurator = scaleZ; // point series 1 NPointSeries series1 = (NPointSeries)chart.Series.Add(SeriesType.Point); series1.Name = "Point 1"; series1.PointShape = PointShape.Bar; series1.Size = new NLength(2.4f, NRelativeUnit.ParentPercentage); series1.UseXValues = true; series1.UseZValues = true; 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.TextStyle.BackplaneStyle.StandardFrameStyle.InnerBorderColor = DarkOrange; series1.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(8); // point series 2 NPointSeries series2 = (NPointSeries)chart.Series.Add(SeriesType.Point); series2.Name = "Point 2"; series2.PointShape = PointShape.Bar; series2.Size = new NLength(2.4f, NRelativeUnit.ParentPercentage); series2.UseXValues = true; series2.UseZValues = true; series2.InflateMargins = true; series2.FillStyle = new NColorFillStyle(Green); series2.DataLabelStyle.Visible = true; series2.DataLabelStyle.VertAlign = VertAlign.Center; series2.DataLabelStyle.ArrowLength = new NLength(12); series2.DataLabelStyle.TextStyle.BackplaneStyle.StandardFrameStyle.InnerBorderColor = Green; series2.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(8); // fill with random data GenerateData(chart); // label layout settings chart.LabelLayout.EnableInitialPositioning = EnableInitialPositioningCheckBox.Checked; chart.LabelLayout.RemoveOverlappedLabels = RemoveOverlappedLabelsCheckBox.Checked; chart.LabelLayout.EnableLabelAdjustment = EnableLabelAdjustmentCheckBox.Checked; // enable / disable data point safeguard size for both series series1.LabelLayout.EnableDataPointSafeguard = EnableDataPointSafeguardCheckBox.Checked; series2.LabelLayout.EnableDataPointSafeguard = EnableDataPointSafeguardCheckBox.Checked; // set data point safeguard size for both series float sizeValue = (float)SafeguardSizeDropDownList.SelectedIndex; NSizeL size = new NSizeL(new NLength(sizeValue, NGraphicsUnit.Point), new NLength(sizeValue, NGraphicsUnit.Point)); series1.LabelLayout.DataPointSafeguardSize = size; series2.LabelLayout.DataPointSafeguardSize = size; // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); }
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; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("XY Point Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); // configure the chart NChart chart = nChartControl1.Charts[0]; // configure X axis NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator(); scaleX.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; scaleX.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; // configure Y axis NLinearScaleConfigurator scaleY = new NLinearScaleConfigurator(); scaleY.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; scaleY.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = scaleY; // add interlaced stripe for Y axis NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleY.StripStyles.Add(stripStyle); // point series 1 NPointSeries series1 = (NPointSeries)chart.Series.Add(SeriesType.Point); series1.Name = "Point 1"; series1.PointShape = PointShape.Ellipse; series1.Size = new NLength(1.7f, NRelativeUnit.ParentPercentage); series1.UseXValues = true; series1.InflateMargins = true; series1.FillStyle = new NColorFillStyle(DarkOrange); series1.DataLabelStyle.Visible = true; series1.DataLabelStyle.VertAlign = VertAlign.Center; series1.DataLabelStyle.ArrowLength = new NLength(10); series1.DataLabelStyle.ArrowStrokeStyle.Color = DarkOrange; series1.DataLabelStyle.TextStyle.BackplaneStyle.StandardFrameStyle.InnerBorderColor = DarkOrange; series1.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(8); // point series 2 NPointSeries series2 = (NPointSeries)chart.Series.Add(SeriesType.Point); series2.Name = "Point 2"; series2.PointShape = PointShape.Ellipse; series2.Size = new NLength(1.7f, NRelativeUnit.ParentPercentage); series2.UseXValues = true; series2.InflateMargins = true; series2.FillStyle = new NColorFillStyle(Green); series2.DataLabelStyle.Visible = true; series2.DataLabelStyle.VertAlign = VertAlign.Center; series2.DataLabelStyle.ArrowLength = new NLength(10); series2.DataLabelStyle.ArrowStrokeStyle.Color = Green; series2.DataLabelStyle.TextStyle.BackplaneStyle.StandardFrameStyle.InnerBorderColor = Green; series2.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(8); // label layout settings chart.LabelLayout.EnableInitialPositioning = EnableInitialPositioningCheckBox.Checked; chart.LabelLayout.RemoveOverlappedLabels = RemoveOverlappedLabelsCheckBox.Checked; chart.LabelLayout.EnableLabelAdjustment = EnableLabelAdjustmentCheckBox.Checked; series1.LabelLayout.OutOfBoundsLocationMode = OutOfBoundsLocationMode.PushWithinBounds; series1.LabelLayout.InvertLocationsIfIgnored = true; series2.LabelLayout.OutOfBoundsLocationMode = OutOfBoundsLocationMode.PushWithinBounds; series2.LabelLayout.InvertLocationsIfIgnored = true; // enable / disable data point safeguard size for both series series1.LabelLayout.EnableDataPointSafeguard = EnableDataPointSafeguardCheckBox.Checked; series2.LabelLayout.EnableDataPointSafeguard = EnableDataPointSafeguardCheckBox.Checked; // set data point safeguard size for both series float sizeValue = (float)SafeguardSizeDropDownList.SelectedIndex; NSizeL size = new NSizeL(new NLength(sizeValue, NGraphicsUnit.Point), new NLength(sizeValue, NGraphicsUnit.Point)); series1.LabelLayout.DataPointSafeguardSize = size; series2.LabelLayout.DataPointSafeguardSize = size; // fill with random data GenerateData(chart); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { EnableInitialPositioningCheckBox.Checked = true; EnableLabelAdjustmentCheckBox.Checked = true; HiddenField1.Value = Random.Next().ToString(); } nChartControl1.Settings.JitterMode = JitterMode.Enabled; nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Cluster Stack Bar Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); // configure the chart NChart chart = nChartControl1.Charts[0]; // configure Y axis NLinearScaleConfigurator scaleY = new NLinearScaleConfigurator(); scaleY.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; scaleY.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = scaleY; // add interlaced stripe for Y axis NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleY.StripStyles.Add(stripStyle); NSizeL dataPointSafeguardSize = new NSizeL( new NLength(1.3f, NRelativeUnit.ParentPercentage), new NLength(1.3f, NRelativeUnit.ParentPercentage)); // series 1 NBarSeries series1 = (NBarSeries)chart.Series.Add(SeriesType.Bar); series1.Name = "Bar 1"; series1.FillStyle = new NColorFillStyle(DarkOrange); series1.DataLabelStyle.Visible = true; series1.DataLabelStyle.VertAlign = VertAlign.Center; series1.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(8); // series 2 NBarSeries series2 = (NBarSeries)chart.Series.Add(SeriesType.Bar); series2.Name = "Bar 2"; series2.MultiBarMode = MultiBarMode.Stacked; series2.FillStyle = new NColorFillStyle(Green); series2.DataLabelStyle.Visible = true; series2.DataLabelStyle.VertAlign = VertAlign.Center; series2.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(8); // series 3 NBarSeries series3 = (NBarSeries)chart.Series.Add(SeriesType.Bar); series3.Name = "Bar 3"; series3.MultiBarMode = MultiBarMode.Clustered; series3.FillStyle = new NColorFillStyle(Red); series3.DataLabelStyle.Visible = true; series3.DataLabelStyle.VertAlign = VertAlign.Top; series3.DataLabelStyle.ArrowLength = new NLength(10); series3.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(8); // generate random data GenerateData(chart); // enable initial labels positioning chart.LabelLayout.EnableInitialPositioning = EnableInitialPositioningCheckBox.Checked; // enable label adjustment chart.LabelLayout.EnableLabelAdjustment = EnableLabelAdjustmentCheckBox.Checked; // series 1 data points must not be overlapped series1.LabelLayout.EnableDataPointSafeguard = true; series1.LabelLayout.DataPointSafeguardSize = dataPointSafeguardSize; // do not use label location proposals for series 1 series1.LabelLayout.UseLabelLocations = false; // series 2 data points must not be overlapped series2.LabelLayout.EnableDataPointSafeguard = true; series2.LabelLayout.DataPointSafeguardSize = dataPointSafeguardSize; // do not use label location proposals for series 2 series2.LabelLayout.UseLabelLocations = false; // series 3 data points must not be overlapped series3.LabelLayout.EnableDataPointSafeguard = true; series3.LabelLayout.DataPointSafeguardSize = dataPointSafeguardSize; // series 3 data labels can be placed above and below the origin point series3.LabelLayout.UseLabelLocations = true; series3.LabelLayout.LabelLocations = new LabelLocation[] { LabelLocation.Top, LabelLocation.Bottom }; series3.LabelLayout.InvertLocationsIfIgnored = false; series3.LabelLayout.OutOfBoundsLocationMode = OutOfBoundsLocationMode.PushWithinBounds; // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { EnableInitialPositioningCheckBox.Checked = true; EnableLabelAdjustmentCheckBox.Checked = true; HiddenField1.Value = Random.Next().ToString(); } nChartControl1.Settings.JitterMode = JitterMode.Enabled; nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Stack Line Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); // configure the chart NChart chart = nChartControl1.Charts[0]; // configure X axis NOrdinalScaleConfigurator scaleX = new NOrdinalScaleConfigurator(); scaleX.DisplayDataPointsBetweenTicks = false; chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; // configure Y axis NLinearScaleConfigurator scaleY = new NLinearScaleConfigurator(); scaleY.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; scaleY.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = scaleY; // add interlaced stripe for Y axis NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleY.StripStyles.Add(stripStyle); // line series 1 NLineSeries series1 = (NLineSeries)chart.Series.Add(SeriesType.Line); series1.Name = "Line 1"; series1.InflateMargins = true; series1.MarkerStyle.Visible = true; series1.MarkerStyle.FillStyle = new NColorFillStyle(DarkOrange); series1.MarkerStyle.PointShape = PointShape.Ellipse; series1.MarkerStyle.Width = new NLength(1.0f, NRelativeUnit.ParentPercentage); series1.MarkerStyle.Height = new NLength(1.0f, NRelativeUnit.ParentPercentage); series1.DataLabelStyle.Visible = true; series1.DataLabelStyle.VertAlign = VertAlign.Top; series1.DataLabelStyle.ArrowLength = new NLength(10); series1.DataLabelStyle.ArrowStrokeStyle.Color = DarkOrange; series1.DataLabelStyle.TextStyle.BackplaneStyle.StandardFrameStyle.InnerBorderColor = DarkOrange; series1.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(8); // line series 2 NLineSeries series2 = (NLineSeries)chart.Series.Add(SeriesType.Line); series2.Name = "Line 2"; series2.InflateMargins = true; series2.MultiLineMode = MultiLineMode.Stacked; series2.MarkerStyle.Visible = true; series2.MarkerStyle.FillStyle = new NColorFillStyle(Green); series2.MarkerStyle.PointShape = PointShape.Pyramid; series2.MarkerStyle.Width = new NLength(1.0f, NRelativeUnit.ParentPercentage); series2.MarkerStyle.Height = new NLength(1.0f, NRelativeUnit.ParentPercentage); series2.DataLabelStyle.Visible = true; series2.DataLabelStyle.VertAlign = VertAlign.Top; series2.DataLabelStyle.ArrowLength = new NLength(10); series2.DataLabelStyle.ArrowStrokeStyle.Color = Green; series2.DataLabelStyle.TextStyle.BackplaneStyle.StandardFrameStyle.InnerBorderColor = Green; series2.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(8); // label layout settings chart.LabelLayout.EnableInitialPositioning = EnableInitialPositioningCheckBox.Checked; chart.LabelLayout.EnableLabelAdjustment = EnableLabelAdjustmentCheckBox.Checked; NSizeL safeguardSize = new NSizeL( new NLength(1.6f, NRelativeUnit.ParentPercentage), new NLength(1.6f, NRelativeUnit.ParentPercentage)); series1.LabelLayout.UseLabelLocations = true; series1.LabelLayout.OutOfBoundsLocationMode = OutOfBoundsLocationMode.PushWithinBounds; series1.LabelLayout.InvertLocationsIfIgnored = true; series1.LabelLayout.EnableDataPointSafeguard = true; series1.LabelLayout.DataPointSafeguardSize = safeguardSize; series2.LabelLayout.UseLabelLocations = true; series2.LabelLayout.OutOfBoundsLocationMode = OutOfBoundsLocationMode.PushWithinBounds; series2.LabelLayout.InvertLocationsIfIgnored = true; series2.LabelLayout.EnableDataPointSafeguard = true; series2.LabelLayout.DataPointSafeguardSize = safeguardSize; // fill with random data GenerateData(chart); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); }
public override void Initialize() { base.Initialize(); nChartControl1.Controller.Tools.Add(new NPanelSelectorTool()); nChartControl1.Controller.Tools.Add(new NTrackballTool()); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Cluster Stack Bar Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); // configure the chart NChart chart = nChartControl1.Charts[0]; // configure Y axis NLinearScaleConfigurator scaleY = new NLinearScaleConfigurator(); scaleY.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; scaleY.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = scaleY; // add interlaced stripe for Y axis NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleY.StripStyles.Add(stripStyle); NSizeL dataPointSafeguardSize = new NSizeL( new NLength(1.3f, NRelativeUnit.ParentPercentage), new NLength(1.3f, NRelativeUnit.ParentPercentage)); // series 1 NBarSeries series1 = (NBarSeries)chart.Series.Add(SeriesType.Bar); series1.Name = "Bar 1"; series1.FillStyle = new NColorFillStyle(DarkOrange); series1.DataLabelStyle.Visible = true; series1.DataLabelStyle.VertAlign = VertAlign.Center; // series 2 NBarSeries series2 = (NBarSeries)chart.Series.Add(SeriesType.Bar); series2.Name = "Bar 2"; series2.MultiBarMode = MultiBarMode.Stacked; series2.FillStyle = new NColorFillStyle(LightOrange); series2.DataLabelStyle.Visible = true; series2.DataLabelStyle.VertAlign = VertAlign.Center; // series 3 NBarSeries series3 = (NBarSeries)chart.Series.Add(SeriesType.Bar); series3.Name = "Bar 3"; series3.MultiBarMode = MultiBarMode.Clustered; series3.FillStyle = new NColorFillStyle(LightGreen); series3.DataLabelStyle.Visible = true; series3.DataLabelStyle.VertAlign = VertAlign.Top; series3.DataLabelStyle.ArrowLength = new NLength(10); // generate random data GenerateData(chart); // enable initial labels positioning chart.LabelLayout.EnableInitialPositioning = true; // enable label adjustment chart.LabelLayout.EnableLabelAdjustment = true; // series 1 data points must not be overlapped series1.LabelLayout.EnableDataPointSafeguard = true; series1.LabelLayout.DataPointSafeguardSize = dataPointSafeguardSize; // do not use label location proposals for series 1 series1.LabelLayout.UseLabelLocations = false; // series 2 data points must not be overlapped series2.LabelLayout.EnableDataPointSafeguard = true; series2.LabelLayout.DataPointSafeguardSize = dataPointSafeguardSize; // do not use label location proposals for series 2 series2.LabelLayout.UseLabelLocations = false; // series 3 data points must not be overlapped series3.LabelLayout.EnableDataPointSafeguard = true; series3.LabelLayout.DataPointSafeguardSize = dataPointSafeguardSize; // series 3 data labels can be placed above and below the origin point series3.LabelLayout.UseLabelLocations = true; series3.LabelLayout.LabelLocations = new LabelLocation[] { LabelLocation.Top, LabelLocation.Bottom }; series3.LabelLayout.InvertLocationsIfIgnored = false; series3.LabelLayout.OutOfBoundsLocationMode = OutOfBoundsLocationMode.PushWithinBounds; // apply layout ConfigureStandardLayout(chart, title, nChartControl1.Legends[0]); // init form controls EnableInitialPositioningCheck.Checked = true; EnableLabelAdjustmentCheck.Checked = true; }
public override void Initialize() { base.Initialize(); nChartControl1.Controller.Tools.Add(new NPanelSelectorTool()); nChartControl1.Controller.Tools.Add(new NTrackballTool()); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Stack Line Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); // configure the chart NChart chart = nChartControl1.Charts[0]; // configure Y axis NLinearScaleConfigurator scaleY = new NLinearScaleConfigurator(); scaleY.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; scaleY.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = scaleY; // add interlaced stripe for Y axis NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleY.StripStyles.Add(stripStyle); // line series 1 NLineSeries series1 = (NLineSeries)chart.Series.Add(SeriesType.Line); series1.Name = "Line 1"; series1.InflateMargins = true; series1.MarkerStyle.Visible = true; series1.MarkerStyle.FillStyle = new NColorFillStyle(DarkOrange); series1.MarkerStyle.PointShape = PointShape.Ellipse; series1.MarkerStyle.Width = new NLength(1.0f, NRelativeUnit.ParentPercentage); series1.MarkerStyle.Height = new NLength(1.0f, NRelativeUnit.ParentPercentage); series1.DataLabelStyle.Visible = true; series1.DataLabelStyle.VertAlign = VertAlign.Top; series1.DataLabelStyle.ArrowLength = new NLength(10); series1.DataLabelStyle.ArrowStrokeStyle.Color = DarkOrange; series1.DataLabelStyle.TextStyle.BackplaneStyle.StandardFrameStyle.InnerBorderColor = DarkOrange; // line series 2 NLineSeries series2 = (NLineSeries)chart.Series.Add(SeriesType.Line); series2.Name = "Line 2"; series2.InflateMargins = true; series2.MultiLineMode = MultiLineMode.Stacked; series2.MarkerStyle.Visible = true; series2.MarkerStyle.FillStyle = new NColorFillStyle(LightOrange); series2.MarkerStyle.PointShape = PointShape.Pyramid; series2.MarkerStyle.Width = new NLength(1.0f, NRelativeUnit.ParentPercentage); series2.MarkerStyle.Height = new NLength(1.0f, NRelativeUnit.ParentPercentage); series2.DataLabelStyle.Visible = true; series2.DataLabelStyle.VertAlign = VertAlign.Top; series2.DataLabelStyle.ArrowLength = new NLength(10); series2.DataLabelStyle.ArrowStrokeStyle.Color = LightOrange; series2.DataLabelStyle.TextStyle.BackplaneStyle.StandardFrameStyle.InnerBorderColor = LightOrange; // label layout settings chart.LabelLayout.EnableInitialPositioning = true; chart.LabelLayout.EnableLabelAdjustment = true; NSizeL safeguardSize = 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; series1.LabelLayout.EnableDataPointSafeguard = true; series1.LabelLayout.DataPointSafeguardSize = safeguardSize; series2.LabelLayout.UseLabelLocations = true; series2.LabelLayout.OutOfBoundsLocationMode = OutOfBoundsLocationMode.PushWithinBounds; series2.LabelLayout.InvertLocationsIfIgnored = true; series2.LabelLayout.EnableDataPointSafeguard = true; series2.LabelLayout.DataPointSafeguardSize = safeguardSize; // fill with random data GenerateData(chart); // apply layout ConfigureStandardLayout(chart, title, nChartControl1.Legends[0]); // init form controls EnableInitialPositioningCheck.Checked = true; EnableLabelAdjustmentCheck.Checked = true; }
public override void Initialize() { base.Initialize(); nChartControl1.Panels.Clear(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Radar Area Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); // configure the chart NRadarChart chart = new NRadarChart(); nChartControl1.Charts.Add(chart); AddRadarAxis(chart, "Category A"); AddRadarAxis(chart, "Category B"); AddRadarAxis(chart, "Category C"); AddRadarAxis(chart, "Category D"); AddRadarAxis(chart, "Category E"); AddRadarAxis(chart, "Category F"); AddRadarAxis(chart, "Category G"); // radar area series 1 NRadarAreaSeries series1 = (NRadarAreaSeries)chart.Series.Add(SeriesType.RadarArea); series1.FillStyle = new NColorFillStyle(DarkOrange); series1.BorderStyle.Color = DarkOrange; series1.DataLabelStyle.Visible = true; series1.DataLabelStyle.VertAlign = VertAlign.Top; series1.DataLabelStyle.ArrowStrokeStyle.Color = DarkOrange; series1.DataLabelStyle.TextStyle.BackplaneStyle.StandardFrameStyle.InnerBorderColor = DarkOrange; // radar area series 2 NRadarAreaSeries series2 = (NRadarAreaSeries)chart.Series.Add(SeriesType.RadarArea); series2.FillStyle = new NColorFillStyle(LightOrange); series2.BorderStyle.Color = LightOrange; series2.DataLabelStyle.Visible = true; series2.DataLabelStyle.VertAlign = VertAlign.Top; series2.DataLabelStyle.ArrowStrokeStyle.Color = LightOrange; series2.DataLabelStyle.TextStyle.BackplaneStyle.StandardFrameStyle.InnerBorderColor = LightOrange; // label layout settings chart.LabelLayout.EnableInitialPositioning = true; chart.LabelLayout.EnableLabelAdjustment = true; NSizeL safeguardSize = new NSizeL( new NLength(1.3f, NRelativeUnit.ParentPercentage), new NLength(1.3f, NRelativeUnit.ParentPercentage)); series1.LabelLayout.EnableDataPointSafeguard = true; series1.LabelLayout.UseLabelLocations = true; series1.LabelLayout.OutOfBoundsLocationMode = OutOfBoundsLocationMode.PushWithinBounds; series1.LabelLayout.InvertLocationsIfIgnored = false; series1.LabelLayout.DataPointSafeguardSize = safeguardSize; series2.LabelLayout.EnableDataPointSafeguard = true; series2.LabelLayout.UseLabelLocations = true; series2.LabelLayout.OutOfBoundsLocationMode = OutOfBoundsLocationMode.PushWithinBounds; series2.LabelLayout.InvertLocationsIfIgnored = false; series2.LabelLayout.DataPointSafeguardSize = safeguardSize; // fill with random data GenerateData(series1, series2); // apply layout ConfigureStandardLayout(chart, title, null); // init form controls EnableInitialPositioningCheck.Checked = true; EnableLabelAdjustmentCheck.Checked = true; StackRadarAreasCheck.Checked = false; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { EnableInitialPositioningCheckBox.Checked = true; EnableLabelAdjustmentCheckBox.Checked = true; StackRadarAreasCheckBox.Checked = false; 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("Radar Area 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 NRadarChart chart = new NRadarChart(); 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); AddRadarAxis(chart, "Category A"); AddRadarAxis(chart, "Category B"); AddRadarAxis(chart, "Category C"); AddRadarAxis(chart, "Category D"); AddRadarAxis(chart, "Category E"); AddRadarAxis(chart, "Category F"); AddRadarAxis(chart, "Category G"); // radar area series 1 NRadarAreaSeries series1 = (NRadarAreaSeries)chart.Series.Add(SeriesType.RadarArea); series1.FillStyle = new NColorFillStyle(DarkOrange); series1.BorderStyle.Color = DarkOrange; series1.DataLabelStyle.Visible = true; series1.DataLabelStyle.VertAlign = VertAlign.Top; series1.DataLabelStyle.ArrowStrokeStyle.Color = DarkOrange; series1.DataLabelStyle.TextStyle.BackplaneStyle.StandardFrameStyle.InnerBorderColor = DarkOrange; series1.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(8); // radar area series 2 NRadarAreaSeries series2 = (NRadarAreaSeries)chart.Series.Add(SeriesType.RadarArea); series2.FillStyle = new NColorFillStyle(Red); series2.BorderStyle.Color = Red; series2.BorderStyle.Width = new NLength(0); series2.DataLabelStyle.Visible = true; series2.DataLabelStyle.VertAlign = VertAlign.Top; series2.DataLabelStyle.ArrowStrokeStyle.Color = Red; series2.DataLabelStyle.TextStyle.BackplaneStyle.StandardFrameStyle.InnerBorderColor = Red; series2.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(8); // stack / unstack the second radar area series if (StackRadarAreasCheckBox.Checked) { series2.MultiAreaMode = MultiAreaMode.Stacked; } else { series2.MultiAreaMode = MultiAreaMode.Series; } // label layout settings chart.LabelLayout.EnableInitialPositioning = EnableInitialPositioningCheckBox.Checked; chart.LabelLayout.EnableLabelAdjustment = EnableLabelAdjustmentCheckBox.Checked; NSizeL safeguardSize = new NSizeL( new NLength(1.3f, NRelativeUnit.ParentPercentage), new NLength(1.3f, NRelativeUnit.ParentPercentage)); series1.LabelLayout.EnableDataPointSafeguard = true; series1.LabelLayout.UseLabelLocations = true; series1.LabelLayout.OutOfBoundsLocationMode = OutOfBoundsLocationMode.PushWithinBounds; series1.LabelLayout.InvertLocationsIfIgnored = false; series1.LabelLayout.DataPointSafeguardSize = safeguardSize; series2.LabelLayout.EnableDataPointSafeguard = true; series2.LabelLayout.UseLabelLocations = true; series2.LabelLayout.OutOfBoundsLocationMode = OutOfBoundsLocationMode.PushWithinBounds; series2.LabelLayout.InvertLocationsIfIgnored = false; series2.LabelLayout.DataPointSafeguardSize = safeguardSize; // fill with random data GenerateData(series1, series2); }