private void OnChartMouseDown(object sender, MouseEventArgs e) { if (MouseModeComboBox.SelectedIndex != 0) { return; } NPointF ptViewPoint = new NPointF((float)e.X, (float)e.Y); NVector3DD vecScalePoint = new NVector3DD(); NViewToScale3DTransformation viewToScale; NAxis xAxis = m_Chart.Axis(StandardAxis.PrimaryX); NAxis yAxis = m_Chart.Axis(StandardAxis.PrimaryY); NAxis zAxis = m_Chart.Axis(StandardAxis.Depth); if (CreatePointAtPlaneComboBox.SelectedIndex == 0) { viewToScale = new NViewToScale3DTransformation(m_Chart, (int)StandardAxis.PrimaryX, (int)StandardAxis.Depth, (int)StandardAxis.PrimaryY, (double)XZPlaneValueNumericUpDown.Value); if (viewToScale.Transform(ptViewPoint, ref vecScalePoint)) { if (ClampValuesToRulerCheckBox.Checked) { vecScalePoint.X = xAxis.Scale.ViewRange.GetValueInRange(vecScalePoint.X); vecScalePoint.Z = yAxis.Scale.ViewRange.GetValueInRange(vecScalePoint.Z); vecScalePoint.Y = zAxis.Scale.ViewRange.GetValueInRange(vecScalePoint.Y); } m_Point.AddDataPoint(new NDataPoint(vecScalePoint.X, vecScalePoint.Z, vecScalePoint.Y, "Point" + m_Point.Values.Count.ToString())); nChartControl1.Refresh(); } } else { viewToScale = new NViewToScale3DTransformation(m_Chart, (int)StandardAxis.PrimaryX, (int)StandardAxis.PrimaryY, (int)StandardAxis.Depth, (double)XYPlaneValueNumericUpDown.Value); if (viewToScale.Transform(ptViewPoint, ref vecScalePoint)) { if (ClampValuesToRulerCheckBox.Checked) { vecScalePoint.X = xAxis.Scale.ViewRange.GetValueInRange(vecScalePoint.X); vecScalePoint.Y = yAxis.Scale.ViewRange.GetValueInRange(vecScalePoint.Y); vecScalePoint.Z = zAxis.Scale.ViewRange.GetValueInRange(vecScalePoint.Z); } m_Point.AddDataPoint(new NDataPoint(vecScalePoint.X, vecScalePoint.Y, vecScalePoint.Z, "Point" + m_Point.Values.Count.ToString())); nChartControl1.Refresh(); } } }
/// <summary> /// Called to initialize the example /// </summary> /// <param name="chartControl"></param> public override void Create() { // set a chart title NLabel title = nChartControl1.Labels.AddHeader("2D Point Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); // setup chart m_Chart = nChartControl1.Charts[0]; m_Chart.Axis(StandardAxis.Depth).Visible = false; // add interlace stripe NLinearScaleConfigurator linearScale = m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator; 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); // setup point series m_Point = (NPointSeries)m_Chart.Series.Add(SeriesType.Point); m_Point.Name = "Point Series"; m_Point.InflateMargins = true; m_Point.AddDataPoint(new NDataPoint(23, "Item1")); m_Point.AddDataPoint(new NDataPoint(67, "Item2")); m_Point.AddDataPoint(new NDataPoint(78, "Item3")); m_Point.AddDataPoint(new NDataPoint(12, "Item4")); m_Point.AddDataPoint(new NDataPoint(56, "Item5")); m_Point.AddDataPoint(new NDataPoint(43, "Item6")); m_Point.AddDataPoint(new NDataPoint(37, "Item7")); m_Point.AddDataPoint(new NDataPoint(51, "Item8")); // apply layout ConfigureStandardLayout(m_Chart, title, nChartControl1.Legends[0]); // init form controls NExampleHelpers.FillComboWithEnumValues(PointShapeComboBox, typeof(PointShape)); PointShapeComboBox.SelectedIndex = 0; InflateMarginsCheckBox.IsChecked = true; LeftAxisRoundToTickCheckBox.IsChecked = true; DifferentColorsCheckBox.IsChecked = true; PointSizeScrollBar.Value = m_Point.Size.Value / 20.0f; DifferentColorsCheckBox_Checked(null, null); }
protected void Page_Load(object sender, EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Point 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.Enable3D = Enable3DCheckBox.Checked; chart.BoundsMode = BoundsMode.Stretch; // add interlace stripe NLinearScaleConfigurator yScale = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; 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); yScale.StripStyles.Add(stripStyle); // hide the depth axis chart.Axis(StandardAxis.Depth).Visible = false; // setup point series NPointSeries point = (NPointSeries)chart.Series.Add(SeriesType.Point); point.Name = "Point Series"; point.DataLabelStyle.Visible = false; point.InflateMargins = true; point.AddDataPoint(new NDataPoint(23, "A")); point.AddDataPoint(new NDataPoint(67, "B")); point.AddDataPoint(new NDataPoint(47, "C")); point.AddDataPoint(new NDataPoint(12, "D")); point.AddDataPoint(new NDataPoint(56, "E")); point.AddDataPoint(new NDataPoint(78, "F")); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); point.ShowVerticalDropLines = ShowVerticalDropLinesCheckBox.Checked; point.ShowHorizontalDropLines = ShowHorizontalDropLinesCheckBox.Checked; }
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("XYZ Scatter Point Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); // configure the chart m_Chart = nChartControl1.Charts[0]; m_Chart.Enable3D = true; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); m_Chart.Depth = 55.0f; m_Chart.Width = 55.0f; m_Chart.Height = 55.0f; // Configure all axes to use linear scale NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator(); m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true); linearScale = new NLinearScaleConfigurator(); m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true); // 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); linearScale = new NLinearScaleConfigurator(); m_Chart.Axis(StandardAxis.Depth).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true); linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true); // setup point series m_Point = (NPointSeries)m_Chart.Series.Add(SeriesType.Point); m_Point.Name = "Point Series"; m_Point.DataLabelStyle.Visible = false; m_Point.Legend.Mode = SeriesLegendMode.DataPoints; m_Point.Legend.Format = "<label>"; m_Point.PointShape = PointShape.Sphere; m_Point.BorderStyle.Width = new NLength(0); m_Point.UseXValues = true; m_Point.UseZValues = true; // add xyz values m_Point.AddDataPoint(new NDataPoint(10, 15, 34, "Item1")); m_Point.AddDataPoint(new NDataPoint(23, 25, -20, "Item2")); m_Point.AddDataPoint(new NDataPoint(12, 45, 45, "Item3")); m_Point.AddDataPoint(new NDataPoint(24, 35, -12, "Item4")); m_Point.AddDataPoint(new NDataPoint(16, 41, 3, "Item5")); m_Point.AddDataPoint(new NDataPoint(17, 15, -34, "Item6")); m_Point.AddDataPoint(new NDataPoint(13, -25, -20, "Item7")); m_Point.AddDataPoint(new NDataPoint(12, 45, 1, "Item8")); m_Point.AddDataPoint(new NDataPoint(4, -21, -12, "Item9")); m_Point.AddDataPoint(new NDataPoint(16, -24, 47, "Item10")); // apply layout ConfigureStandardLayout(m_Chart, title, nChartControl1.Legends[0]); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); // init form controls AxesRoundToTick.Checked = true; InflateMarginsCheck.Checked = true; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // init form controls FormatDropDownList.Items.Add("[value] [label]"); FormatDropDownList.Items.Add("[index] [cumulative]"); FormatDropDownList.Items.Add("[percent] [total]"); FormatDropDownList.SelectedIndex = 0; ModeDropDownList.Items.Add("Disabled"); ModeDropDownList.Items.Add("Series"); ModeDropDownList.Items.Add("DataPoints"); ModeDropDownList.Items.Add("SeriesCustom"); ModeDropDownList.SelectedIndex = 2; WebExamplesUtilities.FillComboWithEnumValues(PointShapeDropDownList, typeof(PointShape)); PointShapeDropDownList.SelectedIndex = 0; WebExamplesUtilities.FillComboWithColorNames(ColorDropDownList, KnownColor.DarkOrange); DifferentColorsCheckBox.Checked = true; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = new NLabel("Series Legend"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; nChartControl1.Panels.Add(title); // setup chart NChart chart = nChartControl1.Charts[0]; chart.Axis(StandardAxis.Depth).Visible = false; // add interlaced stripe NLinearScaleConfigurator linearScaleConfigurator = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; 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); NPointSeries point = (NPointSeries)chart.Series.Add(SeriesType.Point); point.DataLabelStyle.Visible = false; point.InflateMargins = true; point.PointShape = (PointShape)PointShapeDropDownList.SelectedIndex; point.Legend.Mode = (SeriesLegendMode)ModeDropDownList.SelectedIndex; point.AddDataPoint(new NDataPoint(16, "Agriculture")); point.AddDataPoint(new NDataPoint(42, "Construction")); point.AddDataPoint(new NDataPoint(56, "Manufacturing")); point.AddDataPoint(new NDataPoint(23, "Services")); point.AddDataPoint(new NDataPoint(47, "Healthcare")); point.AddDataPoint(new NDataPoint(38, "Finance")); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]); if (DifferentColorsCheckBox.Checked) { NChartPalette palette = new NChartPalette(); palette.SetPredefinedPalette(ChartPredefinedPalette.Nevron); for (int i = 0; i < point.Values.Count; i++) { point.FillStyles[i] = new NColorFillStyle(palette.SeriesColors[i % palette.SeriesColors.Count]); } ColorDropDownList.Enabled = false; } else { point.FillStyle = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(ColorDropDownList)); ColorDropDownList.Enabled = true; } if (ModeDropDownList.SelectedIndex == 2) { FormatDropDownList.Enabled = true; point.Legend.Format = WebExamplesUtilities.GetXmlFormatString(FormatDropDownList.SelectedItem.Text); } else { FormatDropDownList.Enabled = false; } }
public override void Initialize() { base.Initialize(); nChartControl1.Panels.Clear(); // set a chart title NLabel header = new NLabel("Data Pan Tool<br/><font size = '12pt'>Demonstrates how to configure scrollbars with sliders and to enable data panning</font>"); header.DockMode = PanelDockMode.Top; header.Margins = new NMarginsL(10, 10, 10, 10); header.TextStyle.TextFormat = TextFormat.XML; header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); header.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); nChartControl1.Panels.Add(header); // configure the chart NCartesianChart chart = new NCartesianChart(); chart.DockMode = PanelDockMode.Fill; chart.Margins = new NMarginsL(10, 0, 10, 10); chart.Axis(StandardAxis.Depth).Visible = false; chart.BoundsMode = BoundsMode.Stretch; nChartControl1.Panels.Add(chart); // add some dummy data NPointSeries pointSeries = (NPointSeries)chart.Series.Add(SeriesType.Point); pointSeries.UseXValues = true; pointSeries.Name = "Point Series"; pointSeries.BorderStyle.Width = new NLength(1, NGraphicsUnit.Pixel);; pointSeries.BorderStyle.Color = Color.DarkRed; pointSeries.DataLabelStyle.Visible = false; pointSeries.Size = new NLength(5, NGraphicsUnit.Point); NDataPoint dp = new NDataPoint(); // add xy values for (int i = 0; i < 200; i++) { dp[DataPointValue.X] = Random.Next(100); dp[DataPointValue.Y] = Random.Next(100); dp[DataPointValue.Label] = "Item" + i.ToString(); pointSeries.AddDataPoint(dp); } // configure chart axes // set the primary X axis in FixedPageSize mode double pageSize = 10; NAxis primaryX = chart.Axis(StandardAxis.PrimaryX); NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator(); linearScale.RoundToTickMax = false; linearScale.RoundToTickMin = false; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; // add an interlaced strip to the Y axis NScaleStripStyle xInterlacedStrip = new NScaleStripStyle(); xInterlacedStrip.SetShowAtWall(ChartWallType.Back, true); xInterlacedStrip.FillStyle = new NColorFillStyle(Color.FromArgb(40, Color.LightGray)); linearScale.StripStyles.Add(xInterlacedStrip); primaryX.ScaleConfigurator = linearScale; NNumericAxisPagingView xPagingView = new NNumericAxisPagingView(new NRange1DD(0, pageSize)); xPagingView.MinPageLength = 1.0; primaryX.PagingView = xPagingView; primaryX.ScrollBar.Visible = true; primaryX.ScrollBar.ViewRangeChanged += new EventHandler(OnXViewRangeChanged); // set the primary Y axis in FixedPageSize mode NAxis primaryY = chart.Axis(StandardAxis.PrimaryY); linearScale = new NLinearScaleConfigurator(); linearScale.RoundToTickMax = false; linearScale.RoundToTickMin = false; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; // add an interlaced strip to the Y axis NScaleStripStyle yInterlacedStrip = new NScaleStripStyle(); yInterlacedStrip.SetShowAtWall(ChartWallType.Back, true); yInterlacedStrip.FillStyle = new NColorFillStyle(Color.FromArgb(40, Color.LightGray)); linearScale.StripStyles.Add(yInterlacedStrip); primaryY.ScaleConfigurator = linearScale; NNumericAxisPagingView yPagingView = new NNumericAxisPagingView(new NRange1DD(0, pageSize)); yPagingView.MinPageLength = 1.0; primaryY.PagingView = yPagingView; primaryY.ScrollBar.Visible = true; primaryY.ScrollBar.ViewRangeChanged += new EventHandler(OnYViewRangeChanged); // disable the reset button chart.Axis(StandardAxis.PrimaryX).ScrollBar.ResetButton.Visible = false; chart.Axis(StandardAxis.PrimaryY).ScrollBar.ResetButton.Visible = false; m_DataPanTool = new NDataPanTool(); nChartControl1.Controller.Tools.Add(new NPanelSelectorTool()); nChartControl1.Controller.Tools.Add(m_DataPanTool); nChartControl1.Controller.Tools.Add(new NAxisScrollTool()); m_DataPanTool.Cancel += new EventHandler(OnCancel); // init form controls XAxisPageSizeNumericUpDown.Value = (decimal)10; YAxisPageSizeNumericUpDown.Value = (decimal)10; ShowScrollbarSlidersCheckBox.Checked = true; RepaintChartWhileDraggingCheckBox.Checked = m_DataPanTool.RepaintChartWhileDragging; }
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("Converting from scale to viewport coordinates"); 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)); // create the watermark that we're about to position in the AfterPaint event of the chart NWatermark watermark = new NWatermark(); Bitmap bitmap = GetWatermarkBitmap(); watermark.FillStyle = new NImageFillStyle(bitmap); watermark.StandardFrameStyle.InnerBorderWidth = new NLength(0, NGraphicsUnit.Pixel); watermark.ContentAlignment = ContentAlignment.MiddleCenter; nChartControl1.Panels.Add(watermark); // configure a free xyz point chart m_Chart = nChartControl1.Charts[0]; m_Chart.Enable3D = true; m_Chart.BoundsMode = BoundsMode.Fit; m_Chart.Location = new NPointL(new NLength(8, NRelativeUnit.ParentPercentage), new NLength(8, NRelativeUnit.ParentPercentage)); m_Chart.Size = new NSizeL(new NLength(84, NRelativeUnit.ParentPercentage), new NLength(84, NRelativeUnit.ParentPercentage)); m_Chart.Depth = 55.0f; m_Chart.Width = 55.0f; m_Chart.Height = 55.0f; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator(); m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true); linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale = new NLinearScaleConfigurator(); m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true); linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale = new NLinearScaleConfigurator(); m_Chart.Axis(StandardAxis.Depth).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true); linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true); linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; nChartControl1.Controller.Selection.Add(m_Chart); m_Point = (NPointSeries)m_Chart.Series.Add(SeriesType.Point); m_Point.Name = "Point Series"; m_Point.DataLabelStyle.Visible = false; m_Point.Legend.Mode = SeriesLegendMode.DataPoints; m_Point.Legend.Format = "<label>"; m_Point.PointShape = PointShape.Sphere; m_Point.FillStyle = new NColorFillStyle(Color.Red); m_Point.UseXValues = true; m_Point.UseZValues = true; // add xyz values m_Point.AddDataPoint(new NDataPoint(10, 15, 34, "Item1")); m_Point.AddDataPoint(new NDataPoint(23, 25, -20, "Item2")); m_Point.AddDataPoint(new NDataPoint(12, 45, 45, "Item3")); m_Point.AddDataPoint(new NDataPoint(24, 35, -12, "Item4")); m_Point.AddDataPoint(new NDataPoint(16, 41, 3, "Item5")); m_Point.AddDataPoint(new NDataPoint(17, 15, -34, "Item6")); m_Point.AddDataPoint(new NDataPoint(13, -25, -20, "Item7")); m_Point.AddDataPoint(new NDataPoint(12, 45, 1, "Item8")); m_Point.AddDataPoint(new NDataPoint(4, -21, -12, "Item9")); m_Point.AddDataPoint(new NDataPoint(16, -24, 47, "Item10")); m_Chart.PaintCallback = new CustomPaintCallback(this); // init form controls DataPointNumericUpDown.Minimum = 0; DataPointNumericUpDown.Maximum = m_Point.Values.Count - 1; DataPointNumericUpDown.Value = 0; WatermarkPositionComboBox.Items.Add("Position in scale Units"); WatermarkPositionComboBox.Items.Add("Position from Data Point"); WatermarkPositionComboBox.SelectedIndex = 1; m_bUpdateWatermark = true; nChartControl1.Refresh(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithEnumValues(PointShapeDropDownList, typeof(PointShape)); PointShapeDropDownList.SelectedIndex = 0; DataLabelFormatDropDownList.Items.Add("Value and Label"); DataLabelFormatDropDownList.Items.Add("Value"); DataLabelFormatDropDownList.Items.Add("Label"); DataLabelFormatDropDownList.SelectedIndex = 0; WebExamplesUtilities.FillComboWithValues(PointSizeDropDownList, 0, 10, 1); PointSizeDropDownList.SelectedIndex = 4; WebExamplesUtilities.FillComboWithColorNames(PointColorDropDownList, KnownColor.Orange); DifferentColorsCheckBox.Checked = true; LeftAxisRoundToTickCheckBox.Checked = true; ShowDataLabelsCheckBox.Checked = true; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Point 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 linearScaleConfigurator = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; linearScaleConfigurator.RoundToTickMin = LeftAxisRoundToTickCheckBox.Checked; linearScaleConfigurator.RoundToTickMax = LeftAxisRoundToTickCheckBox.Checked; // 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); linearScaleConfigurator.StripStyles.Add(stripStyle); // hide the depth axis chart.Axis(StandardAxis.Depth).Visible = false; // setup point series NPointSeries point = (NPointSeries)chart.Series.Add(SeriesType.Point); point.Name = "Point Series"; point.Legend.Format = "<label>"; point.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(7); point.PointShape = (PointShape)PointShapeDropDownList.SelectedIndex; point.Size = new NLength((float)PointSizeDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage); point.InflateMargins = InflateMarginsCheckBox.Checked; point.AddDataPoint(new NDataPoint(23, "A")); point.AddDataPoint(new NDataPoint(67, "B")); point.AddDataPoint(new NDataPoint(47, "C")); point.AddDataPoint(new NDataPoint(12, "D")); point.AddDataPoint(new NDataPoint(56, "E")); point.AddDataPoint(new NDataPoint(78, "F")); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); if (DifferentColorsCheckBox.Checked) { PointColorDropDownList.Enabled = false; NChartPalette palette = new NChartPalette(); palette.SetPredefinedPalette(ChartPredefinedPalette.Nevron); for (int i = 0; i < point.Values.Count; i++) { point.FillStyles[i] = new NColorFillStyle(palette.SeriesColors[i % palette.SeriesColors.Count]); } point.Legend.Mode = SeriesLegendMode.DataPoints; } else { PointColorDropDownList.Enabled = true; point.FillStyles.Clear(); point.FillStyle = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(PointColorDropDownList)); point.Legend.Mode = SeriesLegendMode.Series; } if (ShowDataLabelsCheckBox.Checked) { point.DataLabelStyle.Visible = true; DataLabelFormatDropDownList.Enabled = true; switch (DataLabelFormatDropDownList.SelectedIndex) { case 0: point.DataLabelStyle.Format = "<value> <label>"; break; case 1: point.DataLabelStyle.Format = "<value>"; break; case 2: point.DataLabelStyle.Format = "<label>"; break; } } else { point.DataLabelStyle.Visible = false; DataLabelFormatDropDownList.Enabled = false; } }