protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithPercents(HorizontalMarginDropDownList, 10); HorizontalMarginDropDownList.SelectedIndex = 0; ContentAlignmentDropDownList.Items.Add("BottomCenter"); ContentAlignmentDropDownList.Items.Add("BottomLeft"); ContentAlignmentDropDownList.Items.Add("BottomRight"); ContentAlignmentDropDownList.Items.Add("MiddleCenter"); ContentAlignmentDropDownList.Items.Add("MiddleLeft"); ContentAlignmentDropDownList.Items.Add("MiddleRight"); ContentAlignmentDropDownList.Items.Add("TopCenter"); ContentAlignmentDropDownList.Items.Add("TopLeft"); ContentAlignmentDropDownList.Items.Add("TopRight"); ContentAlignmentDropDownList.SelectedIndex = 2; WebExamplesUtilities.FillComboWithPercents(VerticalMarginDropDownList, 10); VerticalMarginDropDownList.SelectedIndex = 0; WebExamplesUtilities.FillComboWithFontNames(DataFontDropDownList, "Arial"); WebExamplesUtilities.FillComboWithValues(DataFontSizeDropDownList, 9, 30, 1); HasShadowCheckBox.Checked = true; ShowLegendGridCheckBox.Checked = true; WebExamplesUtilities.FillComboWithPercents(BackplaneTransparencyDropDownList, 10); BackplaneTransparencyDropDownList.SelectedIndex = 0; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // add panels nChartControl1.Panels.Clear(); NLabel title = new NLabel("Legend Position"); nChartControl1.Panels.Add(title); NPieChart chart = new NPieChart(); nChartControl1.Panels.Add(chart); NLegend legend = new NLegend(); nChartControl1.Panels.Add(legend); // setup the chart title title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL( new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // setup the legend legend.ShadowStyle.Type = HasShadowCheckBox.Checked ? ShadowType.GaussianBlur : ShadowType.None; legend.ShadowStyle.Offset = new NPointL(2, 2); legend.ShadowStyle.Color = Color.FromArgb(64, 64, 64, 64); legend.FillStyle = new NColorFillStyle(Color.FromArgb(255 - (int)(BackplaneTransparencyDropDownList.SelectedIndex * 255 / 10.0f), 255, 255, 255)); legend.ContentAlignment = (ContentAlignment)Enum.Parse(typeof(ContentAlignment), ContentAlignmentDropDownList.SelectedItem.Text); legend.Location = new NPointL( new NLength(HorizontalMarginDropDownList.SelectedIndex * 10, NRelativeUnit.ParentPercentage), new NLength(VerticalMarginDropDownList.SelectedIndex * 10, NRelativeUnit.ParentPercentage)); if (ShowLegendGridCheckBox.Checked == true) { legend.HorizontalBorderStyle.Width = new NLength(1, NGraphicsUnit.Pixel); legend.VerticalBorderStyle.Width = new NLength(1, NGraphicsUnit.Pixel); } else { legend.HorizontalBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); legend.VerticalBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); } // setup the pie chart chart.DisplayOnLegend = legend; chart.BoundsMode = BoundsMode.Fit; chart.Location = new NPointL( new NLength(10, NRelativeUnit.ParentPercentage), new NLength(20, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL( new NLength(80, NRelativeUnit.ParentPercentage), new NLength(60, NRelativeUnit.ParentPercentage)); NPieSeries pie = (NPieSeries)chart.Series.Add(SeriesType.Pie); pie.DataLabelStyle.Visible = false; pie.Legend.Mode = SeriesLegendMode.DataPoints; pie.Legend.Format = "<label> <percent>"; pie.Legend.TextStyle.FontStyle.Name = DataFontDropDownList.SelectedItem.Text; pie.Legend.TextStyle.FontStyle.EmSize = new NLength(DataFontSizeDropDownList.SelectedIndex + 9, NGraphicsUnit.Point); for (int i = 0; i < 6; i++) { pie.Values.Add(10 + Random.NextDouble() * 30); pie.Labels.Add("Item " + i.ToString()); } // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.PaleMultiColor); styleSheet.Apply(chart); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // fill the combo LineStyleDropDownList.Items.Add("Line"); LineStyleDropDownList.Items.Add("Tape"); LineStyleDropDownList.Items.Add("Tube"); LineStyleDropDownList.Items.Add("Ellipsoid"); LineStyleDropDownList.SelectedIndex = 0; WebExamplesUtilities.FillComboWithEnumValues(MarkerShapeDropDownList, typeof(PointShape)); MarkerShapeDropDownList.SelectedIndex = 1; WebExamplesUtilities.FillComboWithPercents(LineDepthDropDownList, 10); LineDepthDropDownList.SelectedIndex = 4; WebExamplesUtilities.FillComboWithValues(LineWidthDropDownList, 0, 5, 1); LineWidthDropDownList.SelectedIndex = 1; WebExamplesUtilities.FillComboWithColorNames(LineColorDropDownList, KnownColor.DarkSalmon); WebExamplesUtilities.FillComboWithColorNames(LineFillColorDropDownList, KnownColor.LightSalmon); WebExamplesUtilities.FillComboWithValues(MarkerSizeDropDownList, 0, 10, 1); MarkerSizeDropDownList.SelectedIndex = 2; ShowMarkersCheckBox.Checked = true; LeftAxisRoundToTickCheckBox.Checked = true; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Settings.JitterMode = JitterMode.Enabled; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("3D Line Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective2); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); chart.Axis(StandardAxis.Depth).Visible = false; // setup Y axis NLinearScaleConfigurator scaleY = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator; scaleY.RoundToTickMin = LeftAxisRoundToTickCheckBox.Checked; scaleY.RoundToTickMax = LeftAxisRoundToTickCheckBox.Checked; // add Y axis 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); scaleY.StripStyles.Add(stripStyle); // setup X axis NOrdinalScaleConfigurator scaleX = chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator; scaleX.MajorTickMode = MajorTickMode.AutoMaxCount; scaleX.DisplayDataPointsBetweenTicks = false; // setup the line series NLineSeries nLine = (NLineSeries)chart.Series.Add(SeriesType.Line); nLine.Values.FillRandom(Random, 10); nLine.DataLabelStyle.Visible = false; nLine.Legend.Mode = SeriesLegendMode.DataPoints; nLine.BorderStyle.Width = new NLength(LineWidthDropDownList.SelectedIndex, NGraphicsUnit.Pixel); nLine.DepthPercent = LineDepthDropDownList.SelectedIndex * 10; nLine.BorderStyle.Color = WebExamplesUtilities.ColorFromDropDownList(LineColorDropDownList); nLine.FillStyle = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(LineFillColorDropDownList)); nLine.InflateMargins = InflateMarginsCheckBox.Checked; nLine.MarkerStyle.Visible = ShowMarkersCheckBox.Checked; bool bSimpleLine = (LineStyleDropDownList.SelectedIndex == 0); switch (LineStyleDropDownList.SelectedIndex) { case 0: // simple line nLine.LineSegmentShape = LineSegmentShape.Line; break; case 1: // tape nLine.LineSegmentShape = LineSegmentShape.Tape; break; case 2: // tube nLine.LineSegmentShape = LineSegmentShape.Tube; break; case 3: // elipsoid nLine.LineSegmentShape = LineSegmentShape.Ellipsoid; break; } LineDepthDropDownList.Enabled = !bSimpleLine; LineFillColorDropDownList.Enabled = !bSimpleLine; MarkerShapeDropDownList.Enabled = ShowMarkersCheckBox.Checked; MarkerSizeDropDownList.Enabled = ShowMarkersCheckBox.Checked; if (nLine.MarkerStyle.Visible) { nLine.MarkerStyle.PointShape = (PointShape)MarkerShapeDropDownList.SelectedIndex; nLine.MarkerStyle.Height = new NLength((float)MarkerSizeDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage); nLine.MarkerStyle.Width = new NLength((float)MarkerSizeDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage); nLine.MarkerStyle.FillStyle = new NColorFillStyle(Red); nLine.MarkerStyle.BorderStyle.Color = WebExamplesUtilities.ColorFromDropDownList(LineColorDropDownList); } // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithEnumValues(MarkerShapeDropDown, typeof(PointShape)); MarkerShapeDropDown.SelectedIndex = 0; WebExamplesUtilities.FillComboWithEnumValues(Marker3ShapeDropDown, typeof(PointShape)); Marker3ShapeDropDown.SelectedIndex = 1; WebExamplesUtilities.FillComboWithValues(WidthDropDownList, 0, 5, 1); WebExamplesUtilities.FillComboWithValues(HeightDropDownList, 0, 5, 1); WebExamplesUtilities.FillComboWithPercents(DepthDropDownList, 10); WebExamplesUtilities.FillComboWithPercents(LineDepthDropDownList, 10); WebExamplesUtilities.FillComboWithColorNames(MarkerColorDropDown, KnownColor.Tan); WebExamplesUtilities.FillComboWithColorNames(Marker3ColorDropDown, KnownColor.Salmon); LineDepthDropDownList.SelectedIndex = 3; WidthDropDownList.SelectedIndex = 2; HeightDropDownList.SelectedIndex = 2; AutoDepthCheckBox.Checked = true; MarkersVisibleCheckBox.Checked = true; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Settings.JitterMode = JitterMode.Enabled; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Series Markers"); 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 = true; chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1); 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); NLineSeries line = (NLineSeries)chart.Series.Add(SeriesType.Line); line.InflateMargins = true; line.Legend.Mode = SeriesLegendMode.DataPoints; line.LineSegmentShape = LineSegmentShape.Line; line.Values.FillRandom(Random, 5); line.DataLabelStyle.Visible = false; line.FillStyle = new NColorFillStyle(Color.DarkGray); line.BorderStyle.Color = Color.DarkGray; DepthDropDownList.Enabled = !AutoDepthCheckBox.Checked; line.MarkerStyle.AutoDepth = AutoDepthCheckBox.Checked; if (AutoDepthCheckBox.Checked) { line.MarkerStyle.Depth = new NLength((float)(DepthDropDownList.SelectedIndex * 10), NRelativeUnit.ParentPercentage); } line.DepthPercent = LineDepthDropDownList.SelectedIndex * 10; line.MarkerStyle.Height = new NLength((float)HeightDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage); line.MarkerStyle.Width = new NLength((float)WidthDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage); line.MarkerStyle.Visible = MarkersVisibleCheckBox.Checked; line.MarkerStyle.FillStyle = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(MarkerColorDropDown)); line.MarkerStyle.BorderStyle.Color = WebExamplesUtilities.ColorFromDropDownList(MarkerColorDropDown); line.MarkerStyle.PointShape = (PointShape)MarkerShapeDropDown.SelectedIndex; NMarkerStyle marker = new NMarkerStyle(); marker.Visible = true; marker.FillStyle = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(Marker3ColorDropDown)); marker.BorderStyle.Color = WebExamplesUtilities.ColorFromDropDownList(Marker3ColorDropDown); marker.PointShape = (PointShape)Marker3ShapeDropDown.SelectedIndex; line.MarkerStyles[3] = marker; // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithPercents(RedAxisEndPercentDropDownList, 1); WebExamplesUtilities.FillComboWithPercents(BlueAxisEndPercentDropDownList, 1); RedAxisEndPercentDropDownList.SelectedIndex = 40; BlueAxisEndPercentDropDownList.SelectedIndex = 60; } nChartControl1.Settings.JitterMode = JitterMode.Enabled; nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel header = nChartControl1.Labels.AddHeader("Axis Docking and Anchor Percentages<br/> <font size = '9pt'>Demonstrates how to dock axes without creating a new zone level</font>"); header.TextStyle.TextFormat = TextFormat.XML; header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); header.TextStyle.StringFormatStyle.HorzAlign = HorzAlign.Left; header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; header.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL( new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // turn off the legend nChartControl1.Legends[0].Mode = LegendMode.Disabled; nChart = nChartControl1.Charts[0]; nChart.Enable3D = true; nChart.BoundsMode = BoundsMode.Fit; nChart.Location = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage)); nChart.Size = new NSizeL(new NLength(96, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage)); // apply predefined lighting and projection nChart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); nChart.LightModel.SetPredefinedLightModel(PredefinedLightModel.MetallicLustre); // configure primary Y NAxis primaryY = nChart.Axis(StandardAxis.PrimaryY); primaryY.Anchor.BeginPercent = 0; primaryY.Anchor.EndPercent = 30; // configure secondary Y NAxis secondaryY = nChart.Axis(StandardAxis.SecondaryY); secondaryY.Visible = true; secondaryY.Anchor.BeginPercent = 30; secondaryY.Anchor.EndPercent = 70; // configure a custom axis docked to the front left left chart zone NAxis customY = ((NCartesianAxisCollection)nChart.Axes).AddCustomAxis(AxisOrientation.Vertical, AxisDockZone.FrontLeft); customY.Visible = true; customY.Anchor.BeginPercent = 70; customY.Anchor.EndPercent = 100; nCustomAxisId = customY.AxisId; // Setup the line series NLineSeries l1 = (NLineSeries)nChart.Series.Add(SeriesType.Line); l1.Values.FillRandom(Random, 5); l1.LineSegmentShape = LineSegmentShape.Tape; l1.DataLabelStyle.Format = "<value>"; NLineSeries l2 = (NLineSeries)nChart.Series.Add(SeriesType.Line); l2.Values.FillRandom(Random, 5); l2.LineSegmentShape = LineSegmentShape.Tape; l2.DataLabelStyle.Format = "<value>"; l2.DisplayOnAxis(StandardAxis.SecondaryY, true); l2.DisplayOnAxis(StandardAxis.PrimaryY, false); NLineSeries l3 = (NLineSeries)nChart.Series.Add(SeriesType.Line); l3.Values.FillRandom(Random, 5); l3.LineSegmentShape = LineSegmentShape.Tape; l3.DataLabelStyle.Format = "<value>"; l3.DisplayOnAxis(nCustomAxisId, true); l3.DisplayOnAxis(StandardAxis.PrimaryY, false); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // set up the appearance of the axes according to the filling/stroke // applied to the line series from the style sheet primaryY.ScaleConfigurator = ConfigureScale(l1.FillStyle, l1.BorderStyle.Color); secondaryY.ScaleConfigurator = ConfigureScale(l2.FillStyle, l2.BorderStyle.Color); customY.ScaleConfigurator = ConfigureScale(l3.FillStyle, l3.BorderStyle.Color); RecalcAxes(); }
protected void Page_Load(object sender, EventArgs e) { NStockSeries stock; if (!IsPostBack) { // set a chart title nChartControl1.BackgroundStyle.FrameStyle.Visible = false; NLabel title = nChartControl1.Labels.AddHeader("Stock Data Grouping"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // no legend nChartControl1.Legends.Clear(); // setup chart NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; NRangeSelection rs = new NRangeSelection(); rs.VerticalValueSnapper = new NAxisRulerMinMaxSnapper(); chart.RangeSelections.Add(rs); // setup X axis NValueTimelineScaleConfigurator scaleX = new NValueTimelineScaleConfigurator(); scaleX.FirstRow.GridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleX.FirstRow.GridStyle.LineStyle = new NStrokeStyle(1, Color.FromArgb(225, 225, 225)); scaleX.FirstRow.UseGridStyle = true; scaleX.FirstRow.InnerTickStyle.Visible = false; scaleX.SecondRow.GridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleX.SecondRow.GridStyle.LineStyle = new NStrokeStyle(1, Color.FromArgb(215, 215, 215)); scaleX.SecondRow.UseGridStyle = true; scaleX.SecondRow.InnerTickStyle.Visible = false; scaleX.ThirdRow.GridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleX.ThirdRow.GridStyle.LineStyle = new NStrokeStyle(1, Color.FromArgb(205, 205, 205)); scaleX.ThirdRow.UseGridStyle = true; scaleX.ThirdRow.InnerTickStyle.Visible = false; // calendar NWeekDayRule wdr = new NWeekDayRule(WeekDayBit.All); wdr.Saturday = false; wdr.Sunday = false; scaleX.Calendar.Rules.Add(wdr); scaleX.EnableCalendar = true; // set configurator chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; chart.Axis(StandardAxis.PrimaryX).ScrollBar.Visible = true; // setup Y axis NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; scaleY.OuterMajorTickStyle.Length = new NLength(3, NGraphicsUnit.Point); scaleY.InnerMajorTickStyle.Visible = false; NFillStyle stripFill = new NColorFillStyle(Color.FromArgb(234, 233, 237)); NScaleStripStyle stripStyle = new NScaleStripStyle(stripFill, null, true, 1, 0, 1, 1); stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; stripStyle.Interlaced = true; scaleY.StripStyles.Add(stripStyle); // setup stock series stock = (NStockSeries)chart.Series.Add(SeriesType.Stock); stock.DataLabelStyle.Visible = false; stock.UpFillStyle = new NColorFillStyle(Color.White); stock.UpStrokeStyle.Color = Color.Black; stock.DownFillStyle = new NColorFillStyle(Color.Crimson); stock.DownStrokeStyle.Color = Color.Crimson; stock.HighLowStrokeStyle.Color = Color.Black; stock.CandleWidth = new NLength(1.2f, NRelativeUnit.ParentPercentage); stock.UseXValues = true; stock.InflateMargins = true; stock.DataLabelStyle.Format = "open - <open>\r\nclose - <close>"; // add some stock items const int numDataPoints = 1000; WebExamplesUtilities.GenerateOHLCData(stock, 100.0, numDataPoints, new NRange1DD(60, 140)); FillStockDates(stock, numDataPoints, DateTime.Now - new TimeSpan((int)(numDataPoints * 1.2), 0, 0, 0)); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); // update form controls CustomDateTimeSpanDropDownList.Items.Add("1 Week"); CustomDateTimeSpanDropDownList.Items.Add("2 Weeks"); CustomDateTimeSpanDropDownList.Items.Add("1 Month"); CustomDateTimeSpanDropDownList.Items.Add("3 Months"); WebExamplesUtilities.FillComboWithEnumNames(GroupingModeDropDownList, typeof(StockGroupingMode)); CustomDateTimeSpanDropDownList.SelectedIndex = 2; GroupingModeDropDownList.SelectedIndex = (int)StockGroupingMode.SynchronizeWithMajorTick; WebExamplesUtilities.FillComboWithPercents(GroupPercendWidthDropDownList, 10); GroupPercendWidthDropDownList.SelectedIndex = 2; WebExamplesUtilities.FillComboWithValues(MinGroupDistanceDropDownList, 2, 20, 2); MinGroupDistanceDropDownList.SelectedIndex = 2; } else { stock = (NStockSeries)nChartControl1.Charts[0].Series[0]; } MinGroupDistanceDropDownList.Enabled = false; CustomDateTimeSpanDropDownList.Enabled = false; GroupPercendWidthDropDownList.Enabled = true; switch (GroupingModeDropDownList.SelectedIndex) { case (int)StockGroupingMode.None: stock.GroupingMode = StockGroupingMode.None; GroupPercendWidthDropDownList.Enabled = false; break; case (int)StockGroupingMode.AutoDateTimeSpan: stock.GroupingMode = StockGroupingMode.AutoDateTimeSpan; MinGroupDistanceDropDownList.Enabled = true; break; case (int)StockGroupingMode.CustomDateTimeSpan: stock.GroupingMode = StockGroupingMode.CustomDateTimeSpan; CustomDateTimeSpanDropDownList.Enabled = true; break; case (int)StockGroupingMode.SynchronizeWithMajorTick: stock.GroupingMode = StockGroupingMode.SynchronizeWithMajorTick; break; default: break; } stock.MinAutoGroupLength = new NLength((float)MinGroupDistanceDropDownList.SelectedIndex * 2 + 2, NGraphicsUnit.Point); switch (CustomDateTimeSpanDropDownList.SelectedIndex) { case 0: // 1 Week stock.CustomGroupStep = new NDateTimeSpan(1, NDateTimeUnit.Week); break; case 1: // 2 Weeks stock.CustomGroupStep = new NDateTimeSpan(2, NDateTimeUnit.Week); break; case 2: // 1 Month stock.CustomGroupStep = new NDateTimeSpan(1, NDateTimeUnit.Month); break; case 3: // 3 Months stock.CustomGroupStep = new NDateTimeSpan(3, NDateTimeUnit.Month); break; } stock.GroupPercentWidth = (float)GroupPercendWidthDropDownList.SelectedIndex * 10; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { CountryDropDownList.Items.Add("USA"); CountryDropDownList.Items.Add("CHINA"); CountryDropDownList.Items.Add("JAPAN"); CountryDropDownList.Items.Add("GERMANY"); CountryDropDownList.Items.Add("FRANCE"); CountryDropDownList.Items.Add("UK"); CountryDropDownList.SelectedIndex = 0; WebExamplesUtilities.FillComboWithPercents(XPositionDropDownList, 10); XPositionDropDownList.SelectedIndex = 0; WebExamplesUtilities.FillComboWithPercents(YPositionDropDownList, 10); YPositionDropDownList.SelectedIndex = 0; WebExamplesUtilities.FillComboWithPercents(FlagTransparencyDropDownList, 10); FlagTransparencyDropDownList.SelectedIndex = 5; ContentAlignmentDropDownList.Items.Add("BottomCenter"); ContentAlignmentDropDownList.Items.Add("BottomLeft"); ContentAlignmentDropDownList.Items.Add("BottomRight"); ContentAlignmentDropDownList.Items.Add("MiddleCenter"); ContentAlignmentDropDownList.Items.Add("MiddleLeft"); ContentAlignmentDropDownList.Items.Add("MiddleRight"); ContentAlignmentDropDownList.Items.Add("TopCenter"); ContentAlignmentDropDownList.Items.Add("TopLeft"); ContentAlignmentDropDownList.Items.Add("TopRight"); ContentAlignmentDropDownList.SelectedIndex = 2; } // enable the antialiasing of the whole scene nChartControl1.Settings.JitterMode = JitterMode.Enabled; nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // by default the chart contains a cartesian chart which cannot display a pie series nChartControl1.Charts.Clear(); // create the legend NLegend legend = new NLegend(); legend.HorizontalBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); legend.VerticalBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); legend.FillStyle.SetTransparencyPercent(50); legend.OuterBottomBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); legend.OuterLeftBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); legend.OuterRightBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); legend.OuterTopBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); legend.SetPredefinedLegendStyle(PredefinedLegendStyle.TopRight); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Car sales for " + CountryDropDownList.SelectedItem.Text); title.ContentAlignment = ContentAlignment.TopRight; title.Location = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(98, NRelativeUnit.ParentPercentage)); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // create the watermark NWatermark watermark = new NWatermark(); watermark.FillStyle = new NImageFillStyle(this.MapPathSecure(this.TemplateSourceDirectory + "\\" + CountryDropDownList.SelectedItem.Text + ".GIF")); watermark.Location = new NPointL(new NLength(XPositionDropDownList.SelectedIndex * 10, NRelativeUnit.ParentPercentage), new NLength(YPositionDropDownList.SelectedIndex * 10, NRelativeUnit.ParentPercentage)); watermark.UseAutomaticSize = false; watermark.Size = new NSizeL(150, 100); watermark.ContentAlignment = (ContentAlignment)ContentAlignment.Parse(typeof(ContentAlignment), ContentAlignmentDropDownList.SelectedItem.Text); watermark.FillStyle.SetTransparencyPercent(FlagTransparencyDropDownList.SelectedIndex * 10.0f); watermark.StandardFrameStyle.Visible = false; // create the chart NPieChart chart = new NPieChart(); chart.Enable3D = true; chart.Depth = 5; if (ShowFlagAboveChartBox.Checked) { nChartControl1.Panels.Add(chart); nChartControl1.Panels.Add(legend); nChartControl1.Panels.Add(watermark); } else { nChartControl1.Panels.Add(watermark); nChartControl1.Panels.Add(chart); nChartControl1.Panels.Add(legend); } chart.DisplayOnLegend = legend; chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.MetallicLustre); chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveElevated); NPieSeries pie = (NPieSeries)chart.Series.Add(SeriesType.Pie); pie.PieStyle = PieStyle.SmoothEdgePie; pie.LabelMode = PieLabelMode.Center; pie.Legend.Mode = SeriesLegendMode.DataPoints; pie.DataLabelStyle.Visible = false; pie.AddDataPoint(new NDataPoint(0, "Toyota")); pie.AddDataPoint(new NDataPoint(0, "Honda")); pie.AddDataPoint(new NDataPoint(0, "Volkswagen")); pie.AddDataPoint(new NDataPoint(0, "Chrysler")); pie.AddDataPoint(new NDataPoint(0, "Ford")); pie.Values.FillRandom(Random, 5); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(pie); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithPercents(WidthPercentDropDownList, 10); WidthPercentDropDownList.SelectedIndex = 7; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Gantt"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // setup legend NLegend legend = nChartControl1.Legends[0]; legend.HorizontalBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); legend.VerticalBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); // configure the chart NChart chart = nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; chart.Projection.ViewerRotation = 270; // setup the value axis NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator(); dateTimeScale.EnableUnitSensitiveFormatting = false; dateTimeScale.LabelValueFormatter = new NDateTimeValueFormatter("d MMM"); dateTimeScale.MajorTickMode = MajorTickMode.CustomStep; dateTimeScale.CustomStep = new NDateTimeSpan(1, NDateTimeUnit.Week); dateTimeScale.LabelStyle.TextStyle.FontStyle.EmSize = new NLength(8); dateTimeScale.LabelStyle.Angle = new NScaleLabelAngle(90); dateTimeScale.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; // add interlaced stripe NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; stripStyle.Interlaced = true; dateTimeScale.StripStyles.Add(stripStyle); chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = dateTimeScale; chart.Axis(StandardAxis.PrimaryY).Anchor = new NDockAxisAnchor(AxisDockZone.FrontRight, true, 0, 100); // label the X axis NOrdinalScaleConfigurator ordinalScale = chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator; ordinalScale.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; ordinalScale.LabelStyle.TextStyle.FontStyle.EmSize = new NLength(8); ordinalScale.MajorTickMode = MajorTickMode.AutoMaxCount; ordinalScale.AutoLabels = false; ordinalScale.Labels.Add("Market Research"); ordinalScale.Labels.Add("Specifications"); ordinalScale.Labels.Add("Architecture"); ordinalScale.Labels.Add("Project Planning"); ordinalScale.Labels.Add("Detailed Design"); ordinalScale.Labels.Add("Development"); ordinalScale.Labels.Add("Test Plan"); ordinalScale.Labels.Add("Testing and QA"); ordinalScale.Labels.Add("Documentation"); // create a floatbar series NFloatBarSeries floatBar = (NFloatBarSeries)chart.Series.Add(SeriesType.FloatBar); floatBar.BeginValues.ValueFormatter = new NDateTimeValueFormatter(DateTimeValueFormat.Date); floatBar.EndValues.ValueFormatter = new NDateTimeValueFormatter(DateTimeValueFormat.Date); floatBar.DataLabelStyle.Visible = false; AddDataPoint(floatBar, new DateTime(2009, 2, 2), new DateTime(2009, 2, 16)); AddDataPoint(floatBar, new DateTime(2009, 2, 16), new DateTime(2009, 3, 2)); AddDataPoint(floatBar, new DateTime(2009, 3, 2), new DateTime(2009, 3, 16)); AddDataPoint(floatBar, new DateTime(2009, 3, 9), new DateTime(2009, 3, 23)); AddDataPoint(floatBar, new DateTime(2009, 3, 16), new DateTime(2009, 3, 30)); AddDataPoint(floatBar, new DateTime(2009, 3, 23), new DateTime(2009, 4, 27)); AddDataPoint(floatBar, new DateTime(2009, 4, 13), new DateTime(2009, 4, 27)); AddDataPoint(floatBar, new DateTime(2009, 4, 20), new DateTime(2009, 5, 4)); AddDataPoint(floatBar, new DateTime(2009, 4, 27), new DateTime(2009, 5, 4)); floatBar.WidthPercent = WidthPercentDropDownList.SelectedIndex * 10; // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); }
protected void Page_Load(object sender, EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Multi Series Area Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // setup the chart NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.Width = 70; chart.Height = 30; chart.Depth = 50; chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); // setup Y axis NLinearScaleConfigurator linearScaleConfigurator = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; linearScaleConfigurator.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; 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 }; linearScaleConfigurator.StripStyles.Add(stripStyle); // setup X axis NOrdinalScaleConfigurator ordinalScaleConfigurator = (NOrdinalScaleConfigurator)chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator; ordinalScaleConfigurator.DisplayDataPointsBetweenTicks = false; ordinalScaleConfigurator.MajorTickMode = MajorTickMode.AutoMaxCount; ordinalScaleConfigurator.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; ordinalScaleConfigurator.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back, ChartWallType.Floor }; // setup Z axis ordinalScaleConfigurator = (NOrdinalScaleConfigurator)chart.Axis(StandardAxis.Depth).ScaleConfigurator; ordinalScaleConfigurator.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; ordinalScaleConfigurator.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Left, ChartWallType.Floor }; // add the first Area NAreaSeries area1 = (NAreaSeries)chart.Series.Add(SeriesType.Area); area1.Name = "Area 1"; area1.MultiAreaMode = MultiAreaMode.Series; area1.DataLabelStyle.Visible = false; area1.Legend.TextStyle.FontStyle.EmSize = new NLength(8); // add the second Area NAreaSeries area2 = (NAreaSeries)chart.Series.Add(SeriesType.Area); area2.Name = "Area 2"; area2.MultiAreaMode = MultiAreaMode.Series; area2.DataLabelStyle.Visible = false; area2.Legend.TextStyle.FontStyle.EmSize = new NLength(8); // add the third Area NAreaSeries area3 = (NAreaSeries)chart.Series.Add(SeriesType.Area); area3.Name = "Area 3"; area3.MultiAreaMode = MultiAreaMode.Series; area3.DataLabelStyle.Visible = false; area3.Legend.TextStyle.FontStyle.EmSize = new NLength(8); // fill with random data area1.Values.FillRandomRange(Random, 10, 10, 40); area2.Values.FillRandomRange(Random, 10, 30, 60); area3.Values.FillRandomRange(Random, 10, 50, 80); if (!IsPostBack) { WebExamplesUtilities.FillComboWithPercents(AreaDepthDropDownList, 10); AreaDepthDropDownList.SelectedIndex = 5; } // modify the depth percent area1.DepthPercent = WebExamplesUtilities.GetPercentFromCombo(AreaDepthDropDownList, 10); area2.DepthPercent = WebExamplesUtilities.GetPercentFromCombo(AreaDepthDropDownList, 10); area3.DepthPercent = WebExamplesUtilities.GetPercentFromCombo(AreaDepthDropDownList, 10); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]); }
protected void Page_Load(object sender, EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Settings.JitterMode = JitterMode.Enabled; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Grid Surface Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // setup legend NLegend legend = nChartControl1.Legends[0]; legend.VerticalBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); legend.HorizontalBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); legend.OuterBottomBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); legend.OuterLeftBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); legend.OuterRightBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); legend.OuterTopBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); legend.FillStyle = new NColorFillStyle(Color.Transparent); legend.Data.MarkSize = new NSizeL(new NLength(7), new NLength(7)); // setup chart NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.Width = 70.0f; chart.Depth = 70.0f; chart.Height = 30.0f; chart.Projection.Type = ProjectionType.Perspective; chart.Projection.Elevation = 28; chart.Projection.Rotation = -18; chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.ShinyTopLeft); if (!IsPostBack) { RotationTextBox.Text = chart.Projection.Rotation.ToString(); ElevationTextBox.Text = chart.Projection.Elevation.ToString(); WebExamplesUtilities.FillComboWithPercents(TransparencyDropDownList, 10); WebExamplesUtilities.FillComboWithValues(CustomValueDropDownList, 0, 20, 1); CustomValueDropDownList.SelectedIndex = 5; // form controls FrameStyleDropDownList.Items.Add("None"); FrameStyleDropDownList.Items.Add("Mesh"); FrameStyleDropDownList.Items.Add("Contour"); FrameStyleDropDownList.Items.Add("Mesh-Contour"); FrameStyleDropDownList.Items.Add("Dots"); FrameStyleDropDownList.SelectedIndex = 2; PositionModeDropDownList.Items.Add("Axis Begin"); PositionModeDropDownList.Items.Add("Axis End"); PositionModeDropDownList.Items.Add("Custom Value"); PositionModeDropDownList.SelectedIndex = 0; smoothShadingCheck.Checked = true; } else { chart.Projection.Rotation = (float)Convert.ToDouble(RotationTextBox.Text); chart.Projection.Elevation = (float)Convert.ToDouble(ElevationTextBox.Text); } // setup Y axis NLinearScaleConfigurator linearScaleConfigurator = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; linearScaleConfigurator.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 8); // 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); // setup X axis NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator(); scaleX.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Back }; scaleX.RoundToTickMin = false; scaleX.RoundToTickMax = false; chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; // setup Z axis NLinearScaleConfigurator scaleZ = new NLinearScaleConfigurator(); scaleZ.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Left }; scaleZ.RoundToTickMin = false; scaleZ.RoundToTickMax = false; chart.Axis(StandardAxis.Depth).ScaleConfigurator = scaleZ; // add the surface series NGridSurfaceSeries surface = (NGridSurfaceSeries)chart.Series.Add(SeriesType.GridSurface); surface.Name = "Surface"; surface.Legend.Mode = SeriesLegendMode.SeriesLogic; surface.Legend.TextStyle.FontStyle.EmSize = new NLength(8, NGraphicsUnit.Point); surface.PositionValue = 10.0; surface.Data.SetGridSize(32, 32); surface.SyncPaletteWithAxisScale = false; surface.PaletteSteps = 8; surface.ValueFormatter.FormatSpecifier = "0.0"; FillData(surface); if (SmoothPaletteCheckBox.Checked) { surface.SmoothPalette = true; surface.Legend.Format = "<zone_value>"; } else { surface.SmoothPalette = false; surface.Legend.Format = "<zone_begin> - <zone_end>"; } surface.DrawFlat = DrawFlatCheckBox.Checked; PositionModeDropDownList.Enabled = DrawFlatCheckBox.Checked; CustomValueDropDownList.Enabled = DrawFlatCheckBox.Checked; surface.FillStyle.SetTransparencyPercent(TransparencyDropDownList.SelectedIndex * 10); if (PaletteFrameCheckBox.Checked) { surface.FrameColorMode = SurfaceFrameColorMode.Zone; } else { surface.FrameColorMode = SurfaceFrameColorMode.Uniform; } surface.FrameMode = (SurfaceFrameMode)FrameStyleDropDownList.SelectedIndex; PaletteFrameCheckBox.Enabled = (surface.FrameMode != SurfaceFrameMode.None); surface.PositionMode = (SurfacePositionMode)PositionModeDropDownList.SelectedIndex; surface.PositionValue = CustomValueDropDownList.SelectedIndex; if (smoothShadingCheck.Checked) { surface.ShadingMode = ShadingMode.Smooth; } else { surface.ShadingMode = ShadingMode.Flat; } // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, legend); }
protected void Page_Load(object sender, EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Cluster Bar Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // setup chart nChart = nChartControl1.Charts[0]; nChart.BoundsMode = BoundsMode.Stretch; // add interlace stripe NLinearScaleConfigurator linearScale = nChart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator; NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; linearScale.StripStyles.Add(stripStyle); // add the first bar nBar1 = (NBarSeries)nChart.Series.Add(SeriesType.Bar); nBar1.Name = "Bar1"; nBar1.MultiBarMode = MultiBarMode.Series; nBar1.Legend.TextStyle.FontStyle.EmSize = new NLength(8); nBar1.DataLabelStyle.Format = "<value>"; nBar1.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(7); nBar1.FillStyle = new NColorFillStyle(Color.DarkSeaGreen); nBar1.Values.ValueFormatter = new NNumericValueFormatter("0"); // add the second bar nBar2 = (NBarSeries)nChart.Series.Add(SeriesType.Bar); nBar2.Name = "Bar2"; nBar2.MultiBarMode = MultiBarMode.Clustered; nBar2.Legend.TextStyle.FontStyle.EmSize = new NLength(8); nBar2.DataLabelStyle.Format = "<value>"; nBar2.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(7); nBar2.FillStyle = new NColorFillStyle(Color.MediumSlateBlue); nBar2.Values.ValueFormatter = new NNumericValueFormatter("0"); // fill with random data nBar1.Values.FillRandomRange(Random, 5, 10, 100); nBar2.Values.FillRandomRange(Random, 5, 10, 500); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // apply layout ApplyLayoutTemplate(0, nChartControl1, nChart, title, nChartControl1.Legends[0]); if (!IsPostBack) { WebExamplesUtilities.FillComboWithPercents(GapPercentDropDownList, 10); WebExamplesUtilities.FillComboWithPercents(WidthPercentDropDownList, 10); GapPercentDropDownList.SelectedIndex = 0; WidthPercentDropDownList.SelectedIndex = 8; } else { nBar1.GapPercent = WebExamplesUtilities.GetPercentFromCombo(GapPercentDropDownList, 10); nBar2.GapPercent = WebExamplesUtilities.GetPercentFromCombo(GapPercentDropDownList, 10); nBar1.WidthPercent = WebExamplesUtilities.GetPercentFromCombo(WidthPercentDropDownList, 10); nBar2.WidthPercent = WebExamplesUtilities.GetPercentFromCombo(WidthPercentDropDownList, 10); if (ScaleSecondaryClusterCheckBox.Checked == true) { nBar2.DisplayOnAxis(StandardAxis.PrimaryY, false); nBar2.DisplayOnAxis(StandardAxis.SecondaryY, true); nChart.Axis(StandardAxis.SecondaryY).Visible = true; } else { nBar2.DisplayOnAxis(StandardAxis.PrimaryY, true); nBar2.DisplayOnAxis(StandardAxis.SecondaryY, false); nChart.Axis(StandardAxis.SecondaryY).Visible = false; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithEnumValues(BarShapeDropDownList, typeof(BarShape)); BarShapeDropDownList.SelectedIndex = 0; WebExamplesUtilities.FillComboWithPercents(WidthPercentDropDownList, 10); WidthPercentDropDownList.SelectedIndex = 6; WebExamplesUtilities.FillComboWithPercents(DepthPercentDropDownList, 10); DepthPercentDropDownList.SelectedIndex = 3; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Settings.JitterMode = JitterMode.Enabled; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("3D Float Bar"); 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.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.SoftTopLeft); chart.Axis(StandardAxis.Depth).Visible = false; // setup X axis NOrdinalScaleConfigurator scaleX = chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator; scaleX.AutoLabels = false; scaleX.MajorTickMode = MajorTickMode.AutoMaxCount; scaleX.DisplayDataPointsBetweenTicks = false; for (int i = 0; i < monthLetters.Length; i++) { scaleX.CustomLabels.Add(new NCustomValueLabel(i, monthLetters[i])); } // add interlace stripe NLinearScaleConfigurator scaleY = 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); scaleY.StripStyles.Add(stripStyle); // setup floatbar series NFloatBarSeries floatBar = (NFloatBarSeries)chart.Series.Add(SeriesType.FloatBar); floatBar.DataLabelStyle.Format = "<label>"; floatBar.DataLabelStyle.VertAlign = VertAlign.Center; floatBar.BarShape = (BarShape)BarShapeDropDownList.SelectedIndex; floatBar.WidthPercent = WidthPercentDropDownList.SelectedIndex * 10; floatBar.DepthPercent = DepthPercentDropDownList.SelectedIndex * 10; // add bars floatBar.AddDataPoint(new NFloatBarDataPoint(2, 10)); floatBar.AddDataPoint(new NFloatBarDataPoint(5, 16)); floatBar.AddDataPoint(new NFloatBarDataPoint(9, 17)); floatBar.AddDataPoint(new NFloatBarDataPoint(12, 21)); floatBar.AddDataPoint(new NFloatBarDataPoint(8, 18)); floatBar.AddDataPoint(new NFloatBarDataPoint(7, 18)); floatBar.AddDataPoint(new NFloatBarDataPoint(3, 11)); floatBar.AddDataPoint(new NFloatBarDataPoint(5, 12)); floatBar.AddDataPoint(new NFloatBarDataPoint(8, 17)); floatBar.AddDataPoint(new NFloatBarDataPoint(6, 15)); floatBar.AddDataPoint(new NFloatBarDataPoint(3, 10)); floatBar.AddDataPoint(new NFloatBarDataPoint(1, 7)); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithEnumValues(MarkerShapeDropDownList, typeof(PointShape)); MarkerShapeDropDownList.SelectedIndex = 1; WebExamplesUtilities.FillComboWithPercents(DepthsPercentDropDownList, 10); DepthsPercentDropDownList.SelectedIndex = 4; WebExamplesUtilities.FillComboWithValues(MarkerSizeDropDownList, 0, 10, 1); MarkerSizeDropDownList.SelectedIndex = 2; ShowDataLabelsCheckBox.Checked = false; UseOriginCheckBox.Checked = true; ShowMarkersCheckBox.Checked = false; OriginTextBox.Text = "0"; } nChartControl1.Settings.JitterMode = JitterMode.Enabled; nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("3D Area 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.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); chart.Axis(StandardAxis.Depth).Visible = false; // setup X axis NOrdinalScaleConfigurator scaleX = chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator; scaleX.AutoLabels = false; scaleX.InnerMajorTickStyle.Visible = false; scaleX.MajorTickMode = MajorTickMode.AutoMaxCount; scaleX.DisplayDataPointsBetweenTicks = false; for (int i = 0; i < monthLetters.Length; i++) { scaleX.CustomLabels.Add(new NCustomValueLabel(i, monthLetters[i])); } // 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 }; NLinearScaleConfigurator scaleY = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator; scaleY.StripStyles.Add(stripStyle); // setup area series NAreaSeries area = (NAreaSeries)chart.Series.Add(SeriesType.Area); area.Name = "Area Series"; area.DepthPercent = DepthsPercentDropDownList.SelectedIndex * 10; area.DropLines = DropLinesCheckBox.Checked; area.DataLabelStyle.Visible = ShowDataLabelsCheckBox.Checked; area.DataLabelStyle.Format = "<value>"; area.MarkerStyle.Visible = ShowMarkersCheckBox.Checked; area.MarkerStyle.PointShape = (PointShape)MarkerShapeDropDownList.SelectedIndex; area.MarkerStyle.Height = new NLength((float)MarkerSizeDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage); area.MarkerStyle.Width = new NLength((float)MarkerSizeDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage); area.Values.AddRange(monthValues); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); if (UseOriginCheckBox.Checked == true) { OriginTextBox.Enabled = true; area.OriginMode = SeriesOriginMode.CustomOrigin; try { area.Origin = Int32.Parse(OriginTextBox.Text); } catch { } } else { OriginTextBox.Enabled = false; area.OriginMode = SeriesOriginMode.MinValue; } MarkerShapeDropDownList.Enabled = ShowMarkersCheckBox.Checked; MarkerSizeDropDownList.Enabled = ShowMarkersCheckBox.Checked; // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // init form controls WebExamplesUtilities.FillComboWithEnumValues(BarShapeDropDownList, typeof(BarShape)); BarShapeDropDownList.SelectedIndex = 0; WebExamplesUtilities.FillComboWithPercents(WidthPercentDropDownList, 10); WidthPercentDropDownList.SelectedIndex = 6; WebExamplesUtilities.FillComboWithColorNames(BarColorDropDownList, KnownColor.Orange); DifferentColorsCheckBox.Checked = true; ShadowsCheckBox.Checked = true; } // setup legend nChartControl1.Legends[0].ShadowStyle.Type = ShadowType.GaussianBlur; nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("2D Float Bar"); 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; // add interlace stripe NLinearScaleConfigurator linearScale = 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 floatbar series NFloatBarSeries floatBar = (NFloatBarSeries)chart.Series.Add(SeriesType.FloatBar); floatBar.BarShape = (BarShape)BarShapeDropDownList.SelectedIndex; floatBar.WidthPercent = WidthPercentDropDownList.SelectedIndex * 10; floatBar.BeginValues.ValueFormatter.FormatSpecifier = "0.00"; floatBar.EndValues.ValueFormatter.FormatSpecifier = "0.00"; floatBar.DataLabelStyle.Format = "<label>"; floatBar.DataLabelStyle.VertAlign = VertAlign.Center; floatBar.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(8); // show the begin end values in the legend floatBar.Legend.Format = "<begin> - <end>"; floatBar.Legend.Mode = SeriesLegendMode.DataPoints; floatBar.Legend.TextStyle.FontStyle.EmSize = new NLength(8); if (ShadowsCheckBox.Checked) { floatBar.ShadowStyle.Type = ShadowType.LinearBlur; floatBar.ShadowStyle.Color = Color.FromArgb(125, 60, 60, 60); floatBar.ShadowStyle.Offset = new NPointL(3, 3); } // fill some data floatBar.AddDataPoint(new NFloatBarDataPoint(10, 20, "A")); floatBar.AddDataPoint(new NFloatBarDataPoint(20, 50, "B")); floatBar.AddDataPoint(new NFloatBarDataPoint(40, 70, "C")); floatBar.AddDataPoint(new NFloatBarDataPoint(65, 90, "D")); floatBar.AddDataPoint(new NFloatBarDataPoint(40, 60, "E")); floatBar.AddDataPoint(new NFloatBarDataPoint(55, 90, "F")); // fill styles if (DifferentColorsCheckBox.Checked) { BarColorDropDownList.Enabled = false; // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); } else { BarColorDropDownList.Enabled = true; floatBar.FillStyle = new NColorFillStyle(WebExamplesUtilities.ColorFromString(BarColorDropDownList.SelectedItem.Text)); } // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]); }
protected void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithPercents(LengthBottomAxisDropDownList, 10); WebExamplesUtilities.FillComboWithPercents(LengthLeftAxisDropDownList, 10); } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel header = nChartControl1.Labels.AddHeader("Axis Model Crossing <br/> <font size = '9pt'>Demonstrates how to use the model cross anchor</font>"); header.TextStyle.TextFormat = TextFormat.XML; header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); header.TextStyle.StringFormatStyle.HorzAlign = HorzAlign.Left; header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; header.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL( new NLength(7, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); m_Chart = nChartControl1.Charts[0]; m_Chart.BoundsMode = BoundsMode.Stretch; m_Chart.Location = new NPointL( new NLength(7, NRelativeUnit.ParentPercentage), new NLength(18, NRelativeUnit.ParentPercentage)); m_Chart.Size = new NSizeL( new NLength(86, NRelativeUnit.ParentPercentage), new NLength(75, NRelativeUnit.ParentPercentage)); // configure scales NLinearScaleConfigurator yScaleConfigurator = (NLinearScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; NScaleStripStyle yStripStyle = new NScaleStripStyle(new NColorFillStyle(Color.FromArgb(40, Color.LightGray)), null, true, 0, 0, 1, 1); yStripStyle.SetShowAtWall(ChartWallType.Back, true); yStripStyle.Interlaced = true; yScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); yScaleConfigurator.StripStyles.Add(yStripStyle); NLinearScaleConfigurator xScaleConfigurator = new NLinearScaleConfigurator(); NScaleStripStyle xStripStyle = new NScaleStripStyle(new NColorFillStyle(Color.FromArgb(40, Color.LightGray)), null, true, 0, 0, 1, 1); xStripStyle.SetShowAtWall(ChartWallType.Back, true); xStripStyle.Interlaced = true; xScaleConfigurator.StripStyles.Add(xStripStyle); xScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = xScaleConfigurator; // cross X and Y axes m_Chart.Axis(StandardAxis.PrimaryX).Anchor = new NCrossAxisAnchor(AxisOrientation.Horizontal, new NValueAxisCrossing(m_Chart.Axis(StandardAxis.PrimaryY), 0)); m_Chart.Axis(StandardAxis.PrimaryX).Anchor.RulerOrientation = RulerOrientation.Right; m_Chart.Axis(StandardAxis.PrimaryY).Anchor = new NCrossAxisAnchor(AxisOrientation.Vertical, new NValueAxisCrossing(m_Chart.Axis(StandardAxis.PrimaryX), 0)); m_Chart.Axis(StandardAxis.Depth).Visible = false; m_Chart.Wall(ChartWallType.Floor).Visible = false; m_Chart.Wall(ChartWallType.Left).Visible = false; // setup bubble series NBubbleSeries bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble); bubble.Name = "Bubble Series"; bubble.InflateMargins = true; bubble.DataLabelStyle.Visible = false; bubble.UseXValues = true; bubble.ShadowStyle.Type = ShadowType.GaussianBlur; bubble.BubbleShape = PointShape.Sphere; bubble.Legend.Mode = SeriesLegendMode.None; // fill with random data bubble.Values.FillRandomRange(Random, 10, -20, 20); bubble.XValues.FillRandomRange(Random, 10, -20, 20); bubble.Sizes.FillRandomRange(Random, 10, 1, 6); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); UpdateCrossings(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithPercents(LineDepthDropDownList, 10); LineDepthDropDownList.SelectedIndex = 3; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Settings.JitterMode = JitterMode.Enabled; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Multi Series Line"); 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 = true; chart.Width = 70; chart.Height = 30; chart.Depth = 50; chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); // add interlace stripe NLinearScaleConfigurator linearScale = 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 X axis NOrdinalScaleConfigurator ordinalScaleConfigurator = (NOrdinalScaleConfigurator)chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator; ordinalScaleConfigurator.DisplayDataPointsBetweenTicks = false; ordinalScaleConfigurator.MajorTickMode = MajorTickMode.AutoMaxCount; ordinalScaleConfigurator.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; ordinalScaleConfigurator.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back, ChartWallType.Floor }; // add the first line NLineSeries line1 = (NLineSeries)chart.Series.Add(SeriesType.Line); line1.MultiLineMode = MultiLineMode.Series; line1.LineSegmentShape = LineSegmentShape.Tape; line1.Legend.TextStyle.FontStyle.EmSize = new NLength(8); line1.DataLabelStyle.Visible = false; line1.Name = "Line1"; // add the second line NLineSeries line2 = (NLineSeries)chart.Series.Add(SeriesType.Line); line2.MultiLineMode = MultiLineMode.Series; line2.LineSegmentShape = LineSegmentShape.Tape; line2.Legend.TextStyle.FontStyle.EmSize = new NLength(8); line2.DataLabelStyle.Visible = false; line2.Name = "Line2"; // add the third line NLineSeries line3 = (NLineSeries)chart.Series.Add(SeriesType.Line); line3.MultiLineMode = MultiLineMode.Series; line3.LineSegmentShape = LineSegmentShape.Tape; line3.Legend.TextStyle.FontStyle.EmSize = new NLength(8); line3.DataLabelStyle.Visible = false; line3.Name = "Line3"; // fill with random data line1.Values.FillRandom(Random, 7); line2.Values.FillRandom(Random, 7); line3.Values.FillRandom(Random, 7); line1.DepthPercent = LineDepthDropDownList.SelectedIndex * 10; line2.DepthPercent = LineDepthDropDownList.SelectedIndex * 10; line3.DepthPercent = LineDepthDropDownList.SelectedIndex * 10; // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { LabelTextBox.Text = "Chart Title"; WebExamplesUtilities.FillComboWithPercents(HorizontalMarginDropDownList, 10); HorizontalMarginDropDownList.SelectedIndex = 5; WebExamplesUtilities.FillComboWithPercents(VerticalMarginDropDownList, 10); VerticalMarginDropDownList.SelectedIndex = 1; ContentAlignmentDropDownList.Items.Add("BottomCenter"); ContentAlignmentDropDownList.Items.Add("BottomLeft"); ContentAlignmentDropDownList.Items.Add("BottomRight"); ContentAlignmentDropDownList.Items.Add("MiddleCenter"); ContentAlignmentDropDownList.Items.Add("MiddleLeft"); ContentAlignmentDropDownList.Items.Add("MiddleRight"); ContentAlignmentDropDownList.Items.Add("TopCenter"); ContentAlignmentDropDownList.Items.Add("TopLeft"); ContentAlignmentDropDownList.Items.Add("TopRight"); ContentAlignmentDropDownList.SelectedIndex = 0; WebExamplesUtilities.FillComboWithFontNames(FontDropDownList, "Arial"); WebExamplesUtilities.FillComboWithValues(FontSizeDropDownList, 8, 52, 1); FontSizeDropDownList.SelectedIndex = 2; WebExamplesUtilities.FillComboWithColorNames(FontColorDropDownList, KnownColor.Black); WebExamplesUtilities.FillComboWithValues(FontOrientationDropDownList, 0, 360, 10); HasBackplaneCheckBox.Checked = true; BackplaneStyleDropDownList.Items.Add("Rectangle"); BackplaneStyleDropDownList.Items.Add("Ellipse"); BackplaneStyleDropDownList.Items.Add("Circle"); BackplaneStyleDropDownList.Items.Add("Cut Edge Rectangle"); BackplaneStyleDropDownList.Items.Add("Smooth Edge Rectangle"); BackplaneStyleDropDownList.SelectedIndex = 0; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // setup the label NLabel label = new NLabel(); nChartControl1.Panels.Add(label); label.Text = LabelTextBox.Text; label.TextStyle.FillStyle = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(FontColorDropDownList)); label.TextStyle.Orientation = FontOrientationDropDownList.SelectedIndex * 10; label.TextStyle.BackplaneStyle.Visible = HasBackplaneCheckBox.Checked; label.ContentAlignment = (ContentAlignment)Enum.Parse(typeof(ContentAlignment), ContentAlignmentDropDownList.SelectedItem.Text); label.Location = new NPointL( new NLength(HorizontalMarginDropDownList.SelectedIndex * 10, NRelativeUnit.ParentPercentage), new NLength(VerticalMarginDropDownList.SelectedIndex * 10, NRelativeUnit.ParentPercentage)); try { label.TextStyle.FontStyle = new NFontStyle(FontDropDownList.SelectedItem.Text, FontSizeDropDownList.SelectedIndex + 8);; } catch { } BackplaneStyleDropDownList.Enabled = HasBackplaneCheckBox.Checked; if (HasBackplaneCheckBox.Checked) { label.TextStyle.BackplaneStyle.Shape = (BackplaneShape)BackplaneStyleDropDownList.SelectedIndex; } // no legend nChartControl1.Legends.Clear(); // setup the chart NChart chart = nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Fit; chart.Axis(StandardAxis.PrimaryX).Visible = false; chart.Axis(StandardAxis.PrimaryY).Visible = false; chart.Location = new NPointL( new NLength(15, NRelativeUnit.ParentPercentage), new NLength(20, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL( new NLength(70, NRelativeUnit.ParentPercentage), new NLength(60, NRelativeUnit.ParentPercentage)); NBarSeries series = (NBarSeries)chart.Series.Add(SeriesType.Bar); series.DataLabelStyle.Visible = false; series.Values.AddRange(new double[] { 16, 42, 56, 23, 47, 38 }); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(series); }
protected void Page_Load(object sender, EventArgs e) { if (!nChartControl1.Initialized) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Settings.JitterMode = JitterMode.Enabled; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Intersected Surfaces"); 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.Width = 65.0f; chart.Depth = 65.0f; chart.Height = 30.0f; chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); // setup Y axis NLinearScaleConfigurator linearScaleConfigurator = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; linearScaleConfigurator.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 8); // 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); // setup X axis linearScaleConfigurator = new NLinearScaleConfigurator(); linearScaleConfigurator.RoundToTickMin = false; linearScaleConfigurator.RoundToTickMax = false; linearScaleConfigurator.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 8); linearScaleConfigurator.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Back }; chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScaleConfigurator; // setup Z axis linearScaleConfigurator = new NLinearScaleConfigurator(); linearScaleConfigurator.RoundToTickMin = false; linearScaleConfigurator.RoundToTickMax = false; linearScaleConfigurator.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 8); linearScaleConfigurator.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Left }; chart.Axis(StandardAxis.Depth).ScaleConfigurator = linearScaleConfigurator; // setup surface series 1 NMeshSurfaceSeries surface1 = (NMeshSurfaceSeries)chart.Series.Add(SeriesType.MeshSurface); surface1.Name = "Surface 1"; surface1.FillMode = SurfaceFillMode.Zone; surface1.FrameMode = SurfaceFrameMode.MeshContour; surface1.FrameColorMode = SurfaceFrameColorMode.Zone; surface1.SmoothPalette = true; surface1.Legend.Mode = SeriesLegendMode.None; surface1.FillStyle.SetTransparencyPercent(50); surface1.Data.SetGridSize(20, 20); surface1.ShadingMode = ShadingMode.Smooth; FillData1(surface1); // setup surface series 2 NMeshSurfaceSeries surface2 = (NMeshSurfaceSeries)chart.Series.Add(SeriesType.MeshSurface); surface2.Name = "Surface 2"; surface2.FillMode = SurfaceFillMode.Zone; surface2.FrameMode = SurfaceFrameMode.MeshContour; surface2.FrameColorMode = SurfaceFrameColorMode.Zone; surface2.SmoothPalette = true; surface2.Legend.Mode = SeriesLegendMode.None; surface2.Data.SetGridSize(20, 20); surface2.ShadingMode = ShadingMode.Smooth; FillData2(surface2); nChartControl1.Controller.SetActivePanel(chart); nChartControl1.Controller.Tools.Add(new NTrackballTool()); } if (!IsPostBack) { WebExamplesUtilities.FillComboWithPercents(TransparencyDropDownList, 10); TransparencyDropDownList.SelectedIndex = 5; } UpdateSurface(); }