protected void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { LineStudyDropDownList.Items.Add("Fibonacci Arcs"); LineStudyDropDownList.Items.Add("Fibonacci Fans"); LineStudyDropDownList.Items.Add("Fibonacci Retracements"); LineStudyDropDownList.Items.Add("Speed Resistance Lines"); LineStudyDropDownList.Items.Add("Quadrant Lines"); LineStudyDropDownList.Items.Add("Trend Line"); WebExamplesUtilities.FillComboWithEnumValues(TrendlineModeDropDownList, typeof(TrendLineMode)); // form controls LineStudyDropDownList.SelectedIndex = 0; TrendlineModeDropDownList.SelectedIndex = 1; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = new NLabel(); title.Text = "Line Studies - " + LineStudyDropDownList.SelectedItem.Text; title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; nChartControl1.Panels.Add(title); // no legend nChartControl1.Legends.Clear(); // setup chart NChart chart = nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; // setup X axis NAxis axis = chart.Axis(StandardAxis.PrimaryX); NDateTimeScaleConfigurator timeScaleConfigurator = new NDateTimeScaleConfigurator(); axis.ScaleConfigurator = timeScaleConfigurator; timeScaleConfigurator.EnableUnitSensitiveFormatting = false; timeScaleConfigurator.LabelValueFormatter = new NDateTimeValueFormatter("MMM yy"); timeScaleConfigurator.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; timeScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); timeScaleConfigurator.InnerMajorTickStyle.LineStyle.Width = new NLength(0, NGraphicsUnit.Pixel); timeScaleConfigurator.RoundToTickMin = false; timeScaleConfigurator.RoundToTickMax = false; timeScaleConfigurator.LabelGenerationMode = LabelGenerationMode.SingleLevel; // setup Y axis axis = chart.Axis(StandardAxis.PrimaryY); NLinearScaleConfigurator linearScaleConfigurator = (NLinearScaleConfigurator)axis.ScaleConfigurator; linearScaleConfigurator.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Left, false); linearScaleConfigurator.InnerMajorTickStyle.LineStyle.Width = new NLength(0, NGraphicsUnit.Pixel); // 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); linearScaleConfigurator.StripStyles.Add(stripStyle); Color customColor = Color.FromArgb(150, 150, 200); // setup the stock series NStockSeries stock = (NStockSeries)chart.Series.Add(SeriesType.Stock); stock.DataLabelStyle.Visible = false; stock.CandleStyle = CandleStyle.Bar; stock.CandleWidth = new NLength(0.3f, NRelativeUnit.ParentPercentage); stock.HighLowStrokeStyle.Color = customColor; stock.UpStrokeStyle.Width = new NLength(0); stock.DownStrokeStyle.Width = new NLength(0); stock.UpFillStyle = new NColorFillStyle(Color.LightGreen); stock.DownFillStyle = new NColorFillStyle(customColor); stock.UseXValues = true; stock.InflateMargins = true; GenerateData(stock); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); // create line study NLineStudy lineStudy = null; Color lineColor = Color.Crimson; switch (LineStudyDropDownList.SelectedIndex) { case 0: lineStudy = new NFibonacciArcs(); break; case 1: lineStudy = new NFibonacciFans(); break; case 2: lineStudy = new NFibonacciRetracements(); ((NFibonacciRetracements)lineStudy).RetracementsStrokeStyle.Color = lineColor; break; case 3: lineStudy = new NSpeedResistanceLines(); break; case 4: lineStudy = new NQuadrantLines(); ((NQuadrantLines)lineStudy).CentralLineStrokeStyle.Color = lineColor; break; case 5: lineStudy = new NTrendLine(); break; default: return; } // attach the line study to the stock series lineStudy.BeginPoint = GetLowPointFromStock(stock, 20); lineStudy.EndPoint = GetHighPointFromStock(stock, 80); // set the primary line color lineStudy.StrokeStyle.Color = lineColor; InsertFinancialMarker(chart, lineStudy); TrendlineModeDropDownList.Enabled = lineStudy is NTrendLine; // set trend line mode NTrendLine trend = chart.Series[0] as NTrendLine; lineStudy.TrendLineMode = (TrendLineMode)TrendlineModeDropDownList.SelectedIndex; // set text visibility lineStudy.ShowTexts = ShowTextsCheckBox.Checked; }
protected void Page_Load(object sender, System.EventArgs e) { nChartControl1.Settings.JitterMode = JitterMode.Enabled; nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("3D Funnel Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; title.ContentAlignment = ContentAlignment.BottomRight; title.Location = new NPointL( new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); NLegend legend = nChartControl1.Legends[0]; legend.SetPredefinedLegendStyle(PredefinedLegendStyle.BottomRight); NFunnelChart chart = new NFunnelChart(); chart.BoundsMode = BoundsMode.Fit; chart.Location = new NPointL(new NLength(5, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL(new NLength(85, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage)); chart.Enable3D = true; chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.NorthernLights); chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective); chart.Projection.Elevation = 18; nChartControl1.Charts.Clear(); nChartControl1.Charts.Add(chart); NFunnelSeries funnel = (NFunnelSeries)chart.Series.Add(SeriesType.Funnel); funnel.BorderStyle.Color = Color.LemonChiffon; funnel.Legend.DisplayOnLegend = legend; funnel.Legend.Mode = SeriesLegendMode.DataPoints; funnel.DataLabelStyle.Format = "<percent>"; funnel.Values.Add(20.0); funnel.Values.Add(10.0); funnel.Values.Add(15.0); funnel.Values.Add(7.0); funnel.Values.Add(28.0); funnel.Labels.Add("Awareness"); funnel.Labels.Add("First Hear"); funnel.Labels.Add("Further Learn"); funnel.Labels.Add("Liking"); funnel.Labels.Add("Decision"); NChartPalette palette = new NChartPalette(ChartPredefinedPalette.Bright); for (int i = 0; i < funnel.Values.Count; i++) { funnel.FillStyles[i] = palette.SeriesColors[i % palette.SeriesColors.Count]; } if (!IsPostBack) { // init form controls WebExamplesUtilities.FillComboWithEnumValues(FunnelLabelModeDropDownList, typeof(FunnelLabelMode)); FunnelLabelModeDropDownList.SelectedIndex = 0; WebExamplesUtilities.FillComboWithValues(FunnelRadiusDropDownList, 0, 100, 10); FunnelRadiusDropDownList.SelectedIndex = (int)(chart.Width / 10); WebExamplesUtilities.FillComboWithValues(FunnelPointGapDropDownList, 0, 100, 10); FunnelPointGapDropDownList.SelectedIndex = (int)(funnel.FunnelPointGap / 10); WebExamplesUtilities.FillComboWithValues(NeckWidthDropDownList, 0, 100, 10); NeckWidthDropDownList.SelectedIndex = (int)(funnel.NeckWidthPercent / 10); WebExamplesUtilities.FillComboWithValues(NeckHeightDropDownList, 0, 100, 10); NeckHeightDropDownList.SelectedIndex = (int)(funnel.NeckHeightPercent / 10); WebExamplesUtilities.FillComboWithValues(LabelArrowLengthDropDownList, 0, 10, 1); LabelArrowLengthDropDownList.SelectedIndex = (int)(funnel.DataLabelStyle.ArrowLength.Value); } SetLabelMode(funnel); // set funnel arrow length funnel.DataLabelStyle.ArrowLength = new NLength((float)(LabelArrowLengthDropDownList.SelectedIndex), NRelativeUnit.ParentPercentage); // set funnel radius nChartControl1.Charts[0].Width = FunnelRadiusDropDownList.SelectedIndex * 10.0f; // set funnel gap funnel.FunnelPointGap = FunnelPointGapDropDownList.SelectedIndex; // set neck width funnel.NeckWidthPercent = NeckWidthDropDownList.SelectedIndex * 10.0f; // set neck height funnel.NeckHeightPercent = NeckHeightDropDownList.SelectedIndex * 10.0f; }
protected void Page_Load(object sender, EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Panels.Clear(); // set a chart title NLabel header = new NLabel("Axis Ruler Caps<br/> <font size = '9pt'>Demonstrates how to change the caps of the axis ruler</font>"); header.DockMode = PanelDockMode.Top; header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; header.TextStyle.TextFormat = TextFormat.XML; header.TextStyle.StringFormatStyle.HorzAlign = HorzAlign.Left; header.FitAlignment = ContentAlignment.MiddleLeft; header.Margins = new NMarginsL(5, 0, 0, 5); nChartControl1.Panels.Add(header); NCartesianChart chart = new NCartesianChart(); chart.DockMode = PanelDockMode.Fill; chart.BoundsMode = BoundsMode.Stretch; chart.Margins = new NMarginsL(5, 10, 10, 5); nChartControl1.Panels.Add(chart); Random random = new Random(); // feed some random data NPointSeries point = new NPointSeries(); point.DataLabelStyle.Visible = false; point.UseXValues = true; point.Size = new NLength(5); point.BorderStyle.Width = new NLength(0); // fill in some random data for (int j = 0; j < 30; j++) { point.Values.Add(5 + random.Next(90)); point.XValues.Add(5 + random.Next(90)); } chart.Series.Add(point); // configure scales NLinearScaleConfigurator xScale = new NLinearScaleConfigurator(); xScale.RoundToTickMax = true; xScale.RoundToTickMin = true; xScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); xScale.ScaleBreaks.Add(new NCustomScaleBreak(new NLineScaleBreakStyle(new NColorFillStyle(Color.FromArgb(124, Color.Orange)), null, new NLength(10)), new NRange1DD(29, 41))); // add an interlaced strip to the X axis NScaleStripStyle xInterlacedStrip = new NScaleStripStyle(); xInterlacedStrip.SetShowAtWall(ChartWallType.Back, true); xInterlacedStrip.Interlaced = true; xInterlacedStrip.FillStyle = new NColorFillStyle(Color.FromArgb(40, Color.LightGray)); xScale.StripStyles.Add(xInterlacedStrip); NCartesianAxis xAxis = (NCartesianAxis)chart.Axis(StandardAxis.PrimaryX); xAxis.ScaleConfigurator = xScale; xAxis.View = new NRangeAxisView(new NRange1DD(0, 100)); NDockAxisAnchor xAxisAnchor = new NDockAxisAnchor(AxisDockZone.FrontBottom); xAxisAnchor.BeforeSpace = new NLength(10); xAxis.Anchor = xAxisAnchor; NLinearScaleConfigurator yScale = new NLinearScaleConfigurator(); yScale.RoundToTickMax = true; yScale.RoundToTickMin = true; yScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); yScale.ScaleBreaks.Add(new NCustomScaleBreak(new NLineScaleBreakStyle(new NColorFillStyle(Color.FromArgb(124, Color.Orange)), null, new NLength(10)), new NRange1DD(29, 41))); // add an interlaced strip to the Y axis NScaleStripStyle yInterlacedStrip = new NScaleStripStyle(); yInterlacedStrip.SetShowAtWall(ChartWallType.Back, true); yInterlacedStrip.Interlaced = true; yInterlacedStrip.FillStyle = new NColorFillStyle(Color.FromArgb(40, Color.LightGray)); yScale.StripStyles.Add(yInterlacedStrip); NCartesianAxis yAxis = (NCartesianAxis)chart.Axis(StandardAxis.PrimaryY); yAxis.ScaleConfigurator = yScale; yAxis.View = new NRangeAxisView(new NRange1DD(0, 100)); NDockAxisAnchor yAxisAnchor = new NDockAxisAnchor(AxisDockZone.FrontLeft); yAxisAnchor.BeforeSpace = new NLength(10); yAxis.Anchor = yAxisAnchor; // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // update form controls if (!IsPostBack) { PaintOnScaleBreaksCheckBox.Checked = false; WebExamplesUtilities.FillComboWithEnumValues(BeginCapStyleDropDownList, typeof(CapStyle)); BeginCapStyleDropDownList.SelectedIndex = (int)CapStyle.Ellipse; WebExamplesUtilities.FillComboWithEnumValues(ScaleBreakCapStyleDropDownList, typeof(CapStyle)); ScaleBreakCapStyleDropDownList.SelectedIndex = (int)CapStyle.LeftCrossLine; WebExamplesUtilities.FillComboWithEnumValues(EndCapStyleDropDownList, typeof(CapStyle)); EndCapStyleDropDownList.SelectedIndex = (int)CapStyle.Arrow; } UpdateRulerStyleForAxis(xAxis); UpdateRulerStyleForAxis(yAxis); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithEnumValues(ShapeStyleDropDownList, typeof(BarShape)); ShapeStyleDropDownList.SelectedIndex = 0; WebExamplesUtilities.FillComboWithColorNames(ShapesColorDropDownList, KnownColor.DarkOrange); WebExamplesUtilities.FillComboWithPredefinedProjections(ProjectionDropDownList); ProjectionDropDownList.SelectedIndex = (int)PredefinedProjection.PerspectiveTilted; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Shape Series"); 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.Depth = 50; chart.Projection.SetPredefinedProjection((PredefinedProjection)ProjectionDropDownList.SelectedIndex); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); // setup X axis NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator(); chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; scaleX.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back, ChartWallType.Floor }; scaleX.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; // setup Y axis NLinearScaleConfigurator scaleY = new NLinearScaleConfigurator(); chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = scaleY; scaleY.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back, ChartWallType.Left }; scaleY.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; // add interlaced stripe NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back, ChartWallType.Left }; stripStyle.Interlaced = true; scaleY.StripStyles.Add(stripStyle); // setup Z axis NLinearScaleConfigurator scaleZ = new NLinearScaleConfigurator(); chart.Axis(StandardAxis.Depth).ScaleConfigurator = scaleZ; scaleZ.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Left, ChartWallType.Floor }; scaleZ.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; // setup shape series NShapeSeries shape = (NShapeSeries)chart.Series.Add(SeriesType.Shape); shape.Name = "Shape Series"; shape.DataLabelStyle.Visible = false; // populate with random data shape.Values.FillRandomRange(Random, 10, -100, 100); shape.XValues.FillRandomRange(Random, 10, -100, 100); shape.ZValues.FillRandomRange(Random, 10, -100, 100); shape.YSizes.FillRandomRange(Random, 10, 5, 20); shape.XSizes.FillRandomRange(Random, 10, 5, 20); shape.ZSizes.FillRandomRange(Random, 10, 5, 20); shape.Shape = (BarShape)ShapeStyleDropDownList.SelectedIndex; shape.FillStyle = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(ShapesColorDropDownList)); shape.UseXValues = UseXValueCheckBox.Checked; shape.UseZValues = UseZValueCheckBox.Checked; if (DifferentColorsCheckBox.Checked) { ShapesColorDropDownList.Enabled = false; NChartPalette palette = new NChartPalette(); palette.SetPredefinedPalette(ChartPredefinedPalette.Nevron); for (int i = 0; i < shape.Values.Count; i++) { shape.FillStyles[i] = new NColorFillStyle(palette.SeriesColors[i % palette.SeriesColors.Count]); } } else { ShapesColorDropDownList.Enabled = true; shape.FillStyles.Clear(); shape.FillStyle = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(ShapesColorDropDownList)); } // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); }
protected void Page_Load(object sender, System.EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Panels.Clear(); // set a chart title NLabel header = new NLabel("Gauge Axis Scale Appearance"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; header.Location = new NPointL(new NLength(3, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); nChartControl1.Panels.Add(header); // create the radial gauge NRadialGaugePanel radialGauge = new NRadialGaugePanel(); radialGauge.ContentAlignment = ContentAlignment.MiddleCenter; radialGauge.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(52, NRelativeUnit.ParentPercentage)); radialGauge.Size = new NSizeL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(85, NRelativeUnit.ParentPercentage)); radialGauge.BackgroundFillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Gray); radialGauge.BorderStyle = new NEdgeBorderStyle(BorderShape.Auto); radialGauge.PaintEffect = new NGlassEffectStyle(); nChartControl1.Panels.Add(radialGauge); NGaugeAxis axis = (NGaugeAxis)radialGauge.Axes[0]; NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator; scale.MinorTickCount = 3; NRangeIndicator indicator1 = new NRangeIndicator(); indicator1.Value = 80; indicator1.OriginMode = OriginMode.ScaleMax; indicator1.FillStyle = new NColorFillStyle(Color.Red); indicator1.StrokeStyle.Color = Color.DarkRed; radialGauge.Indicators.Add(indicator1); NNeedleValueIndicator indicator2 = new NNeedleValueIndicator(); indicator2.Value = 79; indicator2.Shape.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red); indicator2.Shape.StrokeStyle.Color = Color.Red; radialGauge.Indicators.Add(indicator2); radialGauge.SweepAngle = 270; if (!IsPostBack) { WebExamplesUtilities.FillComboWithEnumValues(ScaleStyleDropDownList, typeof(PredefinedScaleStyle)); ScaleStyleDropDownList.SelectedIndex = 0; } PredefinedScaleStyle scaleStyle = (PredefinedScaleStyle)ScaleStyleDropDownList.SelectedIndex; scale.SetPredefinedScaleStyle(scaleStyle); switch (scaleStyle) { case PredefinedScaleStyle.Standard: case PredefinedScaleStyle.Scientific: break; case PredefinedScaleStyle.Presentation: scale.RulerStyle.FillStyle = new NGradientFillStyle(Color.White, Color.CadetBlue); scale.OuterMajorTickStyle.FillStyle = new NGradientFillStyle(Color.White, Color.Green); scale.OuterMajorTickStyle.LineStyle.Color = Color.DarkGreen; break; case PredefinedScaleStyle.PresentationNoStroke: scale.RulerStyle.FillStyle = new NGradientFillStyle(Color.White, Color.CadetBlue); scale.OuterMajorTickStyle.FillStyle = new NGradientFillStyle(Color.White, Color.Green); break; case PredefinedScaleStyle.Watch: scale.OuterMajorTickStyle.FillStyle = new NGradientFillStyle(Color.White, Color.Green); scale.OuterMajorTickStyle.LineStyle.Color = Color.DarkGreen; break; case PredefinedScaleStyle.Ruler: break; } }
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; } }
protected void Page_Load(object sender, System.EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Funnel Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; title.ContentAlignment = ContentAlignment.BottomRight; title.Location = new NPointL( new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // setup legend NLegend legend = nChartControl1.Legends[0]; legend.SetPredefinedLegendStyle(PredefinedLegendStyle.BottomRight); // setup chart NFunnelChart chart = new NFunnelChart(); chart.BoundsMode = BoundsMode.Fit; chart.Location = new NPointL( new NLength(10, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL( new NLength(80, NRelativeUnit.ParentPercentage), new NLength(75, NRelativeUnit.ParentPercentage)); nChartControl1.Charts.Clear(); nChartControl1.Charts.Add(chart); NFunnelSeries funnel = (NFunnelSeries)chart.Series.Add(SeriesType.Funnel); funnel.BorderStyle.Color = Color.LemonChiffon; funnel.Legend.DisplayOnLegend = legend; funnel.Legend.Mode = SeriesLegendMode.DataPoints; funnel.DataLabelStyle.Format = "<percent>"; funnel.ShadowStyle.Type = ShadowType.GaussianBlur; funnel.ShadowStyle.Color = Color.FromArgb(50, 0, 0, 0); funnel.ShadowStyle.Offset = new NPointL(5, 5); funnel.ShadowStyle.FadeLength = new NLength(6); funnel.Values.Add(20.0); funnel.Values.Add(10.0); funnel.Values.Add(15.0); funnel.Values.Add(7.0); funnel.Values.Add(28.0); funnel.Labels.Add("Awareness"); funnel.Labels.Add("First Hear"); funnel.Labels.Add("Further Learn"); funnel.Labels.Add("Liking"); funnel.Labels.Add("Decision"); funnel.FillStyles[0] = new NColorFillStyle(Color.FromArgb(169, 121, 11)); funnel.FillStyles[1] = new NColorFillStyle(Color.FromArgb(157, 157, 92)); funnel.FillStyles[2] = new NColorFillStyle(Color.FromArgb(98, 152, 92)); funnel.FillStyles[3] = new NColorFillStyle(Color.FromArgb(111, 134, 181)); funnel.FillStyles[4] = new NColorFillStyle(Color.FromArgb(179, 63, 92)); if (!IsPostBack) { // init form controls WebExamplesUtilities.FillComboWithEnumValues(FunnelLabelModeDropDownList, typeof(FunnelLabelMode)); FunnelLabelModeDropDownList.SelectedIndex = 0; WebExamplesUtilities.FillComboWithValues(FunnelRadiusDropDownList, 0, 100, 10); FunnelRadiusDropDownList.SelectedIndex = (int)(chart.Width / 10); WebExamplesUtilities.FillComboWithValues(FunnelPointGapDropDownList, 0, 100, 10); FunnelPointGapDropDownList.SelectedIndex = (int)(funnel.FunnelPointGap / 10); WebExamplesUtilities.FillComboWithValues(NeckWidthDropDownList, 0, 100, 10); NeckWidthDropDownList.SelectedIndex = (int)(funnel.NeckWidthPercent / 10); WebExamplesUtilities.FillComboWithValues(NeckHeightDropDownList, 0, 100, 10); NeckHeightDropDownList.SelectedIndex = (int)(funnel.NeckHeightPercent / 10); WebExamplesUtilities.FillComboWithValues(LabelArrowLengthDropDownList, 0, 10, 1); LabelArrowLengthDropDownList.SelectedIndex = (int)(funnel.DataLabelStyle.ArrowLength.Value); } SetLabelMode(funnel); // set funnel arrow length funnel.DataLabelStyle.ArrowLength = new NLength((float)(LabelArrowLengthDropDownList.SelectedIndex), NRelativeUnit.ParentPercentage); // set funnel radius nChartControl1.Charts[0].Width = FunnelRadiusDropDownList.SelectedIndex * 10.0f; // set funnel gap funnel.FunnelPointGap = FunnelPointGapDropDownList.SelectedIndex; // set neck width funnel.NeckWidthPercent = NeckWidthDropDownList.SelectedIndex * 10.0f; // set neck height funnel.NeckHeightPercent = NeckHeightDropDownList.SelectedIndex * 10.0f; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithEnumValues(ViewRangeInflateModeDropDownList, typeof(ScaleViewRangeInflateMode)); ViewRangeInflateModeDropDownList.SelectedIndex = (int)ScaleViewRangeInflateMode.MajorTick; InflateMinCheckBox.Checked = true; InflateMaxCheckBox.Checked = true; WebExamplesUtilities.FillComboWithValues(LogicalInflateMinMaxDropDownList, 0, 200, 10); WebExamplesUtilities.FillComboWithValues(AbsoluteInflateMinMaxDropDownList, 0, 20, 2); } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Panels.Clear(); // set a chart title NLabel header = new NLabel("Volume Change vs. Last Year<br/> <font size = '9pt'>Demonstrates different view range modes</font>"); header.TextStyle.TextFormat = TextFormat.XML; header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; header.DockMode = PanelDockMode.Top; header.TextStyle.StringFormatStyle.HorzAlign = HorzAlign.Center; header.Margins = new NMarginsL(10, 2, 10, 10); nChartControl1.Panels.Add(header); // add some data to the control NCartesianChart chart = new NCartesianChart(); chart.DockMode = PanelDockMode.Fill; chart.BoundsMode = BoundsMode.Stretch; NBarSeries bar = new NBarSeries(); bar.DataLabelStyle.Visible = false; NChartPalette palette = new NChartPalette(ChartPredefinedPalette.Nevron); bar.Values.Add(100); bar.FillStyles[0] = new NColorFillStyle(palette.SeriesColors[0]); bar.Values.Add(200); bar.FillStyles[1] = new NColorFillStyle(palette.SeriesColors[0]); bar.Values.Add(-180); bar.FillStyles[3] = new NColorFillStyle(palette.SeriesColors[1]); bar.Values.Add(200); bar.FillStyles[4] = new NColorFillStyle(palette.SeriesColors[1]); bar.Values.Add(400); bar.FillStyles[5] = new NColorFillStyle(palette.SeriesColors[1]); chart.Series.Add(bar); chart.Margins = new NMarginsL(10, 0, 10, 10); // configure y axis 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); // configure the x axis NHierarchicalScaleConfigurator hierarchicalScale = new NHierarchicalScaleConfigurator(); hierarchicalScale.CreateSeparatorForEachLevel = false; // create utilization group NHierarchicalScaleNode utilization = new NHierarchicalScaleNode(0, "Cash Utilisation"); utilization.LabelStyle.TickMode = RangeLabelTickMode.Separators; utilization.LabelStyle.TextStyle.FontStyle.EmSize = new NLength(11); utilization.LabelStyle.TextStyle.FontStyle.Style = FontStyle.Bold; utilization.ChildNodes.Add(CreateSubScaleNode("Cash at ATM", true, false)); utilization.ChildNodes.Add(CreateSubScaleNode("Cash at desk", true, false)); hierarchicalScale.Nodes.Add(utilization); // create payments group NHierarchicalScaleNode payments = new NHierarchicalScaleNode(0, "Payments"); payments.LabelStyle.TickMode = RangeLabelTickMode.Separators; payments.LabelStyle.TextStyle.FontStyle.EmSize = new NLength(11); payments.LabelStyle.TextStyle.FontStyle.Style = FontStyle.Bold; payments.ChildNodes.Add(CreateSubScaleNode("Cheque", true, false)); payments.ChildNodes.Add(CreateSubScaleNode("Direct debit", true, false)); payments.ChildNodes.Add(CreateSubScaleNode("Wire transfer", true, true)); hierarchicalScale.Nodes.Add(payments); chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = hierarchicalScale; nChartControl1.Panels.Add(chart); // update form controls NAxis yAxis = nChartControl1.Charts[0].Axis(StandardAxis.PrimaryY); NNumericScaleConfigurator scale = (NNumericScaleConfigurator)yAxis.ScaleConfigurator; scale.Title.Text = "Volume in Thousands USD"; scale.ViewRangeInflateMode = (ScaleViewRangeInflateMode)ViewRangeInflateModeDropDownList.SelectedIndex; scale.InflateViewRangeBegin = InflateMinCheckBox.Checked; scale.InflateViewRangeEnd = InflateMaxCheckBox.Checked; switch (scale.ViewRangeInflateMode) { case ScaleViewRangeInflateMode.MajorTick: break; case ScaleViewRangeInflateMode.Logical: double logicalInflate = LogicalInflateMinMaxDropDownList.SelectedIndex * 10; scale.LogicalInflate = new NRange1DD(logicalInflate, logicalInflate); break; case ScaleViewRangeInflateMode.Absolute: float absoluteInflate = AbsoluteInflateMinMaxDropDownList.SelectedIndex * 2; scale.AbsoluteInflate = new NRange1DL(new NLength(absoluteInflate, NGraphicsUnit.Point), new NLength(absoluteInflate, NGraphicsUnit.Point)); break; } // assign scale configurator to y axis yAxis.ScaleConfigurator = scale; // update controls state LogicalInflateMinMaxDropDownList.Enabled = scale.ViewRangeInflateMode == ScaleViewRangeInflateMode.Logical; AbsoluteInflateMinMaxDropDownList.Enabled = scale.ViewRangeInflateMode == ScaleViewRangeInflateMode.Absolute; }
protected void Page_Load(object sender, System.EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Panels.Clear(); // set a chart title NLabel header = new NLabel("Numeric Display"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; header.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL(new NLength(3, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); nChartControl1.Panels.Add(header); NDockPanel displayContainer = new NDockPanel(); displayContainer.Location = new NPointL( new NLength(10, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage)); displayContainer.Size = new NSizeL( new NLength(80, NRelativeUnit.ParentPercentage), new NLength(90, NRelativeUnit.ParentPercentage)); Random rand = new Random(); m_NumericDisplay1 = CreateDisplayPanel(); m_NumericDisplay1.Value = rand.Next(100) - 50; m_NumericDisplay2 = CreateDisplayPanel(); m_NumericDisplay2.Value = rand.Next(1000) - 500; m_NumericDisplay3 = CreateDisplayPanel(); m_NumericDisplay3.Value = rand.Next(10000) - 5000; displayContainer.ChildPanels.Add(m_NumericDisplay1); displayContainer.ChildPanels.Add(m_NumericDisplay2); displayContainer.ChildPanels.Add(m_NumericDisplay3); nChartControl1.Panels.Add(displayContainer); if (!IsPostBack) { WebExamplesUtilities.FillComboWithEnumValues(DisplayStyleDropDownList, typeof(DisplayStyle)); DisplayStyleDropDownList.SelectedIndex = (int)DisplayStyle.SevenSegmentRounded; WebExamplesUtilities.FillComboWithEnumValues(SignModeDropDownList, typeof(DisplaySignMode)); SignModeDropDownList.SelectedIndex = (int)DisplaySignMode.Always; } m_NumericDisplay1.DisplayStyle = (DisplayStyle)DisplayStyleDropDownList.SelectedIndex; m_NumericDisplay2.DisplayStyle = (DisplayStyle)DisplayStyleDropDownList.SelectedIndex; m_NumericDisplay3.DisplayStyle = (DisplayStyle)DisplayStyleDropDownList.SelectedIndex; m_NumericDisplay1.SignMode = (DisplaySignMode)SignModeDropDownList.SelectedIndex; m_NumericDisplay2.SignMode = (DisplaySignMode)SignModeDropDownList.SelectedIndex; m_NumericDisplay3.SignMode = (DisplaySignMode)SignModeDropDownList.SelectedIndex; m_NumericDisplay1.ShowLeadingZeros = ShowLeadingZerosCheckBox.Checked; m_NumericDisplay2.ShowLeadingZeros = ShowLeadingZerosCheckBox.Checked; m_NumericDisplay3.ShowLeadingZeros = ShowLeadingZerosCheckBox.Checked; m_NumericDisplay1.AttachSignToNumber = AttachSignToNumberCheckBox.Checked; m_NumericDisplay2.AttachSignToNumber = AttachSignToNumberCheckBox.Checked; m_NumericDisplay3.AttachSignToNumber = AttachSignToNumberCheckBox.Checked; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // init form controls WebExamplesUtilities.FillComboWithEnumValues(MarkerShapeDropDownList, typeof(PointShape)); MarkerShapeDropDownList.SelectedIndex = 0; ChartTypeDropDownList.Items.Add("Bar"); ChartTypeDropDownList.Items.Add("Line"); ChartTypeDropDownList.Items.Add("Area"); ChartTypeDropDownList.Items.Add("SmoothLine"); ChartTypeDropDownList.Items.Add("Point"); EmptyDataPointsValueModeDropDownList.Items.Add("Skip"); EmptyDataPointsValueModeDropDownList.Items.Add("Average"); EmptyDataPointsValueModeDropDownList.Items.Add("CustomValue"); EmptyDataPointsValueModeDropDownList.SelectedIndex = 0; EmptyDataPointsAppearanceDropDownList.Items.Add("None"); EmptyDataPointsAppearanceDropDownList.Items.Add("Normal"); EmptyDataPointsAppearanceDropDownList.Items.Add("Special"); EmptyDataPointsAppearanceDropDownList.SelectedIndex = 0; EmptyDataPointsMarkerModeDropDown.Items.Add("Normal Marker"); EmptyDataPointsMarkerModeDropDown.Items.Add("Special Marker"); WebExamplesUtilities.FillComboWithColorNames(EmptyDataPointsColorDropDownList, KnownColor.OrangeRed); WebExamplesUtilities.FillComboWithColorNames(MarkerColorDropDownList, KnownColor.OrangeRed); ShowMarkersCheckBox.Checked = false; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // add header NLabel header = nChartControl1.Labels.AddHeader("Empty Data Points"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; header.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL( new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // configure the chart NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.Width = 80.0f; chart.Height = 70.0f; chart.Axis(StandardAxis.Depth).Visible = false; chart.BoundsMode = BoundsMode.Stretch; chart.Location = new NPointL( new NLength(10, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL( new NLength(70, NRelativeUnit.ParentPercentage), new NLength(75, NRelativeUnit.ParentPercentage)); // configure the legend NLegend legend = nChartControl1.Legends[0]; legend.FillStyle = new NColorFillStyle(Color.FromArgb(125, 255, 255, 255)); // turn off legend grid lines 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.VerticalBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); legend.ContentAlignment = ContentAlignment.TopCenter; legend.Location = new NPointL( new NLength(88, NRelativeUnit.ParentPercentage), new NLength(70, NRelativeUnit.ParentPercentage)); UpdateSeriesType(); NSeries series = (NSeries)chart.Series[0]; series.MarkerStyle.Visible = ShowMarkersCheckBox.Checked; // update EDP value mode series.Values.EmptyDataPoints.ValueMode = (EmptyDataPointsValueMode)EmptyDataPointsValueModeDropDownList.SelectedIndex; series.Values.EmptyDataPoints.CustomValue = 0; // update EDP appearance mode series.EmptyDataPointsAppearance.AppearanceMode = (EmptyDataPointsAppearanceMode)EmptyDataPointsAppearanceDropDownList.SelectedIndex; // update EDP marker mode series.EmptyDataPointsAppearance.MarkerMode = (EmptyDataPointsMarkerMode)EmptyDataPointsMarkerModeDropDown.SelectedIndex; series.EmptyDataPointsAppearance.FillStyle = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(EmptyDataPointsColorDropDownList)); series.EmptyDataPointsAppearance.MarkerStyle.Visible = true; series.EmptyDataPointsAppearance.MarkerStyle.PointShape = (PointShape)MarkerShapeDropDownList.SelectedIndex; series.EmptyDataPointsAppearance.MarkerStyle.FillStyle = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(MarkerColorDropDownList)); series.EmptyDataPointsAppearance.MarkerStyle.Width = new NLength(2f, NRelativeUnit.ParentPercentage); series.EmptyDataPointsAppearance.MarkerStyle.Depth = new NLength(2f, NRelativeUnit.ParentPercentage); series.EmptyDataPointsAppearance.MarkerStyle.Height = new NLength(2f, NRelativeUnit.ParentPercentage); series.EmptyDataPointsAppearance.MarkerStyle.AutoDepth = true; }
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) { // init form controls ChartTypeCombo.Items.Add("Bar"); ChartTypeCombo.Items.Add("Line"); ChartTypeCombo.Items.Add("Area"); ChartTypeCombo.SelectedIndex = 0; WebExamplesUtilities.FillComboWithEnumValues(AnimationThemeTypeCombo, typeof(AnimationThemeType)); AnimationThemeTypeCombo.SelectedIndex = (int)AnimationThemeType.ScaleAndFade; WebExamplesUtilities.FillComboWithValues(AxesAnimationDurationCombo, 1, 10, 1); AxesAnimationDurationCombo.SelectedIndex = 2; WebExamplesUtilities.FillComboWithValues(WallsAnimationDurationCombo, 1, 10, 1); WallsAnimationDurationCombo.SelectedIndex = 2; WebExamplesUtilities.FillComboWithValues(SeriesAnimationDurationCombo, 1, 10, 1); SeriesAnimationDurationCombo.SelectedIndex = 2; } nChartControl1.Panels.Clear(); nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = new NLabel("Animation Themes"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.DockMode = PanelDockMode.Top; nChartControl1.Panels.Add(title); NDockPanel contentPanel = new NDockPanel(); nChartControl1.Panels.Add(contentPanel); contentPanel.DockMode = PanelDockMode.Fill; // configure the chart NCartesianChart chart = new NCartesianChart(); contentPanel.ChildPanels.Add(chart); chart.Location = new NPointL(0, 0); chart.Size = new NSizeL(new NLength(100, NRelativeUnit.ParentPercentage), new NLength(60, NRelativeUnit.ParentPercentage)); chart.Enable3D = false; chart.Axis(StandardAxis.Depth).Visible = false; chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.BrightCameraLight); chart.Margins = new NMarginsL(5, 5, 5, 5); chart.BoundsMode = BoundsMode.Stretch; chart.DockMode = PanelDockMode.Fill; // configure axes NOrdinalScaleConfigurator ordinalScale = chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator; ordinalScale.AutoLabels = false; ordinalScale.Labels.Add("2004"); ordinalScale.Labels.Add("2005"); ordinalScale.Labels.Add("2006"); ordinalScale.Labels.Add("2007"); ordinalScale.Labels.Add("2008"); ordinalScale.Labels.Add("2009"); // add interlace stripe NLinearScaleConfigurator linearScale = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator; linearScale.Title.Text = "Sales in Thousands USD"; linearScale.MinTickDistance = new NLength(15); 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); // create series NSeries series1 = null, series2 = null, series3 = null; switch (ChartTypeCombo.SelectedIndex) { case 0: // Bar series1 = (NSeries)chart.Series.Add(SeriesType.Bar); series2 = (NSeries)chart.Series.Add(SeriesType.Bar); series3 = (NSeries)chart.Series.Add(SeriesType.Bar); ((NBarSeries)series1).MultiBarMode = MultiBarMode.Clustered; ((NBarSeries)series2).MultiBarMode = MultiBarMode.Clustered; ((NBarSeries)series3).MultiBarMode = MultiBarMode.Clustered; break; case 1: // Line series1 = (NSeries)chart.Series.Add(SeriesType.Line); series2 = (NSeries)chart.Series.Add(SeriesType.Line); series3 = (NSeries)chart.Series.Add(SeriesType.Line); ((NLineSeries)series1).MultiLineMode = MultiLineMode.Stacked; ((NLineSeries)series2).MultiLineMode = MultiLineMode.Stacked; ((NLineSeries)series3).MultiLineMode = MultiLineMode.Stacked; break; case 2: // Area series1 = (NSeries)chart.Series.Add(SeriesType.Area); series2 = (NSeries)chart.Series.Add(SeriesType.Area); series3 = (NSeries)chart.Series.Add(SeriesType.Area); ((NAreaSeries)series1).MultiAreaMode = MultiAreaMode.Stacked; ((NAreaSeries)series2).MultiAreaMode = MultiAreaMode.Stacked; ((NAreaSeries)series3).MultiAreaMode = MultiAreaMode.Stacked; break; } // configure common settings series1.Name = "Company A"; series1.DataLabelStyle.Visible = false; series2.Name = "Company B"; series2.DataLabelStyle.Visible = false; series3.Name = "Company C"; series3.DataLabelStyle.Visible = false; // fill with random data series1.Values.FillRandomRange(Random, 6, 10, 100); series2.Values.FillRandomRange(Random, 6, 10, 100); series3.Values.FillRandomRange(Random, 6, 10, 100); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // apply animation theme NAnimationTheme animationTheme = new NAnimationTheme(); animationTheme.AnimateSeriesSequentially = SequentialSeriesCheckBox.Checked; animationTheme.AnimateDataPointsSequentially = SequentialDataPointsCheckBox.Checked; animationTheme.AnimateChartsSequentially = SequentialChartsCheckBox.Checked; animationTheme.WallsAnimationDuration = (float)(WallsAnimationDurationCombo.SelectedIndex + 1); animationTheme.AxesAnimationDuration = (float)(AxesAnimationDurationCombo.SelectedIndex + 1); animationTheme.SeriesAnimationDuration = (float)(SeriesAnimationDurationCombo.SelectedIndex + 1); animationTheme.AnimationThemeType = (AnimationThemeType)AnimationThemeTypeCombo.SelectedIndex; animationTheme.Apply(nChartControl1.Document); NImageResponse swfResponse = new NImageResponse(); swfResponse.ImageFormat = new NSwfImageFormat(); // swfResponse.StreamImageToBrowser = true; nChartControl1.ImageAcquisitionMode = ClientSideImageAcquisitionMode.TempFile; nChartControl1.ServerSettings.BrowserResponseSettings.DefaultResponse = swfResponse; }
protected void Page_Load(object sender, System.EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Panels.Clear(); // set a chart title NLabel header = new NLabel("Radial Gauge Knob Indicators"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; header.ContentAlignment = ContentAlignment.BottomRight; header.DockMode = PanelDockMode.Top; header.Location = new NPointL(new NLength(3, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); nChartControl1.Panels.Add(header); // create the radial gauge NRadialGaugePanel radialGauge = new NRadialGaugePanel(); nChartControl1.Panels.Add(radialGauge); radialGauge.DockMode = PanelDockMode.Fill; radialGauge.ContentAlignment = ContentAlignment.MiddleCenter; radialGauge.SweepAngle = 270; radialGauge.BeginAngle = -225; radialGauge.CapStyle.Visible = false; // configure the gauge scale NGaugeAxis axis = (NGaugeAxis)radialGauge.Axes[0]; NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator; scale.SetPredefinedScaleStyle(PredefinedScaleStyle.PresentationNoStroke); scale.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 12, FontStyle.Italic); scale.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.Black); scale.LabelStyle.Angle = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0); scale.MinorTickCount = 4; scale.RulerStyle.BorderStyle.Width = new NLength(0); scale.RulerStyle.FillStyle = new NColorFillStyle(Color.DarkGray); // create the knob indicator NKnobIndicator knobIndicator = new NKnobIndicator(); knobIndicator.OffsetFromScale = new NLength(-3); // apply fill style to the marker NAdvancedGradientFillStyle advancedGradientFill = new NAdvancedGradientFillStyle(); advancedGradientFill.BackgroundColor = Color.Red; advancedGradientFill.Points.Add(new NAdvancedGradientPoint(Color.White, 20, 20, 0, 100, AGPointShape.Circle)); knobIndicator.MarkerShape.FillStyle = advancedGradientFill; // add the knob indicator to the indicators collection of the gauge radialGauge.Indicators.Add(knobIndicator); if (!IsPostBack) { WebExamplesUtilities.FillComboWithEnumValues(MarkerShapeDropDownList, typeof(SmartShape2D)); MarkerShapeDropDownList.SelectedIndex = (int)SmartShape2D.Ellipse; WebExamplesUtilities.FillComboWithEnumValues(OuterRimPatternDropDownList, typeof(CircularRimPattern)); OuterRimPatternDropDownList.SelectedIndex = (int)CircularRimPattern.RoundHandle; WebExamplesUtilities.FillComboWithEnumValues(InnerRimPatternDropDownList, typeof(CircularRimPattern)); InnerRimPatternDropDownList.SelectedIndex = (int)CircularRimPattern.Circle; } // update the knob marker shape N2DSmartShapeFactory factory = new N2DSmartShapeFactory(knobIndicator.MarkerShape.FillStyle, knobIndicator.MarkerShape.StrokeStyle, knobIndicator.MarkerShape.ShadowStyle); knobIndicator.MarkerShape = factory.CreateShape((SmartShape2D)MarkerShapeDropDownList.SelectedIndex); // update the outer rim style knobIndicator.OuterRimStyle.Pattern = (CircularRimPattern)OuterRimPatternDropDownList.SelectedIndex; // update the inner rim style knobIndicator.InnerRimStyle.Pattern = (CircularRimPattern)InnerRimPatternDropDownList.SelectedIndex; }
protected void Page_Load(object sender, System.EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Date Time Stack Float Bar"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // configure the chart NChart chart = nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; // setup X axis NDateTimeScaleConfigurator timeScaleConfigurator = new NDateTimeScaleConfigurator(); chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = timeScaleConfigurator; // setup Y axis 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.ShowAtWalls = new ChartWallType[] { ChartWallType.Back, ChartWallType.Left }; scaleY.StripStyles.Add(stripStyle); // setup the floatbar series NFloatBarSeries floatbar = (NFloatBarSeries)chart.Series.Add(SeriesType.FloatBar); floatbar.MultiFloatBarMode = MultiFloatBarMode.Series; floatbar.Name = "Floatbar"; floatbar.DataLabelStyle.Visible = false; floatbar.Legend.TextStyle.FontStyle.EmSize = new NLength(8); floatbar.UseXValues = true; floatbar.InflateMargins = true; // setup the bar series NBarSeries bar1 = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar1.Name = "Bar 1"; bar1.MultiBarMode = MultiBarMode.Stacked; bar1.DataLabelStyle.Visible = false; bar1.Legend.TextStyle.FontStyle.EmSize = new NLength(8); // setup the bar series NBarSeries bar2 = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar2.Name = "Bar 2"; bar2.MultiBarMode = MultiBarMode.Stacked; bar2.DataLabelStyle.Visible = false; bar2.Legend.TextStyle.FontStyle.EmSize = new NLength(8); if (!IsPostBack) { WebExamplesUtilities.FillComboWithEnumValues(BarShapeDropDownList, typeof(BarShape)); BarShapeDropDownList.SelectedIndex = 0; DataTypeDropDownList.Items.Add("Positive Data"); DataTypeDropDownList.Items.Add("Positive and Negative Data"); DataTypeDropDownList.SelectedIndex = 0; } BarShape selectedShape = (BarShape)BarShapeDropDownList.SelectedIndex; floatbar.BarShape = selectedShape; bar1.BarShape = selectedShape; bar2.BarShape = selectedShape; GenerateXData(); if (DataTypeDropDownList.SelectedIndex == 0) { GeneratePosData(); } else { GeneratePosNegData(); } // 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, System.EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Panels.Clear(); // set a chart title NLabel header = new NLabel("Linear Gauge Indicators"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; header.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL(new NLength(3, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); nChartControl1.Panels.Add(header); // create a linear gauge m_LinearGauge = new NLinearGaugePanel(); nChartControl1.Panels.Add(m_LinearGauge); m_LinearGauge.ContentAlignment = ContentAlignment.MiddleCenter; m_LinearGauge.BorderStyle = new NEdgeBorderStyle(BorderShape.RoundedRect); m_LinearGauge.PaintEffect = new NGelEffectStyle(); m_LinearGauge.BackgroundFillStyle = new NGradientFillStyle(Color.Gray, Color.Black); m_LinearGauge.Axes.Clear(); NRange1DD celsiusRange = new NRange1DD(-40, 60); // add celsius and farenheit axes NGaugeAxis celsiusAxis = new NGaugeAxis(); celsiusAxis.Range = celsiusRange; celsiusAxis.Anchor = new NModelGaugeAxisAnchor(new NLength(-5), VertAlign.Center, RulerOrientation.Left, 0, 100); m_LinearGauge.Axes.Add(celsiusAxis); NGaugeAxis farenheitAxis = new NGaugeAxis(); farenheitAxis.Range = new NRange1DD(CelsiusToFarenheit(celsiusRange.Begin), CelsiusToFarenheit(celsiusRange.End)); farenheitAxis.Anchor = new NModelGaugeAxisAnchor(new NLength(5), VertAlign.Center, RulerOrientation.Right, 0, 100); m_LinearGauge.Axes.Add(farenheitAxis); // configure the scales NLinearScaleConfigurator celsiusScale = (NLinearScaleConfigurator)celsiusAxis.ScaleConfigurator; ConfigureScale(celsiusScale, "°C"); celsiusScale.Sections.Add(CreateSection(Color.Red, Color.Red, new NRange1DD(40, 60))); celsiusScale.Sections.Add(CreateSection(Color.Blue, Color.SkyBlue, new NRange1DD(-40, -20))); NLinearScaleConfigurator farenheitScale = (NLinearScaleConfigurator)farenheitAxis.ScaleConfigurator; ConfigureScale(farenheitScale, "°F"); farenheitScale.Sections.Add(CreateSection(Color.Red, Color.Red, new NRange1DD(CelsiusToFarenheit(40), CelsiusToFarenheit(60)))); farenheitScale.Sections.Add(CreateSection(Color.Blue, Color.SkyBlue, new NRange1DD(CelsiusToFarenheit(-40), CelsiusToFarenheit(-20)))); // now add two indicators m_Indicator1 = new NRangeIndicator(); m_Indicator1.Value = 10; m_Indicator1.StrokeStyle.Color = Color.DarkBlue; m_Indicator1.FillStyle = new NGradientFillStyle(GradientStyle.Vertical, GradientVariant.Variant1, Color.LightBlue, Color.Blue); m_LinearGauge.Indicators.Add(m_Indicator1); m_Indicator2 = new NMarkerValueIndicator(); m_Indicator2.Value = 33; m_Indicator2.Shape.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red); m_Indicator2.Shape.StrokeStyle.Color = Color.DarkRed; m_LinearGauge.Indicators.Add(m_Indicator2); // init form controls if (!Page.IsPostBack) { WebExamplesUtilities.FillComboWithEnumValues(RangeIndicatorOriginModeDropDownList, typeof(OriginMode)); RangeIndicatorOriginModeDropDownList.SelectedIndex = 0; WebExamplesUtilities.FillComboWithEnumValues(ValueIndicatorShapeDropDownList, typeof(SmartShape2D)); ValueIndicatorShapeDropDownList.SelectedIndex = (int)SmartShape2D.Triangle; WebExamplesUtilities.FillComboWithEnumValues(GaugeOrientationDropDownList, typeof(LinearGaugeOrientation)); GaugeOrientationDropDownList.SelectedIndex = 0; WebExamplesUtilities.FillComboWithValues(ValueIndicatorDropDownList, -20, 60, 10); WebExamplesUtilities.FillComboWithValues(RangeIndicatorValueDropDownList, -20, 60, 10); WebExamplesUtilities.FillComboWithValues(RangeIndicatorOriginDropDownList, -20, 60, 10); RangeIndicatorOriginDropDownList.SelectedIndex = 5; RangeIndicatorValueDropDownList.SelectedValue = m_Indicator1.Value.ToString(); ValueIndicatorDropDownList.SelectedValue = m_Indicator2.Value.ToString(); } m_LinearGauge.Orientation = (LinearGaugeOrientation)GaugeOrientationDropDownList.SelectedIndex; if (m_LinearGauge.Orientation == LinearGaugeOrientation.Horizontal) { m_LinearGauge.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(50, NRelativeUnit.ParentPercentage)); m_LinearGauge.Size = new NSizeL(new NLength(90, NRelativeUnit.ParentPercentage), new NLength(55, NRelativeUnit.ParentPercentage)); } else { m_LinearGauge.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(54, NRelativeUnit.ParentPercentage)); m_LinearGauge.Size = new NSizeL(new NLength(37, NRelativeUnit.ParentPercentage), new NLength(85, NRelativeUnit.ParentPercentage)); } m_Indicator1.OriginMode = (OriginMode)RangeIndicatorOriginModeDropDownList.SelectedIndex; m_Indicator1.Origin = Convert.ToDouble(RangeIndicatorOriginDropDownList.SelectedValue); m_Indicator1.Value = Convert.ToDouble(RangeIndicatorValueDropDownList.SelectedValue); N2DSmartShapeFactory factory = new N2DSmartShapeFactory(m_Indicator2.Shape.FillStyle, m_Indicator2.Shape.StrokeStyle, m_Indicator2.Shape.ShadowStyle); m_Indicator2.Shape = factory.CreateShape((SmartShape2D)ValueIndicatorShapeDropDownList.SelectedIndex); m_Indicator2.Value = Convert.ToDouble(ValueIndicatorDropDownList.SelectedValue); if (m_Indicator1.OriginMode != OriginMode.Custom) { RangeIndicatorOriginDropDownList.Enabled = false; } else { RangeIndicatorOriginDropDownList.Enabled = true; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithEnumValues(ShapeCombo, typeof(BarShape)); ShapeCombo.SelectedIndex = 0; ShowDataLabelsCheck.Checked = false; UseOriginCheck.Checked = true; DifferentColorsCheckBox.Checked = true; OriginTextBox.Text = "0"; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("2D Bar Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; NChart chart = nChartControl1.Charts[0]; chart.Axis(StandardAxis.Depth).Visible = false; // 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); NBarSeries barSeries = (NBarSeries)chart.Series.Add(SeriesType.Bar); barSeries.Name = "Bar Series"; barSeries.DataLabelStyle.Format = "<value>"; barSeries.Legend.TextStyle.FontStyle.EmSize = new NLength(8, NGraphicsUnit.Point); barSeries.ShadowStyle.Type = ShadowType.GaussianBlur; barSeries.ShadowStyle.Offset = new NPointL(new NLength(3, NGraphicsUnit.Pixel), new NLength(3, NGraphicsUnit.Pixel)); barSeries.ShadowStyle.Color = Color.FromArgb(80, 0, 0, 0); barSeries.ShadowStyle.FadeLength = new NLength(5, NGraphicsUnit.Pixel); // add some data to the bar series barSeries.AddDataPoint(new NDataPoint(18, "Silverlight")); barSeries.AddDataPoint(new NDataPoint(15, "Ajax")); barSeries.AddDataPoint(new NDataPoint(21, "JackBe")); barSeries.AddDataPoint(new NDataPoint(23, "Laszlo")); barSeries.AddDataPoint(new NDataPoint(28, "Java FX")); barSeries.AddDataPoint(new NDataPoint(29, "Flex")); UpdateFillStyles(barSeries); if (ShowDataLabelsCheck.Checked) { barSeries.DataLabelStyle.Visible = true; } else { barSeries.DataLabelStyle.Visible = false; barSeries.DataLabelStyles.Clear(); } barSeries.BarShape = (BarShape)ShapeCombo.SelectedIndex; if (UseOriginCheck.Checked == true) { OriginTextBox.Enabled = true; barSeries.OriginMode = SeriesOriginMode.CustomOrigin; try { barSeries.Origin = Int32.Parse(OriginTextBox.Text); } catch { } } else { OriginTextBox.Enabled = false; barSeries.OriginMode = SeriesOriginMode.MinValue; } // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithEnumValues(BubbleShapeDropDownList, typeof(PointShape)); BubbleShapeDropDownList.SelectedIndex = 7; WebExamplesUtilities.FillComboWithValues(MinBubbleSizeDropDownList, 0, 20, 2); MinBubbleSizeDropDownList.SelectedIndex = 2; WebExamplesUtilities.FillComboWithValues(MaxBubbleSizeDropDownList, 0, 20, 2); MaxBubbleSizeDropDownList.SelectedIndex = 9; LightingFilterCheckBox.Checked = true; InflateMarginsCheckBox.Checked = true; AxesRoundToTickCheckBox.Checked = false; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set chart title NLabel title = nChartControl1.Labels.AddHeader("XY Scatter Bubble 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; NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator(); chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; linearScale.RoundToTickMin = AxesRoundToTickCheckBox.Checked; linearScale.RoundToTickMax = AxesRoundToTickCheckBox.Checked; linearScale = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true); linearScale.RoundToTickMin = AxesRoundToTickCheckBox.Checked; linearScale.RoundToTickMax = AxesRoundToTickCheckBox.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); linearScale.StripStyles.Add(stripStyle); // setup bubble series NBubbleSeries bubble = (NBubbleSeries)chart.Series.Add(SeriesType.Bubble); bubble.BubbleShape = (PointShape)BubbleShapeDropDownList.SelectedIndex; bubble.InflateMargins = InflateMarginsCheckBox.Checked; bubble.UseXValues = true; bubble.DataLabelStyle.Visible = false; bubble.BorderStyle.Width = new NLength(0); bubble.Legend.Format = "<label>"; bubble.Legend.Mode = SeriesLegendMode.DataPoints; bubble.Legend.TextStyle.FontStyle.EmSize = new NLength(8, NGraphicsUnit.Point); bubble.ShadowStyle.Type = ShadowType.GaussianBlur; bubble.ShadowStyle.Offset = new NPointL(new NLength(1, NGraphicsUnit.Pixel), new NLength(1, NGraphicsUnit.Pixel)); bubble.ShadowStyle.Color = Color.FromArgb(60, 0, 0, 0); bubble.MinSize = new NLength(MinBubbleSizeDropDownList.SelectedIndex * 2, NRelativeUnit.ParentPercentage); bubble.MaxSize = new NLength(MaxBubbleSizeDropDownList.SelectedIndex * 2, NRelativeUnit.ParentPercentage); AddDataPoints(bubble); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]); }
protected void Page_Load(object sender, System.EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Panels.Clear(); // set a chart title NLabel header = new NLabel("Radial Gauge Indicators"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; header.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL(new NLength(3, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); nChartControl1.Panels.Add(header); // create the radial gauge m_RadialGauge = new NRadialGaugePanel(); m_RadialGauge.BorderStyle = new NEdgeBorderStyle(BorderShape.Auto); m_RadialGauge.PaintEffect = new NGlassEffectStyle(); m_RadialGauge.ContentAlignment = ContentAlignment.MiddleCenter; m_RadialGauge.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(52, NRelativeUnit.ParentPercentage)); m_RadialGauge.Size = new NSizeL(new NLength(90, NRelativeUnit.ParentPercentage), new NLength(85, NRelativeUnit.ParentPercentage)); m_RadialGauge.BackgroundFillStyle = new NGradientFillStyle(Color.DarkGray, Color.Black); // configure scale NGaugeAxis axis = (NGaugeAxis)m_RadialGauge.Axes[0]; NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator; scale.SetPredefinedScaleStyle(PredefinedScaleStyle.Presentation); scale.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 10, FontStyle.Bold); scale.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.White); scale.LabelStyle.Angle = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0); scale.MinorTickCount = 4; scale.RulerStyle.BorderStyle.Width = new NLength(0); scale.RulerStyle.FillStyle = new NColorFillStyle(Color.DarkGray); // add radial gauge indicators m_Indicator1 = new NRangeIndicator(); m_Indicator1.Value = 20; m_Indicator1.FillStyle = new NGradientFillStyle(Color.Yellow, Color.Red); m_Indicator1.StrokeStyle.Color = Color.DarkBlue; m_Indicator1.EndWidth = new NLength(20); m_RadialGauge.Indicators.Add(m_Indicator1); m_Indicator2 = new NNeedleValueIndicator(); m_Indicator2.Shape.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red); m_Indicator2.Shape.StrokeStyle.Color = Color.Red; m_RadialGauge.Indicators.Add(m_Indicator2); m_RadialGauge.SweepAngle = 270; // add radial gauge nChartControl1.Panels.Add(m_RadialGauge); // create and configure a numeric display attached to the radial gauge m_NumericDisplay = new NNumericDisplayPanel(); m_NumericDisplay.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(70, NRelativeUnit.ParentPercentage)); m_NumericDisplay.ContentAlignment = ContentAlignment.TopCenter; m_NumericDisplay.DisplayStyle = DisplayStyle.SevenSegmentRounded; m_NumericDisplay.SegmentWidth = new NLength(2, NGraphicsUnit.Point); m_NumericDisplay.SegmentGap = new NLength(1, NGraphicsUnit.Point); m_NumericDisplay.CellSize = new NSizeL(new NLength(10, NGraphicsUnit.Point), new NLength(20, NGraphicsUnit.Point)); m_NumericDisplay.DecimalCellSize = new NSizeL(new NLength(7, NGraphicsUnit.Point), new NLength(15, NGraphicsUnit.Point)); m_NumericDisplay.ShowDecimalSeparator = false; m_NumericDisplay.CellAlignment = VertAlign.Top; m_NumericDisplay.BackgroundFillStyle = new NColorFillStyle(Color.DimGray); m_NumericDisplay.LitFillStyle = new NGradientFillStyle(Color.Lime, Color.Green); m_NumericDisplay.CellCountMode = DisplayCellCountMode.Fixed; m_NumericDisplay.CellCount = 6; m_NumericDisplay.Padding = new NMarginsL(3, 2, 3, 2); m_RadialGauge.ChildPanels.Add(m_NumericDisplay); // create a sunken border around the display NEdgeBorderStyle borderStyle = new NEdgeBorderStyle(BorderShape.RoundedRect); borderStyle.OuterBevelWidth = new NLength(0); borderStyle.MiddleBevelWidth = new NLength(0); m_NumericDisplay.BorderStyle = borderStyle; // init form controls if (!Page.IsPostBack) { WebExamplesUtilities.FillComboWithValues(ValueIndicatorDropDownList, 0, 100, 10); WebExamplesUtilities.FillComboWithValues(RangeIndicatorValueDropDownList, 0, 100, 10); WebExamplesUtilities.FillComboWithValues(RangeIndicatorOriginDropDownList, 0, 100, 10); WebExamplesUtilities.FillComboWithValues(SweepAngleDropDownList, -360, 360, 45); WebExamplesUtilities.FillComboWithValues(BeginAngleDropDownList, -360, 360, 45); SweepAngleDropDownList.SelectedValue = m_RadialGauge.SweepAngle.ToString(); BeginAngleDropDownList.SelectedValue = m_RadialGauge.BeginAngle.ToString(); WebExamplesUtilities.FillComboWithEnumValues(ValueIndicatorShapeDropDownList, typeof(SmartShape1D)); ValueIndicatorShapeDropDownList.SelectedIndex = (int)SmartShape1D.Triangle; ValueIndicatorDropDownList.SelectedValue = "20"; RangeIndicatorValueDropDownList.SelectedValue = m_Indicator1.Value.ToString(); WebExamplesUtilities.FillComboWithEnumValues(RangeIndicatorOriginModeDropDownList, typeof(OriginMode)); RangeIndicatorOriginModeDropDownList.SelectedIndex = 0; RangeIndicatorOriginDropDownList.SelectedIndex = 0; } m_Indicator1.Value = Convert.ToDouble(RangeIndicatorValueDropDownList.SelectedValue); m_Indicator1.Origin = Convert.ToDouble(RangeIndicatorOriginDropDownList.SelectedValue); m_Indicator1.OriginMode = (OriginMode)RangeIndicatorOriginModeDropDownList.SelectedIndex; m_RadialGauge.BeginAngle = (float)Convert.ToDecimal(BeginAngleDropDownList.SelectedValue); m_RadialGauge.SweepAngle = (float)Convert.ToDecimal(SweepAngleDropDownList.SelectedValue); N1DSmartShapeFactory factory = new N1DSmartShapeFactory(m_Indicator2.Shape.FillStyle, m_Indicator2.Shape.StrokeStyle, m_Indicator2.Shape.ShadowStyle); m_Indicator2.Shape = factory.CreateShape((SmartShape1D)ValueIndicatorShapeDropDownList.SelectedIndex); m_Indicator2.Value = Convert.ToDouble(ValueIndicatorDropDownList.SelectedValue); m_NumericDisplay.Value = m_Indicator2.Value; if (m_Indicator1.OriginMode != OriginMode.Custom) { RangeIndicatorOriginDropDownList.Enabled = false; } else { RangeIndicatorOriginDropDownList.Enabled = true; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // init form controls WebExamplesUtilities.FillComboWithEnumValues(ClusterModeDropDownList, typeof(ClusterMode)); ClusterModeDropDownList.SelectedIndex = (int)ClusterMode.Enabled; for (int i = 0; i < 9; i++) { ClusterDistanceFactorDropDownList.Items.Add("0.0" + (i + 1).ToString()); } WebExamplesUtilities.FillComboWithValues(NumberOfPointGroupsDropDownList, 1, 10, 1); NumberOfPointGroupsDropDownList.SelectedIndex = 2; WebExamplesUtilities.FillComboWithValues(NumberOfPointsInGroupDropDownList, 10000, 30000, 10000); NumberOfPointsInGroupDropDownList.SelectedIndex = 0; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("XY Scatter Point Cluster 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.BoundsMode = BoundsMode.Stretch; // setup Y axis NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; scaleY.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); scaleY.StripStyles.Add(stripStyle); // setup X axis NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator(); scaleX.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Back }; scaleX.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; // setup point series NPointSeries point = (NPointSeries)chart.Series.Add(SeriesType.Point); point.Name = "Point1"; point.UseXValues = true; point.DataLabelStyle.Visible = false; point.MarkerStyle.Visible = false; point.ClusterMode = (ClusterMode)ClusterModeDropDownList.SelectedIndex; point.ClusterDistanceFactor = (ClusterDistanceFactorDropDownList.SelectedIndex + 1) * 0.01; point.FillStyle = new NColorFillStyle(Color.FromArgb(160, DarkOrange)); point.BorderStyle.Width = new NLength(0); point.Size = new NLength(1.5f); point.PointShape = PointShape.Ellipse; // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // generate some random X values GenerateXYData(point); NumberOfDataPointsLabel.Text = "Number of Data Points:" + (point.Values.Count / 1000).ToString() + "K"; // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); }
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 = 7; WebExamplesUtilities.FillComboWithValues(LineWidthDropDownList, 0, 5, 1); LineWidthDropDownList.SelectedIndex = 1; WebExamplesUtilities.FillComboWithColorNames(LineColorDropDownList); LineColorDropDownList.SelectedIndex = 34; WebExamplesUtilities.FillComboWithColorNames(LineFillColorDropDownList); LineFillColorDropDownList.SelectedIndex = 72; WebExamplesUtilities.FillComboWithValues(MarkerSizeDropDownList, 0, 10, 1); MarkerSizeDropDownList.SelectedIndex = 2; ShowMarkersCheckBox.Checked = true; LeftAxisRoundToTickCheckBox.Checked = true; InflateMarginsCheckBox.Checked = true; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("2D 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.BoundsMode = BoundsMode.Stretch; NLinearScaleConfigurator linearScaleConfigurator = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; linearScaleConfigurator.RoundToTickMin = LeftAxisRoundToTickCheckBox.Checked; linearScaleConfigurator.RoundToTickMax = LeftAxisRoundToTickCheckBox.Checked; chart.Axis(StandardAxis.Depth).Visible = false; // setup the line series NLineSeries line = (NLineSeries)chart.Series.Add(SeriesType.Line); line.Values.FillRandom(Random, 10); line.DataLabelStyle.Visible = false; line.Legend.Mode = SeriesLegendMode.DataPoints; line.BorderStyle.Width = new NLength(LineWidthDropDownList.SelectedIndex, NGraphicsUnit.Pixel); line.BorderStyle.Color = WebExamplesUtilities.ColorFromDropDownList(LineColorDropDownList); line.FillStyle = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(LineFillColorDropDownList)); line.InflateMargins = InflateMarginsCheckBox.Checked; line.MarkerStyle.Visible = ShowMarkersCheckBox.Checked; line.ShadowStyle.Type = ShadowType.GaussianBlur; line.ShadowStyle.Offset = new NPointL(new NLength(3, NGraphicsUnit.Pixel), new NLength(3, NGraphicsUnit.Pixel)); line.ShadowStyle.FadeLength = new NLength(5, NGraphicsUnit.Pixel); line.ShadowStyle.Color = Color.FromArgb(55, 0, 0, 0); bool bSimpleLine = (LineStyleDropDownList.SelectedIndex == 0); switch (LineStyleDropDownList.SelectedIndex) { case 0: // line line.LineSegmentShape = LineSegmentShape.Line; break; case 1: // tape line.LineSegmentShape = LineSegmentShape.Tape; break; case 2: // tube line.LineSegmentShape = LineSegmentShape.Tube; break; case 3: // elipsoid line.LineSegmentShape = LineSegmentShape.Ellipsoid; break; } LineFillColorDropDownList.Enabled = !bSimpleLine; MarkerShapeDropDownList.Enabled = ShowMarkersCheckBox.Checked; MarkerSizeDropDownList.Enabled = ShowMarkersCheckBox.Checked; if (line.MarkerStyle.Visible) { line.MarkerStyle.PointShape = (PointShape)MarkerShapeDropDownList.SelectedIndex; line.MarkerStyle.Height = new NLength((float)MarkerSizeDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage); line.MarkerStyle.Width = new NLength((float)MarkerSizeDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage); line.MarkerStyle.FillStyle = new NColorFillStyle(Red); line.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(PredefinedStyleSheetDropDownList, typeof(PredefinedStyleSheet)); PredefinedStyleSheetDropDownList.SelectedIndex = 0; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Settings.JitterMode = JitterMode.Enabled; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Predefined Style Sheets"); 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 = 60; chart.Height = 25; chart.Depth = 45; chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); // setup X axis NOrdinalScaleConfigurator scaleX = chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator; scaleX.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Back }; // add the first bar NBarSeries bar1 = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar1.MultiBarMode = MultiBarMode.Series; bar1.Name = "Bar1"; bar1.DataLabelStyle.Visible = true; bar1.DataLabelStyle.Format = "<value>"; bar1.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(8, NGraphicsUnit.Point); // add the second bar NBarSeries bar2 = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar2.MultiBarMode = MultiBarMode.Series; bar2.Name = "Bar2"; bar2.DataLabelStyle.Visible = true; bar2.DataLabelStyle.Format = "<value>"; bar2.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(8, NGraphicsUnit.Point); // add the third bar NBarSeries bar3 = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar3.MultiBarMode = MultiBarMode.Series; bar3.Name = "Bar3"; bar3.DataLabelStyle.Visible = true; bar3.DataLabelStyle.Format = "<value>"; bar3.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(8, NGraphicsUnit.Point); // fill with random data int barCount = 6; bar1.Values.FillRandomRange(Random, barCount, 10, 40); bar2.Values.FillRandomRange(Random, barCount, 30, 60); bar3.Values.FillRandomRange(Random, barCount, 50, 80); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet((PredefinedStyleSheet)PredefinedStyleSheetDropDownList.SelectedIndex); styleSheet.Apply(nChartControl1.Document); // 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("Funnel Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; title.ContentAlignment = ContentAlignment.BottomRight; title.Location = new NPointL( new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); NLegend legend = nChartControl1.Legends[0]; legend.SetPredefinedLegendStyle(PredefinedLegendStyle.Bottom); legend.Data.ExpandMode = LegendExpandMode.RowsFixed; legend.Data.RowCount = 2; NFunnelChart chart = new NFunnelChart(); chart.BoundsMode = BoundsMode.Fit; chart.Location = new NPointL( new NLength(10, NRelativeUnit.ParentPercentage), new NLength(12, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL( new NLength(80, NRelativeUnit.ParentPercentage), new NLength(68, NRelativeUnit.ParentPercentage)); nChartControl1.Charts.Clear(); nChartControl1.Charts.Add(chart); NFunnelSeries funnel = (NFunnelSeries)chart.Series.Add(SeriesType.Funnel); funnel.BorderStyle.Color = Color.LemonChiffon; funnel.Legend.DisplayOnLegend = legend; funnel.Legend.Format = "<percent>"; funnel.Legend.Mode = SeriesLegendMode.DataPoints; funnel.DataLabelStyle.Format = "<value> [<xsize>]"; funnel.UseXSizes = true; funnel.Values.ValueFormatter = new NNumericValueFormatter("0.00"); funnel.XSizes.ValueFormatter = new NNumericValueFormatter("0.00"); GenerateData(funnel); if (!IsPostBack) { // init form controls WebExamplesUtilities.FillComboWithEnumValues(FunnelLabelModeDropDownList, typeof(FunnelLabelMode)); FunnelLabelModeDropDownList.SelectedIndex = (int)FunnelLabelMode.RightAligned; WebExamplesUtilities.FillComboWithValues(FunnelPointGapDropDownList, 0, 15, 1); FunnelPointGapDropDownList.SelectedIndex = 6; WebExamplesUtilities.FillComboWithValues(FunnelRadiusDropDownList, 0, 100, 10); FunnelRadiusDropDownList.SelectedIndex = (int)(chart.Width / 10.0f); WebExamplesUtilities.FillComboWithValues(FunnelArrowLengthDropDownList, 0, 10, 1); FunnelArrowLengthDropDownList.SelectedIndex = 1; } // init funnel label mode funnel.LabelMode = (FunnelLabelMode)FunnelLabelModeDropDownList.SelectedIndex; HorzAlign ha = HorzAlign.Center; switch (funnel.LabelMode) { case FunnelLabelMode.Left: case FunnelLabelMode.LeftAligned: ha = HorzAlign.Right; break; case FunnelLabelMode.Right: case FunnelLabelMode.RightAligned: ha = HorzAlign.Left; break; } funnel.DataLabelStyle.TextStyle.StringFormatStyle.HorzAlign = ha; // arrow length funnel.DataLabelStyle.ArrowLength = new NLength((float)FunnelArrowLengthDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage); // funnel radius chart.Width = FunnelRadiusDropDownList.SelectedIndex * 10; funnel.FunnelPointGap = FunnelPointGapDropDownList.SelectedIndex / 10.0f; }
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) { nChartControl1.Settings.JitterMode = JitterMode.Enabled; nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Stacked 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.Enable3D = true; nChart.Axis(StandardAxis.Depth).Visible = false; nChart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1); nChart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); // add interlace stripe NLinearScaleConfigurator scaleY = 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, ChartWallType.Left }; stripStyle.SetShowAtWall(ChartWallType.Left, true); scaleY.StripStyles.Add(stripStyle); // add the first bar nBar1 = (NBarSeries)nChart.Series.Add(SeriesType.Bar); nBar1.Name = "Bar1"; nBar1.MultiBarMode = MultiBarMode.Series; nBar1.DataLabelStyle.VertAlign = VertAlign.Center; nBar1.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(7); nBar1.Legend.TextStyle.FontStyle.EmSize = new NLength(8); nBar1.Values.ValueFormatter = new NNumericValueFormatter("0"); // add the second bar nBar2 = (NBarSeries)nChart.Series.Add(SeriesType.Bar); nBar2.Name = "Bar2"; nBar2.MultiBarMode = MultiBarMode.Stacked; nBar2.DataLabelStyle.VertAlign = VertAlign.Center; nBar2.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(7); nBar2.Legend.TextStyle.FontStyle.EmSize = new NLength(8); nBar2.Values.ValueFormatter = new NNumericValueFormatter("0"); // add the third bar nBar3 = (NBarSeries)nChart.Series.Add(SeriesType.Bar); nBar3.Name = "Bar3"; nBar3.MultiBarMode = MultiBarMode.Stacked; nBar3.DataLabelStyle.VertAlign = VertAlign.Center; nBar3.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(7); nBar3.Legend.TextStyle.FontStyle.EmSize = new NLength(8); nBar3.Values.ValueFormatter = new NNumericValueFormatter("0"); // 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) { // fill the data labels combos FirstBarLabelsDropDownList.Items.Add("Value"); FirstBarLabelsDropDownList.Items.Add("Total"); FirstBarLabelsDropDownList.Items.Add("Cumulative"); FirstBarLabelsDropDownList.Items.Add("Percent"); FirstBarLabelsDropDownList.Items.Add("No Label"); FirstBarLabelsDropDownList.SelectedIndex = 0; SecondBarLabelsDropDownList.Items.Add("Value"); SecondBarLabelsDropDownList.Items.Add("Total"); SecondBarLabelsDropDownList.Items.Add("Cumulative"); SecondBarLabelsDropDownList.Items.Add("Percent"); SecondBarLabelsDropDownList.Items.Add("No Label"); SecondBarLabelsDropDownList.SelectedIndex = 0; ThirdBarLabelsDropDownList.Items.Add("Value"); ThirdBarLabelsDropDownList.Items.Add("Total"); ThirdBarLabelsDropDownList.Items.Add("Cumulative"); ThirdBarLabelsDropDownList.Items.Add("Percent"); ThirdBarLabelsDropDownList.Items.Add("No Label"); ThirdBarLabelsDropDownList.SelectedIndex = 0; StackStyleDropDownList.Items.Add("Stacked"); StackStyleDropDownList.Items.Add("Stacked %"); StackStyleDropDownList.SelectedIndex = 0; WebExamplesUtilities.FillComboWithEnumValues(BarShapeDropDownList, typeof(BarShape)); BarShapeDropDownList.SelectedIndex = 0; PositiveDataCheckBox.Checked = true; } nBar1.DataLabelStyle.Format = GetDataLabelsFormatString(FirstBarLabelsDropDownList); nBar2.DataLabelStyle.Format = GetDataLabelsFormatString(SecondBarLabelsDropDownList); nBar3.DataLabelStyle.Format = GetDataLabelsFormatString(ThirdBarLabelsDropDownList); switch (StackStyleDropDownList.SelectedIndex) { case 0: nBar2.MultiBarMode = MultiBarMode.Stacked; nBar3.MultiBarMode = MultiBarMode.Stacked; break; case 1: nBar2.MultiBarMode = MultiBarMode.StackedPercent; nBar3.MultiBarMode = MultiBarMode.StackedPercent; scaleY.LabelValueFormatter = new NNumericValueFormatter(NumericValueFormat.Percentage); break; } BarShape shape = (BarShape)BarShapeDropDownList.SelectedIndex; nBar1.BarShape = shape; nBar2.BarShape = shape; nBar3.BarShape = shape; bool bEnable = (shape.Equals(BarShape.SmoothEdgeBar)) || (shape.Equals(BarShape.CutEdgeBar)); ArrayList arrControls = new ArrayList(); arrControls.Add(FirstHasTopEdgeCheckBox); arrControls.Add(FirstHasBottomEdgeCheckBox); arrControls.Add(SecondHasTopEdgeCheckBox); arrControls.Add(SecondHasBottomEdgeCheckBox); arrControls.Add(ThirdHasTopEdgeCheckBox); arrControls.Add(ThirdHasBottomEdgeCheckBox); foreach (CheckBox check in arrControls) { check.Enabled = bEnable; } if (bEnable) { nBar1.HasTopEdge = FirstHasTopEdgeCheckBox.Checked; nBar1.HasBottomEdge = FirstHasBottomEdgeCheckBox.Checked; nBar2.HasTopEdge = SecondHasTopEdgeCheckBox.Checked; nBar2.HasBottomEdge = SecondHasBottomEdgeCheckBox.Checked; nBar3.HasTopEdge = ThirdHasTopEdgeCheckBox.Checked; nBar3.HasBottomEdge = ThirdHasBottomEdgeCheckBox.Checked; } if (PositiveDataCheckBox.Checked) { GeneratePositiveData(); } else { GeneratePositiveAndNegativeData(); } this.PositiveDataButton.Click += new EventHandler(this.PositiveDataButton_Click); this.PositivAndNegativeDataButton.Click += new EventHandler(this.PositiveAndNegativeDataButton_Click); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataLabelFormatDropDownList.Items.Add("high"); DataLabelFormatDropDownList.Items.Add("low"); DataLabelFormatDropDownList.Items.Add("high low"); DataLabelFormatDropDownList.SelectedIndex = 0; WebExamplesUtilities.FillComboWithEnumValues(MarkerShapeDropDownList, typeof(PointShape)); MarkerShapeDropDownList.SelectedIndex = 0; WebExamplesUtilities.FillComboWithColorNames(HighAreaColorDropDownList, KnownColor.LightSlateGray); WebExamplesUtilities.FillComboWithColorNames(LowAreaColorDropDownList, KnownColor.DarkOrange); WebExamplesUtilities.FillComboWithValues(MarkerSizeDropDownList, 0, 5, 1); MarkerSizeDropDownList.SelectedIndex = 2; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("2D High-Low Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // configure the chart NChart chart = nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; // setup X axis NOrdinalScaleConfigurator scaleX = (NOrdinalScaleConfigurator)chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator; scaleX.DisplayDataPointsBetweenTicks = false; // setup Y axis NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; scaleY.MajorGridStyle.LineStyle.Color = Color.LightGray; // add interlace 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); NHighLowSeries highLow = (NHighLowSeries)chart.Series.Add(SeriesType.HighLow); highLow.Name = "High-Low Series"; highLow.InflateMargins = true; highLow.Legend.Mode = SeriesLegendMode.SeriesLogic; highLow.MarkerStyle.FillStyle = new NColorFillStyle(Red); highLow.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(7); highLow.LowValues.ValueFormatter = new NNumericValueFormatter("0.#"); highLow.HighValues.ValueFormatter = new NNumericValueFormatter("0.#"); highLow.HighFillStyle = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(HighAreaColorDropDownList)); highLow.LowFillStyle = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(LowAreaColorDropDownList)); highLow.DropLines = ShowDropLinesCheckBox.Checked; highLow.DataLabelStyle.Visible = ShowDataLabelsCheckBox.Checked; switch (DataLabelFormatDropDownList.SelectedIndex) { case 0: highLow.DataLabelStyle.Format = "<high_value>"; break; case 1: highLow.DataLabelStyle.Format = "<low_value>"; break; case 2: highLow.DataLabelStyle.Format = "<high_value> - <low_value>"; break; } MarkerShapeDropDownList.Enabled = ShowMarkersCheckBox.Checked; MarkerSizeDropDownList.Enabled = ShowMarkersCheckBox.Checked; highLow.MarkerStyle.Visible = ShowMarkersCheckBox.Checked; highLow.MarkerStyle.PointShape = (PointShape)MarkerShapeDropDownList.SelectedIndex; highLow.MarkerStyle.Width = new NLength((float)MarkerSizeDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage); highLow.MarkerStyle.Height = new NLength((float)MarkerSizeDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage); GenerateData(highLow); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithEnumValues(MarkerShapeDropDownList, typeof(PointShape)); MarkerShapeDropDownList.SelectedIndex = 1; WebExamplesUtilities.FillComboWithColorNames(RadarColor1DropDownList, KnownColor.SlateBlue); WebExamplesUtilities.FillComboWithColorNames(RadarColor2DropDownList, KnownColor.Crimson); ShowMarkersCheckBox.Checked = true; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Radar Area"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; title.ContentAlignment = ContentAlignment.BottomRight; title.Location = new NPointL( new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // create and configure a radar chart NRadarChart radarChart = new NRadarChart(); nChartControl1.Charts.Clear(); nChartControl1.Charts.Add(radarChart); radarChart.BoundsMode = BoundsMode.Fit; radarChart.Location = new NPointL(new NLength(0, NRelativeUnit.ParentPercentage), new NLength(0, NRelativeUnit.ParentPercentage)); radarChart.Size = new NSizeL(new NLength(100, NRelativeUnit.ParentPercentage), new NLength(100, NRelativeUnit.ParentPercentage)); radarChart.Padding = new NMarginsL(7, 7, 7, 7); // set some axis labels AddAxis(radarChart, "Vitamin A"); AddAxis(radarChart, "Vitamin B1"); AddAxis(radarChart, "Vitamin B2"); AddAxis(radarChart, "Vitamin B6"); AddAxis(radarChart, "Vitamin B12"); AddAxis(radarChart, "Vitamin C"); AddAxis(radarChart, "Vitamin D"); AddAxis(radarChart, "Vitamin E"); Color color1 = WebExamplesUtilities.ColorFromDropDownList(RadarColor1DropDownList); Color color2 = WebExamplesUtilities.ColorFromDropDownList(RadarColor2DropDownList); // setup radar series 1 NRadarAreaSeries radarArea1 = (NRadarAreaSeries)radarChart.Series.Add(SeriesType.RadarArea); radarArea1.Name = "Series 1"; radarArea1.DataLabelStyle.Visible = ShowDataLabelsCheckBox.Checked; radarArea1.DataLabelStyle.Format = "<value>"; radarArea1.BorderStyle.Color = color1; radarArea1.FillStyle = new NColorFillStyle(Color.FromArgb(125, color1)); radarArea1.MarkerStyle.Visible = ShowMarkersCheckBox.Checked; radarArea1.MarkerStyle.PointShape = (PointShape)MarkerShapeDropDownList.SelectedIndex; radarArea1.MarkerStyle.Height = new NLength(1.5f, NRelativeUnit.ParentPercentage); radarArea1.MarkerStyle.Width = new NLength(1.5f, NRelativeUnit.ParentPercentage); radarArea1.MarkerStyle.FillStyle = new NColorFillStyle(color1); radarArea1.MarkerStyle.BorderStyle.Color = color1; radarArea1.Values.FillRandomRange(Random, 8, 0, 100); // setup radar series 2 NRadarAreaSeries radarArea2 = (NRadarAreaSeries)radarChart.Series.Add(SeriesType.RadarArea); radarArea2.Name = "Series 2"; radarArea2.DataLabelStyle.Visible = ShowDataLabelsCheckBox.Checked; radarArea2.DataLabelStyle.Format = "<value>"; radarArea2.BorderStyle.Color = color2; radarArea2.FillStyle = new NColorFillStyle(Color.FromArgb(125, color2)); radarArea2.MarkerStyle.Visible = ShowMarkersCheckBox.Checked; radarArea2.MarkerStyle.PointShape = (PointShape)MarkerShapeDropDownList.SelectedIndex; radarArea2.MarkerStyle.Height = new NLength(1.5f, NRelativeUnit.ParentPercentage); radarArea2.MarkerStyle.Width = new NLength(1.5f, NRelativeUnit.ParentPercentage); radarArea2.MarkerStyle.FillStyle = new NColorFillStyle(color2); radarArea2.MarkerStyle.BorderStyle.Color = color2; radarArea2.Values.FillRandomRange(Random, 8, 0, 100); }
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, System.EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Settings.JitterMode = JitterMode.Enabled; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("3D Smooth Area"); 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.Axis(StandardAxis.Depth).Visible = false; chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); // add interlace stripe NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; 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 }; linearScale.StripStyles.Add(stripStyle); // add the area series NSmoothAreaSeries area = (NSmoothAreaSeries)chart.Series.Add(SeriesType.SmoothArea); area.DataLabelStyle.Visible = false; area.MarkerStyle.Visible = false; area.MarkerStyle.PointShape = PointShape.Cylinder; area.MarkerStyle.BorderStyle.Color = Color.MidnightBlue; area.MarkerStyle.AutoDepth = true; area.MarkerStyle.Width = new NLength(1.4f, NRelativeUnit.ParentPercentage); area.MarkerStyle.Height = new NLength(1.4f, NRelativeUnit.ParentPercentage); GenreateYValues(nValuesCount); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); if (!Page.IsPostBack) { WebExamplesUtilities.FillComboWithEnumValues(AreaOriginModeCombo, typeof(SeriesOriginMode)); AreaOriginModeCombo.SelectedIndex = 0; OriginValueTextBox.Text = "0"; } area.MarkerStyle.Visible = ShowMarkersCheck.Checked; area.DropLines = ShowDropLinesCheck.Checked; area.OriginMode = (SeriesOriginMode)AreaOriginModeCombo.SelectedIndex; try { area.Origin = Double.Parse(OriginValueTextBox.Text); } catch { } }
protected void Page_Load(object sender, System.EventArgs e) { if (!Page.IsPostBack) { WebExamplesUtilities.FillComboWithEnumValues(YLabelGenerationModeDropDownList, typeof(LabelGenerationMode)); WebExamplesUtilities.FillComboWithEnumValues(XLabelGenerationModeDropDownList, typeof(LabelGenerationMode)); WebExamplesUtilities.FillComboWithValues(XTicksPerLabelDropDownList, 1, 10, 1); WebExamplesUtilities.FillComboWithValues(YTicksPerLabelDropDownList, 1, 10, 1); } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel header = nChartControl1.Labels.AddHeader("Axis Labels"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; header.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL( new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // remove all legends nChartControl1.Legends.Clear(); // setup chart m_Chart = nChartControl1.Charts[0]; m_Chart.BoundsMode = BoundsMode.Stretch; m_Chart.Location = new NPointL( new NLength(4, NRelativeUnit.ParentPercentage), new NLength(13, NRelativeUnit.ParentPercentage)); m_Chart.Size = new NSizeL( new NLength(90, NRelativeUnit.ParentPercentage), new NLength(82, NRelativeUnit.ParentPercentage)); NStandardScaleConfigurator scaleConfiguratorY = (NStandardScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; scaleConfiguratorY.MajorTickMode = MajorTickMode.AutoMaxCount; scaleConfiguratorY.MaxTickCount = 50; // add interlaced stripe NScaleStripStyle stripStyle = new NScaleStripStyle(); stripStyle.FillStyle = new NColorFillStyle(Color.Beige); stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); stripStyle.Interlaced = true; scaleConfiguratorY.StripStyles.Add(stripStyle); NStandardScaleConfigurator scaleConfiguratorX = (NStandardScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator; scaleConfiguratorX.MajorTickMode = MajorTickMode.AutoMaxCount; scaleConfiguratorX.AutoLabels = false; scaleConfiguratorX.Labels.Add("France"); scaleConfiguratorX.Labels.Add("Italy"); scaleConfiguratorX.Labels.Add("Germany"); scaleConfiguratorX.Labels.Add("Norway"); scaleConfiguratorX.Labels.Add("Spain"); scaleConfiguratorX.Labels.Add("Belgium"); scaleConfiguratorX.Labels.Add("Greece"); scaleConfiguratorX.Labels.Add("Austria"); scaleConfiguratorX.Labels.Add("Sweden"); scaleConfiguratorX.Labels.Add("Finland"); scaleConfiguratorX.Labels.Add("Poland"); scaleConfiguratorX.Labels.Add("Denmark"); NBarSeries series1 = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar); series1.Name = "Product A"; series1.DataLabelStyle.Visible = false; GenerateData(series1.Values, 12); NBarSeries series2 = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar); series2.MultiBarMode = MultiBarMode.Clustered; series2.Name = "Product B"; series2.DataLabelStyle.Visible = false; // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); GenerateData(series2.Values, 12); UpdateScale(); }
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); }