public override void Initialize() { base.Initialize(); // set a chart title NLabel title = new NLabel("DateTime Step Line"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); // no legend nChartControl1.Legends.Clear(); // configure the chart NChart chart = nChartControl1.Charts[0]; chart.Width = 90; chart.BoundsMode = BoundsMode.Stretch; NLinearScaleConfigurator linearScale = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator; // add interlace stripe NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); linearScale.StripStyles.Add(stripStyle); // switch the X axis in date time scale mode NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator(); chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = dateTimeScale; dateTimeScale.LabelGenerationMode = LabelGenerationMode.Stagger2; dateTimeScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); // setup step line series NStepLineSeries line = (NStepLineSeries)chart.Series.Add(SeriesType.StepLine); line.Name = "Step Line Series"; line.InflateMargins = true; line.UseXValues = true; line.UseZValues = false; line.DataLabelStyle.Visible = false; line.ShadowStyle.Type = ShadowType.Solid; line.ShadowStyle.Color = Color.FromArgb(15, 0, 0, 0); line.MarkerStyle.PointShape = PointShape.Cylinder; line.MarkerStyle.Width = new NLength(1.2f, NRelativeUnit.ParentPercentage); line.MarkerStyle.Height = new NLength(1.2f, NRelativeUnit.ParentPercentage); GenerateYValues(nValuesCount); GenerateXValues(nValuesCount); // apply layout ConfigureStandardLayout(chart, title, null); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); }
/// <summary> /// Adds a step line series to the chart /// </summary> /// <param name="chart"></param> /// <param name="name"></param> /// <param name="vector"></param> /// <param name="xstart"></param> /// <param name="xincrement"></param> void AddStepLineSeries(NChart chart, string name, DoubleVector vector, double xstart, double xincrement) { NStepLineSeries stepline = new NStepLineSeries(); chart.Series.Add(stepline); // Name the line stepline.Name = name; // Tell the series to regard the X values stepline.UseXValues = true; // No data labels stepline.DataLabelStyle.Visible = false; // Set the line color stepline.BorderStyle = new NStrokeStyle(1.0f, Color.Gray, LinePattern.Dash); // Fill X values for (int i = 0; i < vector.Length; i++) { stepline.XValues.Add(xstart + xincrement * i); } // Fill Y values stepline.Values.AddRange(vector.DataBlock.Data); }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = new NLabel("Step Line Intersections"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); // no legend nChartControl1.Legends.Clear(); // configure the chart NChart chart = nChartControl1.Charts[0]; NLinearScaleConfigurator linearScale = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator; // add interlace stripe NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); linearScale.StripStyles.Add(stripStyle); m_Line = (NStepLineSeries)chart.Series.Add(SeriesType.StepLine); m_Line.Name = "Series 1"; m_Line.DepthPercent = 50; m_Line.LineSize = 2; m_Line.DataLabelStyle.Visible = false; m_Line.MarkerStyle.Visible = false; m_Line.Values.FillRandom(Random, 12); m_Point = (NPointSeries)chart.Series.Add(SeriesType.Point); m_Point.UseXValues = true; m_Point.DataLabelStyle.Visible = false; m_Point.Size = new NLength(6); m_XCursor = new NAxisCursor(); m_XCursor.BeginEndAxis = (int)StandardAxis.PrimaryY; m_YCursor = new NAxisCursor(); m_YCursor.BeginEndAxis = (int)StandardAxis.PrimaryX; chart.Axis(StandardAxis.PrimaryX).Cursors.Add(m_XCursor); chart.Axis(StandardAxis.PrimaryY).Cursors.Add(m_YCursor); // apply layout ConfigureStandardLayout(chart, title, null); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); LineSegmentRouteCombo.FillFromEnum(typeof(LineSegmentRoute)); LineSegmentRouteCombo.SelectedIndex = 1; nChartControl1.MouseMove += new MouseEventHandler(OnChartControl1MouseMove); }
/// <summary> /// Called to initialize the example /// </summary> /// <param name="chartControl"></param> public override void Create() { // set a chart title NLabel title = new NLabel("3D Step Line Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); // no legend nChartControl1.Legends.Clear(); // configure the chart m_Chart = nChartControl1.Charts[0]; m_Chart.Enable3D = true; m_Chart.Width = 65; m_Chart.Height = 40; m_Chart.Axis(StandardAxis.Depth).Visible = false; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1); m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); NLinearScaleConfigurator linearScale = m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator; // add interlace stripe NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); linearScale.StripStyles.Add(stripStyle); m_Line = (NStepLineSeries)m_Chart.Series.Add(SeriesType.StepLine); m_Line.Name = "Series 1"; m_Line.DepthPercent = 50; m_Line.LineSize = 2; m_Line.DataLabelStyle.Visible = false; m_Line.DataLabelStyle.Format = "<value>"; m_Line.MarkerStyle.Visible = true; m_Line.Values.FillRandom(Random, 8); // apply layout ConfigureStandardLayout(m_Chart, title, null); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // configure interactivity nChartControl1.Controller.Tools.Add(new NPanelSelectorTool()); nChartControl1.Controller.Tools.Add(new NTrackballTool()); NExampleHelpers.FillComboWithEnumValues(LineStyleComboBox, typeof(LineSegmentShape)); LineStyleComboBox.SelectedIndex = 1; LeftAxisRoundToTickCheckBox.IsChecked = true; InflateMarginsCheckBox.IsChecked = true; LineDepthScrollBar.Value = m_Line.DepthPercent / 100.0f; LineSizeScrollBar.Value = m_Line.LineSize / 10.0f; }
private void ShowMarkersCheck_CheckedChanged(object sender, System.EventArgs e) { NChart chart = nChartControl1.Charts[0]; NStepLineSeries line = (NStepLineSeries)chart.Series[0]; line.MarkerStyle.Visible = ShowMarkersCheck.Checked; nChartControl1.Refresh(); }
private void GenerateXYData(NStepLineSeries line) { int numberOfTurns = NumberOfTurnsDropDownList.SelectedIndex + 3; int numberOfPointsInTurn = (NumberOfPointsInTurnDropDownList.SelectedIndex + 1) * 10000; for (int i = 0; i < numberOfTurns; i++) { AddTurn(line, numberOfPointsInTurn); } }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = new NLabel("2D Step Line Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); // no legend nChartControl1.Legends.Clear(); // configure the chart m_Chart = nChartControl1.Charts[0]; m_Chart.Axis(StandardAxis.Depth).Visible = false; NLinearScaleConfigurator linearScale = m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator; // add interlace stripe NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); linearScale.StripStyles.Add(stripStyle); m_StepLine = (NStepLineSeries)m_Chart.Series.Add(SeriesType.StepLine); m_StepLine.Name = "Series 1"; m_StepLine.BorderStyle.Color = Color.SlateBlue; m_StepLine.BorderStyle.Width = new NLength(2); m_StepLine.DataLabelStyle.VertAlign = VertAlign.Center; m_StepLine.DataLabelStyle.Format = "<value>"; m_StepLine.DataLabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.White); m_StepLine.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(1.4f, NRelativeUnit.RootPercentage); m_StepLine.DataLabelStyle.TextStyle.BackplaneStyle.Visible = false; m_StepLine.MarkerStyle.Visible = true; m_StepLine.MarkerStyle.PointShape = PointShape.Cylinder; m_StepLine.MarkerStyle.BorderStyle.Color = Color.SlateBlue; m_StepLine.ShadowStyle.Type = ShadowType.GaussianBlur; m_StepLine.ShadowStyle.Offset = new NPointL(3, 3); m_StepLine.ShadowStyle.FadeLength = new NLength(5); m_StepLine.ShadowStyle.Color = Color.FromArgb(55, 0, 0, 0); m_StepLine.Values.FillRandom(Random, 8); // apply layout ConfigureStandardLayout(m_Chart, title, null); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); RoundToTickCheck.Checked = true; InflateMarginsCheck.Checked = true; }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = new NLabel("3D Step Line Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); // no legend nChartControl1.Legends.Clear(); // configure the chart NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.Width = 65; chart.Height = 40; chart.Axis(StandardAxis.Depth).Visible = false; chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); NLinearScaleConfigurator linearScale = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator; // add interlace stripe NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); linearScale.StripStyles.Add(stripStyle); m_Line = (NStepLineSeries)chart.Series.Add(SeriesType.StepLine); m_Line.Name = "Series 1"; m_Line.DepthPercent = 50; m_Line.LineSize = 2; m_Line.DataLabelStyle.Visible = false; m_Line.DataLabelStyle.Format = "<value>"; m_Line.MarkerStyle.Visible = true; m_Line.Values.FillRandom(Random, 8); // apply layout ConfigureStandardLayout(chart, title, null); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); LineStyleCombo.FillFromEnum(typeof(LineSegmentShape)); LineStyleCombo.SelectedIndex = 1; RoundToTickCheck.Checked = true; InflateMarginsCheck.Checked = true; }
private void EditMarkerButton_Click(object sender, EventArgs e) { NStepLineSeries series = (NStepLineSeries)nChartControl1.Charts[0].Series[0]; NMarkerStyle markerStyleResult; if (NMarkerStyleTypeEditor.Edit(series.MarkerStyle, out markerStyleResult)) { series.MarkerStyle = markerStyleResult; nChartControl1.Refresh(); } }
private void GenerateYValues(int nCount) { NChart chart = nChartControl1.Charts[0]; NStepLineSeries line = (NStepLineSeries)chart.Series[0]; line.Values.Clear(); for (int i = 0; i < nCount; i++) { line.Values.Add(Random.NextDouble() * 20); } }
private void GenerateXValues(int nCount) { NChart chart = nChartControl1.Charts[0]; NStepLineSeries line = (NStepLineSeries)chart.Series[0]; line.XValues.Clear(); DateTime dt = new DateTime(2005, 5, 24, 11, 0, 0); for (int i = 0; i < nCount; i++) { dt = dt.AddHours(12 + Random.NextDouble() * 60); line.XValues.Add(dt); } }
private void AddTurn(NStepLineSeries line, int count) { Random rand = new Random(); double prevYVal = 2; double prevXVal = 2; double angle = 0; double phase = (Math.PI * 2 * rand.NextDouble()) / count + 0.0001; double magnitude = rand.NextDouble() * 5; double[] xValues = new double[count]; double[] yValues = new double[count]; int valueCount = line.Values.Count; if (valueCount > 0) { prevYVal = (double)line.Values[valueCount - 1]; prevXVal = (double)line.XValues[valueCount - 1]; } for (int i = 0; i < count; i++) { double yStep = Math.Sin(angle) * magnitude; double xStep = rand.NextDouble() * magnitude; if (xStep < 0) { xStep = 0; } angle += phase; prevXVal += xStep; yValues[i] = prevYVal + yStep; xValues[i] = prevXVal; } line.Values.AddRange(yValues); line.XValues.AddRange(xValues); }
protected void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithEnumValues(LineStyleDropDownList, typeof(LineSegmentShape)); LineStyleDropDownList.SelectedIndex = 0; RoundToTickCheck.Checked = true; InflateMarginsCheck.Checked = true; } nChartControl1.Settings.JitterMode = JitterMode.Enabled; nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("3D Step Line Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // no legend nChartControl1.Legends.Clear(); // setup chart NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1); // setup the X axis NOrdinalScaleConfigurator scaleX = (NOrdinalScaleConfigurator)chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator; scaleX.MajorTickMode = MajorTickMode.AutoMaxCount; // setup the Y axis NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; scaleY.RoundToTickMin = RoundToTickCheck.Checked; scaleY.RoundToTickMax = RoundToTickCheck.Checked; // add interlaced stripe 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 }; scaleY.StripStyles.Add(stripStyle); // hide the Z axis chart.Axis(StandardAxis.Depth).Visible = false; // setup step line series NStepLineSeries stepLine = (NStepLineSeries)chart.Series.Add(SeriesType.StepLine); stepLine.Name = "Series 1"; stepLine.DepthPercent = 50; stepLine.LineSize = 2; stepLine.Legend.Mode = SeriesLegendMode.None; stepLine.FillStyle = new NColorFillStyle(Color.OliveDrab); stepLine.DataLabelStyle.Visible = false; stepLine.DataLabelStyle.Format = "<value>"; stepLine.MarkerStyle.Visible = true; stepLine.InflateMargins = InflateMarginsCheck.Checked; Random random = new Random(); stepLine.Values.FillRandom(random, 8); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); switch (LineStyleDropDownList.SelectedIndex) { case 0: // simple line stepLine.LineSegmentShape = LineSegmentShape.Line; SetupTapeMarkers(stepLine.MarkerStyle); break; case 1: // tape stepLine.LineSegmentShape = LineSegmentShape.Tape; SetupTapeMarkers(stepLine.MarkerStyle); break; case 2: // tube stepLine.LineSegmentShape = LineSegmentShape.Tube; SetupTubeMarkers(stepLine.MarkerStyle); break; case 3: // elipsoid stepLine.LineSegmentShape = LineSegmentShape.Ellipsoid; SetupTubeMarkers(stepLine.MarkerStyle); break; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { EnableInitialPositioningCheckBox.Checked = true; EnableLabelAdjustmentCheckBox.Checked = true; InvertForDownwardDPCheckBox.Checked = true; InvertIfOutOfBoundsCheckBox.Checked = true; LocationProposalsDropDownList.Items.Clear(); LocationProposalsDropDownList.Items.Add("Top"); LocationProposalsDropDownList.Items.Add("Top - Bottom"); LocationProposalsDropDownList.Items.Add("Top - Bottom - Left - Right"); LocationProposalsDropDownList.SelectedIndex = 1; HiddenField1.Value = Random.Next().ToString(); } nChartControl1.Settings.JitterMode = JitterMode.Enabled; nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Step 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); // step line series NStepLineSeries series1 = (NStepLineSeries)chart.Series.Add(SeriesType.StepLine); series1.InflateMargins = true; series1.BorderStyle = new NStrokeStyle(new NLength(1.2f, NGraphicsUnit.Point), GreyBlue); series1.DataLabelStyle.Visible = true; series1.DataLabelStyle.VertAlign = VertAlign.Top; 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); // label layout settings chart.LabelLayout.EnableInitialPositioning = EnableInitialPositioningCheckBox.Checked; chart.LabelLayout.EnableLabelAdjustment = EnableLabelAdjustmentCheckBox.Checked; series1.LabelLayout.UseLabelLocations = true; series1.LabelLayout.OutOfBoundsLocationMode = OutOfBoundsLocationMode.PushWithinBounds; series1.LabelLayout.InvertLocationsForInvertedDataPoints = InvertForDownwardDPCheckBox.Checked; series1.LabelLayout.InvertLocationsIfIgnored = InvertIfOutOfBoundsCheckBox.Checked; switch (LocationProposalsDropDownList.SelectedIndex) { case 0: series1.LabelLayout.LabelLocations = new LabelLocation[] { LabelLocation.Top }; break; case 1: series1.LabelLayout.LabelLocations = new LabelLocation[] { LabelLocation.Top, LabelLocation.Bottom }; break; case 2: series1.LabelLayout.LabelLocations = new LabelLocation[] { LabelLocation.Top, LabelLocation.Bottom, LabelLocation.Left, LabelLocation.Right }; break; } series1.LabelLayout.EnableDataPointSafeguard = true; series1.LabelLayout.DataPointSafeguardSize = new NSizeL( new NLength(1.3f, NRelativeUnit.ParentPercentage), new NLength(1.3f, NRelativeUnit.ParentPercentage)); // fill with random data GenerateData(series1); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); }
protected void Page_Load(object sender, System.EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("DateTime Step Line"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // no legend nChartControl1.Legends.Clear(); // setup chart NChart chart = nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; NLinearScaleConfigurator linearScaleConfigurator = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; linearScaleConfigurator.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; // add interlaced stripe NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); linearScaleConfigurator.StripStyles.Add(stripStyle); NDateTimeScaleConfigurator timeScaleConfigurator = new NDateTimeScaleConfigurator(); chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = timeScaleConfigurator; timeScaleConfigurator.LabelGenerationMode = LabelGenerationMode.Stagger2; timeScaleConfigurator.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; timeScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); // setup step line series NStepLineSeries line = (NStepLineSeries)chart.Series.Add(SeriesType.StepLine); line.Name = "Step Line Series"; line.InflateMargins = true; line.UseXValues = true; line.UseZValues = false; line.Legend.Mode = SeriesLegendMode.None; line.DataLabelStyle.Visible = false; line.BorderStyle.Width = new NLength(2, NGraphicsUnit.Pixel); line.BorderStyle.Color = Color.YellowGreen; line.FillStyle = new NGradientFillStyle(GradientStyle.Vertical, GradientVariant.Variant2, Color.Green, Color.BlanchedAlmond); line.ShadowStyle.Type = ShadowType.Solid; line.ShadowStyle.Color = Color.FromArgb(15, 0, 0, 0); line.MarkerStyle.PointShape = PointShape.Cylinder; line.MarkerStyle.Width = new NLength(1.2f, NRelativeUnit.ParentPercentage); line.MarkerStyle.Height = new NLength(1.2f, NRelativeUnit.ParentPercentage); line.MarkerStyle.BorderStyle.Width = new NLength(2, NGraphicsUnit.Pixel); line.MarkerStyle.BorderStyle.Color = Color.YellowGreen; // generate some random data Random random = new Random(); int valuesCount = 10; GenreateYValues(valuesCount, random); GenreateXValues(valuesCount, random); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // 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("Step 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); // step line series NStepLineSeries series1 = (NStepLineSeries)chart.Series.Add(SeriesType.StepLine); series1.InflateMargins = true; series1.BorderStyle = new NStrokeStyle(new NLength(1.2f, NGraphicsUnit.Point), GreyBlue); series1.DataLabelStyle.Visible = true; series1.DataLabelStyle.VertAlign = VertAlign.Top; series1.DataLabelStyle.ArrowLength = new NLength(12); series1.DataLabelStyle.ArrowStrokeStyle.Color = DarkOrange; series1.DataLabelStyle.TextStyle.BackplaneStyle.StandardFrameStyle.InnerBorderColor = DarkOrange; // label layout settings chart.LabelLayout.EnableInitialPositioning = true; chart.LabelLayout.EnableLabelAdjustment = true; series1.LabelLayout.UseLabelLocations = true; series1.LabelLayout.OutOfBoundsLocationMode = OutOfBoundsLocationMode.PushWithinBounds; series1.LabelLayout.EnableDataPointSafeguard = true; series1.LabelLayout.DataPointSafeguardSize = new NSizeL( new NLength(1.3f, NRelativeUnit.ParentPercentage), new NLength(1.3f, NRelativeUnit.ParentPercentage)); // fill with random data GenerateData(series1); // apply layout ConfigureStandardLayout(chart, title, null); // init form controls EnableInitialPositioningCheck.Checked = true; EnableLabelAdjustmentCheck.Checked = true; LocationsCombo.SelectedIndex = 1; InvertForDownwardDPCheck.Checked = true; InvertIfOutOfBoundsCheck.Checked = true; }
protected void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { // Init Form controls WebExamplesUtilities.FillComboWithValues(SampleDistanceDropDownList, 2, 10, 1); SampleDistanceDropDownList.SelectedIndex = 0; UseXValuesCheckBox.Checked = true; WebExamplesUtilities.FillComboWithValues(NumberOfTurnsDropDownList, 3, 20, 1); NumberOfTurnsDropDownList.SelectedIndex = 2; WebExamplesUtilities.FillComboWithValues(NumberOfPointsInTurnDropDownList, 10000, 30000, 10000); NumberOfPointsInTurnDropDownList.SelectedIndex = 1; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("2D Sampled Line Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // setup chart NChart chart = nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; // setup Y axis NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; scaleY.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; // setup X axis NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator(); scaleX.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back, ChartWallType.Floor }; scaleX.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; // add interlace stripe NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); scaleX.StripStyles.Add(stripStyle); chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; // add the line NStepLineSeries stepLine = (NStepLineSeries)chart.Series.Add(SeriesType.StepLine); stepLine.LineSegmentShape = LineSegmentShape.Line; stepLine.DataLabelStyle.Visible = false; stepLine.MarkerStyle.Visible = false; stepLine.Legend.Mode = SeriesLegendMode.None; // instruct the series to use X values stepLine.UseXValues = UseXValuesCheckBox.Checked; // update sampling parameters stepLine.SamplingMode = SeriesSamplingMode.Enabled; stepLine.SampleDistance = new NLength((float)SampleDistanceDropDownList.SelectedIndex + 2, NGraphicsUnit.Pixel); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); GenerateXYData(stepLine); NumberOfDataPointsLabel.Text = "Number of Data Points:" + (stepLine.Values.Count / 1000).ToString() + "K"; // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); }
protected void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { RoundToTickCheck.Checked = true; InflateMarginsCheck.Checked = true; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("2D Step Line Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // no legend nChartControl1.Legends.Clear(); // setup chart NChart chart = nChartControl1.Charts[0]; chart.Axis(StandardAxis.Depth).Visible = false; chart.BoundsMode = BoundsMode.Stretch; // setup axes NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; scaleY.RoundToTickMin = RoundToTickCheck.Checked; scaleY.RoundToTickMax = RoundToTickCheck.Checked; // add interlaced stripe 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); // add a step line series NStepLineSeries stepLine = (NStepLineSeries)chart.Series.Add(SeriesType.StepLine); stepLine.Name = "Series 1"; stepLine.Legend.Mode = SeriesLegendMode.None; stepLine.DataLabelStyle.VertAlign = VertAlign.Center; stepLine.DataLabelStyle.Visible = false; stepLine.MarkerStyle.Visible = true; stepLine.MarkerStyle.PointShape = PointShape.Cylinder; stepLine.MarkerStyle.Width = new NLength(1.2f, NRelativeUnit.ParentPercentage); stepLine.MarkerStyle.Height = new NLength(1.2f, NRelativeUnit.ParentPercentage); stepLine.ShadowStyle.Type = ShadowType.GaussianBlur; stepLine.ShadowStyle.Offset = new NPointL(3, 3); stepLine.ShadowStyle.FadeLength = new NLength(5); stepLine.ShadowStyle.Color = Color.FromArgb(55, 0, 0, 0); stepLine.InflateMargins = InflateMarginsCheck.Checked; // fill some random data Random random = new Random(); stepLine.Values.FillRandom(random, 8); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("2D Sampled Step Line Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); // no legend nChartControl1.Legends.Clear(); // configure the chart m_Chart = nChartControl1.Charts[0]; // add interlaced stripe to the Y axis NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; ((NStandardScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator).StripStyles.Add(stripStyle); // add a line series m_Line = (NStepLineSeries)m_Chart.Series.Add(SeriesType.StepLine); m_Line.Name = "Line Series"; m_Line.InflateMargins = true; m_Line.DataLabelStyle.Visible = false; m_Line.MarkerStyle.Visible = false; m_Line.SamplingMode = SeriesSamplingMode.Enabled; m_Line.FilterType = SeriesFilterType.Distance; m_Line.MarkerStyle.PointShape = PointShape.Cylinder; m_Line.MarkerStyle.Width = new NLength(1.5f, NRelativeUnit.ParentPercentage); m_Line.MarkerStyle.Height = new NLength(1.5f, NRelativeUnit.ParentPercentage); m_Line.UseXValues = true; SampleDistanceScroll.Value = (int)m_Line.SampleDistance.Value; // apply layout ConfigureStandardLayout(m_Chart, title, null); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); GeneratorModeCombo.Items.Add("Generator 1 (Continous Y)"); GeneratorModeCombo.Items.Add("Generator 2 (Random Y)"); GeneratorModeCombo.SelectedIndex = 0; LineSegmentRouteComboBox.FillFromEnum(typeof(LineSegmentRoute)); LineSegmentRouteComboBox.SelectedIndex = (int)LineSegmentRoute.AlwaysHV; UseXValuesCheckBox.Checked = true; SampleDistanceScroll.Value = 10; NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0]; chart.RangeSelections.Add(new NRangeSelection()); chart.Axis(StandardAxis.PrimaryX).ScrollBar.Visible = true; chart.Axis(StandardAxis.PrimaryY).ScrollBar.Visible = true; nChartControl1.Controller.Selection.Add(chart); nChartControl1.Controller.Tools.Add(new NAxisScrollTool()); nChartControl1.Controller.Tools.Add(new NDataZoomTool()); Add40KDataButton_Click(null, null); }