/// <summary> /// Called to initialize the example /// </summary> /// <param name="chartControl"></param> public override void Create() { // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Bubble Palette"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); // configure the chart m_Chart = nChartControl1.Charts[0]; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal); m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); m_Chart.Axis(StandardAxis.Depth).Visible = false; NLinearScaleConfigurator linearScale = m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator; linearScale.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); linearScale.StripStyles.Add(stripStyle); NOrdinalScaleConfigurator ordinalScale = m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator; ordinalScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; ordinalScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); // add a bubble series m_Bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble); m_Bubble.DataLabelStyle.VertAlign = VertAlign.Center; m_Bubble.DataLabelStyle.Visible = false; m_Bubble.Legend.Mode = SeriesLegendMode.DataPoints; m_Bubble.Legend.Format = "Size <size>, Value <value>"; m_Bubble.MinSize = new NLength(7.0f, NRelativeUnit.ParentPercentage); m_Bubble.MaxSize = new NLength(16.0f, NRelativeUnit.ParentPercentage); for (int i = 0; i < 10; i++) { m_Bubble.Values.Add(i); m_Bubble.Sizes.Add(i * 10 + 10); } m_Bubble.InflateMargins = true; NPalette palette = new NPalette(); palette.SmoothPalette = true; palette.Clear(); palette.Add(0, Color.Green); palette.Add(60, Color.Yellow); palette.Add(120, Color.Red); m_Bubble.Palette = palette; // apply layout ConfigureStandardLayout(m_Chart, title, nChartControl1.Legends[0]); }
private void AddDataPoints(NBubbleSeries bubble) { NChartPalette palette = new NChartPalette(); palette.SetPredefinedPalette(ChartPredefinedPalette.Dark); NColorFillStyle fs0 = new NColorFillStyle(palette.SeriesColors[0]); NColorFillStyle fs1 = new NColorFillStyle(palette.SeriesColors[1]); NColorFillStyle fs2 = new NColorFillStyle(palette.SeriesColors[2]); NColorFillStyle fs3 = new NColorFillStyle(palette.SeriesColors[3]); NColorFillStyle fs4 = new NColorFillStyle(palette.SeriesColors[4]); NColorFillStyle fs5 = new NColorFillStyle(palette.SeriesColors[5]); if (LightingFilterCheckBox.Checked) { fs0.ImageFiltersStyle.Filters.Add(CreateLightingImageFilter()); fs1.ImageFiltersStyle.Filters.Add(CreateLightingImageFilter()); fs2.ImageFiltersStyle.Filters.Add(CreateLightingImageFilter()); fs3.ImageFiltersStyle.Filters.Add(CreateLightingImageFilter()); fs4.ImageFiltersStyle.Filters.Add(CreateLightingImageFilter()); fs5.ImageFiltersStyle.Filters.Add(CreateLightingImageFilter()); } bubble.AddDataPoint(new NBubbleDataPoint(27, 51, 1147995904, "India", fs0)); bubble.AddDataPoint(new NBubbleDataPoint(50, 67, 1321851888, "China", fs1)); bubble.AddDataPoint(new NBubbleDataPoint(76, 22, 109955400, "Mexico", fs2)); bubble.AddDataPoint(new NBubbleDataPoint(210, 9, 142008838, "Russia", fs3)); bubble.AddDataPoint(new NBubbleDataPoint(360, 4, 305843000, "USA", fs4)); bubble.AddDataPoint(new NBubbleDataPoint(470, 5, 33560000, "Canada", fs5)); }
/// <summary> /// /// </summary> /// <returns></returns> protected override NWidget CreateExampleContent() { NChartView chartView = CreateCartesianChartView(); // configure title chartView.Surface.Titles[0].Text = "Axis Model Crossing"; // configure chart m_Chart = (NCartesianChart)chartView.Surface.Charts[0]; m_Chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XYLinear); NCartesianAxis primaryX = m_Chart.Axes[ENCartesianAxis.PrimaryX]; NCartesianAxis primaryY = m_Chart.Axes[ENCartesianAxis.PrimaryY]; // configure axes NLinearScale yScale = (NLinearScale)primaryY.Scale; yScale.MajorGridLines = CreateDottedGrid(); NScaleStrip yStrip = new NScaleStrip(new NColorFill(new NColor(NColor.LightGray, 40)), null, true, 0, 0, 1, 1); yStrip.Interlaced = true; yScale.Strips.Add(yStrip); NLinearScale xScale = (NLinearScale)primaryX.Scale; xScale.MajorGridLines = CreateDottedGrid(); NScaleStrip xStrip = new NScaleStrip(new NColorFill(new NColor(NColor.LightGray, 40)), null, true, 0, 0, 1, 1); xStrip.Interlaced = true; xScale.Strips.Add(xStrip); // cross X and Y axes primaryX.Anchor = new NModelCrossCartesianAxisAnchor(0, ENAxisCrossAlignment.Center, primaryY, ENCartesianAxisOrientation.Horizontal, ENScaleOrientation.Right, 0.0f, 100.0f); primaryY.Anchor = new NModelCrossCartesianAxisAnchor(0, ENAxisCrossAlignment.Center, primaryX, ENCartesianAxisOrientation.Vertical, ENScaleOrientation.Left, 0.0f, 100.0f); // setup bubble series NBubbleSeries bubble = new NBubbleSeries(); bubble.Name = "Bubble Series"; bubble.InflateMargins = true; bubble.DataLabelStyle = new NDataLabelStyle(false); bubble.UseXValues = true; // fill with random data Random random = new Random(); for (int i = 0; i < 10; i++) { bubble.DataPoints.Add(new NBubbleDataPoint(random.Next(-20, 20), random.Next(-20, 20), random.Next(1, 6))); } m_Chart.Series.Add(bubble); chartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, true)); return(chartView); }
/// <summary> /// /// </summary> /// <returns></returns> protected override NWidget CreateExampleContent() { NChartView chartView = CreateCartesianChartView(); // configure title chartView.Surface.Titles[0].Text = "Standard Bubble"; // configure chart m_Chart = (NCartesianChart)chartView.Surface.Charts[0]; m_Chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XOrdinalYLinear); // configure the chart NLinearScale yScale = (NLinearScale)m_Chart.Axes[ENCartesianAxis.PrimaryY].Scale; yScale.MajorGridLines = new NScaleGridLines(); yScale.MajorGridLines.Stroke.DashStyle = ENDashStyle.Dot; // add interlace stripe NScaleStrip strip = new NScaleStrip(new NColorFill(NColor.Beige), null, true, 0, 0, 1, 1); strip.Interlaced = true; yScale.Strips.Add(strip); NOrdinalScale xScale = (NOrdinalScale)m_Chart.Axes[ENCartesianAxis.PrimaryX].Scale; xScale.MajorGridLines = new NScaleGridLines(); xScale.MajorGridLines.Stroke.DashStyle = ENDashStyle.Dot; // add a bubble series m_Bubble = new NBubbleSeries(); m_Bubble.DataLabelStyle = new NDataLabelStyle(); m_Bubble.DataLabelStyle.VertAlign = ENVerticalAlignment.Center; m_Bubble.DataLabelStyle.Visible = false; m_Bubble.LegendView.Mode = ENSeriesLegendMode.DataPoints; m_Bubble.MinSize = 20; m_Bubble.MaxSize = 100; m_Bubble.DataPoints.Add(new NBubbleDataPoint(10, 10, "Company 1")); m_Bubble.DataPoints.Add(new NBubbleDataPoint(15, 20, "Company 2")); m_Bubble.DataPoints.Add(new NBubbleDataPoint(12, 25, "Company 3")); m_Bubble.DataPoints.Add(new NBubbleDataPoint(8, 15, "Company 4")); m_Bubble.DataPoints.Add(new NBubbleDataPoint(14, 17, "Company 5")); m_Bubble.DataPoints.Add(new NBubbleDataPoint(11, 12, "Company 6")); m_Chart.Series.Add(m_Bubble); chartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, true)); return(chartView); }
public override void Initialize() { base.Initialize(); nChartControl1.BackgroundStyle.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant2, Color.White, Color.FromArgb(230, 230, 244)); // add label NLabel title = nChartControl1.Labels.AddHeader("Advanced Gradient Fill Style"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // setup chart and axes m_Chart = nChartControl1.Charts[0]; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective); m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.SoftTopLeft); m_Chart.Axis(StandardAxis.Depth).Visible = false; NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator(); m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.LineStyle.Color = Color.White; linearScale = new NLinearScaleConfigurator(); m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.LineStyle.Color = Color.White; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); // set walls advanced gradient NAdvancedGradientFillStyle ag = AzureLight(); m_Chart.Wall(ChartWallType.Back).FillStyle = ag; m_Chart.Wall(ChartWallType.Left).FillStyle = ag; m_Chart.Wall(ChartWallType.Floor).FillStyle = ag; // create bubble chart m_Bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble); m_Bubble.DataLabelStyle.Visible = false; m_Bubble.Legend.Mode = SeriesLegendMode.DataPoints; m_Bubble.BubbleShape = PointShape.Sphere; m_Bubble.BorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); m_Bubble.UseXValues = true; m_Bubble.InflateMargins = true; m_Bubble.FillStyle = TheEye(); GenerateData(); }
/// <summary> /// /// </summary> /// <returns></returns> protected override NWidget CreateExampleContent() { NChartView chartView = CreateCartesianChartView(); // configure title chartView.Surface.Titles[0].Text = "XY Scatter Bubble"; // configure chart m_Chart = (NCartesianChart)chartView.Surface.Charts[0]; m_Chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XYLinear); // configure the chart NLinearScale yScale = (NLinearScale)m_Chart.Axes[ENCartesianAxis.PrimaryY].Scale; yScale.MajorGridLines = new NScaleGridLines(); yScale.MajorGridLines.Stroke.DashStyle = ENDashStyle.Dot; // add interlace stripe NScaleStrip strip = new NScaleStrip(new NColorFill(NColor.Beige), null, true, 0, 0, 1, 1); strip.Interlaced = true; yScale.Strips.Add(strip); NLinearScale xScale = (NLinearScale)m_Chart.Axes[ENCartesianAxis.PrimaryX].Scale; xScale.MajorGridLines = new NScaleGridLines(); xScale.MajorGridLines.Stroke.DashStyle = ENDashStyle.Dot; // add a bubble series m_Bubble = new NBubbleSeries(); m_Bubble = new NBubbleSeries(); m_Bubble.DataLabelStyle = new NDataLabelStyle(false); m_Bubble.LegendView.Format = "<label>"; m_Bubble.LegendView.Mode = ENSeriesLegendMode.DataPoints; m_Bubble.UseXValues = true; m_Bubble.DataPoints.Add(new NBubbleDataPoint(27, 51, 1147995904, "India")); m_Bubble.DataPoints.Add(new NBubbleDataPoint(50, 67, 1321851888, "China")); m_Bubble.DataPoints.Add(new NBubbleDataPoint(76, 22, 109955400, "Mexico")); m_Bubble.DataPoints.Add(new NBubbleDataPoint(210, 9, 142008838, "Russia")); m_Bubble.DataPoints.Add(new NBubbleDataPoint(360, 4, 305843000, "USA")); m_Bubble.DataPoints.Add(new NBubbleDataPoint(470, 5, 33560000, "Canada")); m_Chart.Series.Add(m_Bubble); chartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, true)); return(chartView); }
void GenerateData() { NBubbleSeries bubble = (NBubbleSeries)nChartControl1.Charts[0].Series[0]; bubble.Values.Clear(); bubble.XValues.Clear(); bubble.ZValues.Clear(); bubble.Sizes.Clear(); bubble.Labels.Clear(); for (int i = 0; i < 4; i++) { bubble.Values.Add(Random.NextDouble() * 5); bubble.XValues.Add(Random.NextDouble() * 5); bubble.ZValues.Add(Random.NextDouble() * 5); bubble.Sizes.Add(Random.NextDouble()); bubble.Labels.Add("Item " + (i + 1).ToString()); } }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Bubble with Empty Data Points"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // setup chart m_Chart = nChartControl1.Charts[0]; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal); m_Chart.Axis(StandardAxis.Depth).Visible = false; m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NLinearScaleConfigurator(); m_Bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble); m_Bubble.InflateMargins = true; m_Bubble.DataLabelStyle.Visible = false; m_Bubble.BubbleShape = PointShape.Sphere; m_Bubble.Legend.Format = "Size:<size>"; m_Bubble.Legend.Mode = SeriesLegendMode.DataPoints; m_Bubble.UseXValues = true; m_Bubble.UseZValues = false; m_Bubble.Values.ValueFormatter = new NNumericValueFormatter("0.00"); m_Bubble.Values.EmptyDataPoints.ValueMode = EmptyDataPointsValueMode.Average; m_Bubble.XValues.ValueFormatter = new NNumericValueFormatter("0.00"); m_Bubble.XValues.EmptyDataPoints.ValueMode = EmptyDataPointsValueMode.Average; m_Bubble.Sizes.ValueFormatter = new NNumericValueFormatter("0.00"); m_Bubble.Sizes.EmptyDataPoints.ValueMode = EmptyDataPointsValueMode.Average; GenerateData(); AppearanceModeCombo.SelectedIndex = 0; MarkerModeCombo.SelectedIndex = 0; ShowLabelsCheck.Checked = false; }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Axis Value Crossing <br/> <font size = '9pt'>Demonstrates how to use of the value cross anchor</font>"); title.TextStyle.TextFormat = TextFormat.XML; title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // turn off the legend nChartControl1.Legends[0].Mode = LegendMode.Disabled; m_Chart = nChartControl1.Charts[0]; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal); m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.NorthernLights); // configure scales NLinearScaleConfigurator yScaleConfigurator = (NLinearScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; NScaleStripStyle yStripStyle = new NScaleStripStyle(new NColorFillStyle(Color.FromArgb(40, Color.LightGray)), null, true, 0, 0, 1, 1); yStripStyle.SetShowAtWall(ChartWallType.Back, true); yStripStyle.Interlaced = true; yScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); yScaleConfigurator.StripStyles.Add(yStripStyle); NLinearScaleConfigurator xScaleConfigurator = new NLinearScaleConfigurator(); NScaleStripStyle xStripStyle = new NScaleStripStyle(new NColorFillStyle(Color.FromArgb(40, Color.LightGray)), null, true, 0, 0, 1, 1); xStripStyle.SetShowAtWall(ChartWallType.Back, true); xStripStyle.Interlaced = true; xScaleConfigurator.StripStyles.Add(xStripStyle); xScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = xScaleConfigurator; // cross X and Y axes m_Chart.Axis(StandardAxis.PrimaryX).Anchor = new NCrossAxisAnchor(AxisOrientation.Horizontal, new NValueAxisCrossing(m_Chart.Axis(StandardAxis.PrimaryY), 0)); m_Chart.Axis(StandardAxis.PrimaryX).Anchor.RulerOrientation = RulerOrientation.Right; m_Chart.Axis(StandardAxis.PrimaryY).Anchor = new NCrossAxisAnchor(AxisOrientation.Vertical, new NValueAxisCrossing(m_Chart.Axis(StandardAxis.PrimaryX), 0)); m_Chart.Axis(StandardAxis.Depth).Visible = false; m_Chart.Wall(ChartWallType.Floor).Visible = false; m_Chart.Wall(ChartWallType.Left).Visible = false; // setup bubble series NBubbleSeries bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble); bubble.Name = "Bubble Series"; bubble.InflateMargins = true; bubble.DataLabelStyle.Visible = false; bubble.UseXValues = true; bubble.BubbleShape = PointShape.Sphere; // fill with random data bubble.Values.FillRandomRange(Random, 10, -20, 20); bubble.XValues.FillRandomRange(Random, 10, -20, 20); bubble.Sizes.FillRandomRange(Random, 10, 1, 6); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); // init form controls LeftAxisScroll.Minimum = -30; LeftAxisScroll.Maximum = 30; LeftAxisScroll.Value = 0; BottomAxisScroll.Minimum = -30; BottomAxisScroll.Maximum = 30; BottomAxisScroll.Value = 0; LeftAxisLabel.Text = LeftAxisScroll.Value.ToString(); BottomAxisLabel.Text = BottomAxisScroll.Value.ToString(); LeftUsePositionCheck.Checked = true; BottomUsePositionCheck.Checked = true; }
protected void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithPercents(LengthBottomAxisDropDownList, 10); WebExamplesUtilities.FillComboWithPercents(LengthLeftAxisDropDownList, 10); } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel header = nChartControl1.Labels.AddHeader("Axis Model Crossing <br/> <font size = '9pt'>Demonstrates how to use the model cross anchor</font>"); header.TextStyle.TextFormat = TextFormat.XML; header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); header.TextStyle.StringFormatStyle.HorzAlign = HorzAlign.Left; header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; header.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL( new NLength(7, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); m_Chart = nChartControl1.Charts[0]; m_Chart.BoundsMode = BoundsMode.Stretch; m_Chart.Location = new NPointL( new NLength(7, NRelativeUnit.ParentPercentage), new NLength(18, NRelativeUnit.ParentPercentage)); m_Chart.Size = new NSizeL( new NLength(86, NRelativeUnit.ParentPercentage), new NLength(75, NRelativeUnit.ParentPercentage)); // configure scales NLinearScaleConfigurator yScaleConfigurator = (NLinearScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; NScaleStripStyle yStripStyle = new NScaleStripStyle(new NColorFillStyle(Color.FromArgb(40, Color.LightGray)), null, true, 0, 0, 1, 1); yStripStyle.SetShowAtWall(ChartWallType.Back, true); yStripStyle.Interlaced = true; yScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); yScaleConfigurator.StripStyles.Add(yStripStyle); NLinearScaleConfigurator xScaleConfigurator = new NLinearScaleConfigurator(); NScaleStripStyle xStripStyle = new NScaleStripStyle(new NColorFillStyle(Color.FromArgb(40, Color.LightGray)), null, true, 0, 0, 1, 1); xStripStyle.SetShowAtWall(ChartWallType.Back, true); xStripStyle.Interlaced = true; xScaleConfigurator.StripStyles.Add(xStripStyle); xScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = xScaleConfigurator; // cross X and Y axes m_Chart.Axis(StandardAxis.PrimaryX).Anchor = new NCrossAxisAnchor(AxisOrientation.Horizontal, new NValueAxisCrossing(m_Chart.Axis(StandardAxis.PrimaryY), 0)); m_Chart.Axis(StandardAxis.PrimaryX).Anchor.RulerOrientation = RulerOrientation.Right; m_Chart.Axis(StandardAxis.PrimaryY).Anchor = new NCrossAxisAnchor(AxisOrientation.Vertical, new NValueAxisCrossing(m_Chart.Axis(StandardAxis.PrimaryX), 0)); m_Chart.Axis(StandardAxis.Depth).Visible = false; m_Chart.Wall(ChartWallType.Floor).Visible = false; m_Chart.Wall(ChartWallType.Left).Visible = false; // setup bubble series NBubbleSeries bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble); bubble.Name = "Bubble Series"; bubble.InflateMargins = true; bubble.DataLabelStyle.Visible = false; bubble.UseXValues = true; bubble.ShadowStyle.Type = ShadowType.GaussianBlur; bubble.BubbleShape = PointShape.Sphere; bubble.Legend.Mode = SeriesLegendMode.None; // fill with random data bubble.Values.FillRandomRange(Random, 10, -20, 20); bubble.XValues.FillRandomRange(Random, 10, -20, 20); bubble.Sizes.FillRandomRange(Random, 10, 1, 6); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); UpdateCrossings(); }
public override void Initialize() { base.Initialize(); nChartControl1.Controller.Tools.Add(new NPanelSelectorTool()); nChartControl1.Controller.Tools.Add(new NTrackballTool()); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Jittering / Blur Effect"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); m_Chart = nChartControl1.Charts[0]; m_Chart.Enable3D = true; m_Chart.Axis(StandardAxis.Depth).Visible = false; m_Chart.Depth = 34; m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.NorthernLights); m_Chart.Projection.Type = ProjectionType.Perspective; m_Chart.Projection.Elevation = 17; m_Chart.Projection.Rotation = -10; Color c = Color.FromArgb(128, 128, 192); m_Chart.Wall(ChartWallType.Left).FillStyle = new NGradientFillStyle(GradientStyle.DiagonalDown, GradientVariant.Variant3, c, Color.White); m_Chart.Wall(ChartWallType.Floor).FillStyle = new NGradientFillStyle(GradientStyle.DiagonalUp, GradientVariant.Variant3, c, Color.White); m_Chart.Wall(ChartWallType.Back).FillStyle = new NGradientFillStyle(GradientStyle.DiagonalDown, GradientVariant.Variant3, c, Color.White); NBubbleSeries bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble); bubble.InflateMargins = false; bubble.DataLabelStyle.Visible = false; bubble.Legend.Mode = SeriesLegendMode.DataPoints; bubble.BubbleShape = PointShape.Sphere; bubble.AddDataPoint(new NBubbleDataPoint(10, 10, "B1", new NColorFillStyle(Color.DarkGoldenrod))); bubble.AddDataPoint(new NBubbleDataPoint(15, 20, "B2", new NColorFillStyle(Color.IndianRed))); bubble.AddDataPoint(new NBubbleDataPoint(12, 25, "B3", new NColorFillStyle(Color.DarkMagenta))); bubble.AddDataPoint(new NBubbleDataPoint(8, 15, "B4", new NColorFillStyle(Color.DarkOrchid))); NBarSeries bar = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar); bar.Name = "Stack 1"; bar.DataLabelStyle.Visible = false; bar.BarShape = BarShape.Cylinder; bar.WidthPercent = 60; bar.DepthPercent = 60; bar.BorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); bar.FillStyle = new NColorFillStyle(Color.CornflowerBlue); bar.Values.FillRandomRange(Random, 4, 5, 15); bar = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar); bar.MultiBarMode = MultiBarMode.Stacked; bar.Name = "Stack 2"; bar.DataLabelStyle.Visible = false; bar.BarShape = BarShape.Cylinder; bar.WidthPercent = 60; bar.DepthPercent = 60; bar.BorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); bar.FillStyle = new NColorFillStyle(Color.Yellow); bar.Values.FillRandomRange(Random, 4, 5, 15); bar = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar); bar.MultiBarMode = MultiBarMode.Stacked; bar.Name = "Stack 3"; bar.DataLabelStyle.Visible = false; bar.BarShape = BarShape.Cylinder; bar.WidthPercent = 60; bar.DepthPercent = 60; bar.BorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); bar.FillStyle = new NColorFillStyle(Color.MediumSeaGreen); bar.Values.FillRandomRange(Random, 4, 5, 15); // init form controls for (int i = 2; i < 17; i++) { JitteringStepsComboBox.Items.Add(i.ToString()); } JitteringStepsComboBox.SelectedIndex = nChartControl1.Settings.JitteringSteps - 2; JitteringDeviationUpDown.Value = (decimal)nChartControl1.Settings.JitteringDeviation; JitteringStepsComboBox.Enabled = false; JitteringDeviationUpDown.Enabled = false; EnableJitteringCheckBox.Checked = false; }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Bubble Scale"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); // configure the chart m_Chart = nChartControl1.Charts[0]; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal); m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); m_Chart.Axis(StandardAxis.Depth).Visible = false; NLinearScaleConfigurator linearScale = m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator; linearScale.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); linearScale.StripStyles.Add(stripStyle); NOrdinalScaleConfigurator ordinalScale = m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator; ordinalScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; ordinalScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); // add a bubble series m_Bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble); m_Bubble.DataLabelStyle.VertAlign = VertAlign.Center; m_Bubble.DataLabelStyle.Visible = false; m_Bubble.MinSize = new NLength(7.0f, NRelativeUnit.ParentPercentage); m_Bubble.MaxSize = new NLength(16.0f, NRelativeUnit.ParentPercentage); for (int i = 0; i < 10; i++) { m_Bubble.Values.Add(i); m_Bubble.Sizes.Add(i * 10 + 10); } m_Bubble.InflateMargins = true; NPalette palette = new NPalette(); palette.SmoothPalette = true; palette.Clear(); palette.Add(0, Color.Green); palette.Add(60, Color.Yellow); palette.Add(120, Color.Red); m_Bubble.Palette = palette; nChartControl1.Legends[0].Header.Text = "Bubble Size"; m_Bubble.Legend.Mode = SeriesLegendMode.SeriesLogic; m_Bubble.BubbleSizeScale.TextOffset = new NLength(0); m_Bubble.BubbleSizeScale.TextStyle.StringFormatStyle.HorzAlign = HorzAlign.Center; m_Bubble.BubbleSizeScale.Mode = BubbleSizeScaleMode.ConcentricDown; // apply layout ConfigureStandardLayout(m_Chart, title, nChartControl1.Legends[0]); BubbleScaleModeCombo.FillFromEnum(typeof(BubbleSizeScaleMode)); BubbleScaleModeCombo.SelectedIndex = (int)m_Bubble.BubbleSizeScale.Mode; TextOffsetNumericUpDown.Value = (decimal)m_Bubble.BubbleSizeScale.TextOffset.Value; TableCellOffsetNumericUpDown.Value = (decimal)m_Bubble.BubbleSizeScale.TableCellOffset.Value; BubbleScaleStepsUpDown.Value = (decimal)m_Bubble.BubbleSizeScale.Steps; RoundValuesCheckBox.Checked = m_Bubble.BubbleSizeScale.RoundValues; BubbleScaleModeCombo_SelectedIndexChanged(null, null); }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Axis Model Crossing <br/> <font size = '9pt'>Demonstrates how to use of the model cross anchor</font>"); title.TextStyle.TextFormat = TextFormat.XML; title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.StringFormatStyle.HorzAlign = HorzAlign.Center; title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // no legends nChartControl1.Legends.Clear(); m_Chart = nChartControl1.Charts[0]; // configure scales NLinearScaleConfigurator yScaleConfigurator = (NLinearScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; NScaleStripStyle yStripStyle = new NScaleStripStyle(new NColorFillStyle(Color.FromArgb(40, Color.LightGray)), null, true, 0, 0, 1, 1); yStripStyle.SetShowAtWall(ChartWallType.Back, true); yStripStyle.Interlaced = true; yScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); yScaleConfigurator.StripStyles.Add(yStripStyle); NLinearScaleConfigurator xScaleConfigurator = new NLinearScaleConfigurator(); NScaleStripStyle xStripStyle = new NScaleStripStyle(new NColorFillStyle(Color.FromArgb(40, Color.LightGray)), null, true, 0, 0, 1, 1); xStripStyle.SetShowAtWall(ChartWallType.Back, true); xStripStyle.Interlaced = true; xScaleConfigurator.StripStyles.Add(xStripStyle); xScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = xScaleConfigurator; // cross X and Y axes m_Chart.Axis(StandardAxis.PrimaryX).Anchor = new NCrossAxisAnchor(AxisOrientation.Horizontal, new NValueAxisCrossing(m_Chart.Axis(StandardAxis.PrimaryY), 0)); m_Chart.Axis(StandardAxis.PrimaryX).Anchor.RulerOrientation = RulerOrientation.Right; m_Chart.Axis(StandardAxis.PrimaryY).Anchor = new NCrossAxisAnchor(AxisOrientation.Vertical, new NValueAxisCrossing(m_Chart.Axis(StandardAxis.PrimaryX), 0)); m_Chart.Axis(StandardAxis.Depth).Visible = false; m_Chart.Wall(ChartWallType.Floor).Visible = false; m_Chart.Wall(ChartWallType.Left).Visible = false; // setup bubble series NBubbleSeries bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble); bubble.Name = "Bubble Series"; bubble.InflateMargins = true; bubble.DataLabelStyle.Visible = false; bubble.UseXValues = true; bubble.BubbleShape = PointShape.Sphere; // fill with random data bubble.Values.FillRandomRange(Random, 10, -20, 20); bubble.XValues.FillRandomRange(Random, 10, -20, 20); bubble.Sizes.FillRandomRange(Random, 10, 1, 6); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); // init form controls LeftAxisAlignmentComboBox.FillFromEnum(typeof(HorzAlign)); LeftAxisAlignmentComboBox.SelectedIndex = (int)HorzAlign.Center; LeftAxisOffsetUC.Length = new NLength(0, NRelativeUnit.ParentPercentage); BottomAxisAlignmentComboBox.FillFromEnum(typeof(VertAlign)); BottomAxisAlignmentComboBox.SelectedIndex = (int)HorzAlign.Center; BottomAxisOffsetUC.Length = new NLength(0, NRelativeUnit.ParentPercentage); m_Updating = false; UpdateCrossings(); }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Lighting Filter"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // setup chart m_Chart = nChartControl1.Charts[0]; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal); m_Chart.Axis(StandardAxis.Depth).Visible = false; NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator(); m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale = new NLinearScaleConfigurator(); m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); m_Bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble); m_Bubble.DataLabelStyle.Visible = false; m_Bubble.Legend.Format = "<label> X:<xvalue> Y:<value> Size:<size>"; m_Bubble.Legend.Mode = SeriesLegendMode.DataPoints; m_Bubble.MinSize = new NLength(10.0f, NRelativeUnit.ParentPercentage); m_Bubble.MaxSize = new NLength(20.0f, NRelativeUnit.ParentPercentage); m_Bubble.UseXValues = true; m_Bubble.ShadowStyle.Type = ShadowType.Solid; m_Bubble.ShadowStyle.Offset = new NPointL(3, 3); m_Bubble.ShadowStyle.Color = Color.FromArgb(60, 0, 0, 0); m_Bubble.BorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); m_Bubble.InflateMargins = true; m_LightingFilter = new NLightingImageFilter(); NFillStyle fillStyle = new NColorFillStyle(Color.Gold); fillStyle.ImageFiltersStyle.Filters.Add(m_LightingFilter); m_Bubble.AddDataPoint(new NBubbleDataPoint(10, 34, 10, "Company1", fillStyle)); fillStyle = new NColorFillStyle(Color.DarkOrange); fillStyle.ImageFiltersStyle.Filters.Add(m_LightingFilter); m_Bubble.AddDataPoint(new NBubbleDataPoint(15, 12, 20, "Company2", fillStyle)); fillStyle = new NColorFillStyle(Color.Crimson); fillStyle.ImageFiltersStyle.Filters.Add(m_LightingFilter); m_Bubble.AddDataPoint(new NBubbleDataPoint(12, 24, 25, "Company3", fillStyle)); fillStyle = new NColorFillStyle(Color.DarkOrchid); fillStyle.ImageFiltersStyle.Filters.Add(m_LightingFilter); m_Bubble.AddDataPoint(new NBubbleDataPoint(8, 56, 15, "Company4", fillStyle)); BubbleShapeCombo.FillFromEnum(typeof(PointShape)); BubbleShapeCombo.SelectedIndex = 7; InflateMargins.Checked = true; LightSourceTypeComboBox.FillFromEnum(typeof(LightSourceType)); BlurTypeComboBox.FillFromEnum(typeof(BlurType)); BevelDepthNumericUpDown.Value = (decimal)m_LightingFilter.BevelDepth.Value; BlurTypeComboBox.SelectedIndex = (int)m_LightingFilter.BlurType; SurfaceScaleNumericUpDown.Value = (decimal)m_LightingFilter.SurfaceScale; ShininessNumericUpDown.Value = (decimal)m_LightingFilter.Shininess; LightSourceTypeComboBox.SelectedIndex = (int)m_LightingFilter.LightSourceType; NVector3DF vector = m_LightingFilter.Position; PositionXnumericUpDown.Value = (decimal)vector.X; PositionYnumericUpDown.Value = (decimal)vector.Y; PositionZnumericUpDown.Value = (decimal)vector.Z; m_Updating = false; }
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]); }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Axis Value Crossing <br/> <font size = '9pt'>Demonstrates how to use of the value cross anchor</font>"); title.TextStyle.TextFormat = TextFormat.XML; title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // turn off the legend nChartControl1.Legends[0].Mode = LegendMode.Disabled; m_Chart = nChartControl1.Charts[0]; m_Chart.Enable3D = true; m_Chart.Width = m_Chart.Height = m_Chart.Depth = 50; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.NorthernLights); NAxis xAxis = m_Chart.Axis(StandardAxis.PrimaryX); NAxis yAxis = m_Chart.Axis(StandardAxis.PrimaryY); NAxis zAxis = m_Chart.Axis(StandardAxis.Depth); // cross X and Y axes xAxis.Anchor = new NCrossAxisAnchor(AxisOrientation.Horizontal); ((NCrossAxisAnchor)xAxis.Anchor).Crossings.Add(new NValueAxisCrossing(yAxis, 0)); ((NCrossAxisAnchor)xAxis.Anchor).Crossings.Add(new NValueAxisCrossing(zAxis, 0)); yAxis.Anchor = new NCrossAxisAnchor(AxisOrientation.Vertical); ((NCrossAxisAnchor)yAxis.Anchor).Crossings.Add(new NValueAxisCrossing(xAxis, 0)); ((NCrossAxisAnchor)yAxis.Anchor).Crossings.Add(new NValueAxisCrossing(zAxis, 0)); zAxis.Anchor = new NCrossAxisAnchor(AxisOrientation.Depth); ((NCrossAxisAnchor)zAxis.Anchor).Crossings.Add(new NValueAxisCrossing(xAxis, 0)); ((NCrossAxisAnchor)zAxis.Anchor).Crossings.Add(new NValueAxisCrossing(yAxis, 0)); m_Chart.Wall(ChartWallType.Back).Visible = false; m_Chart.Wall(ChartWallType.Floor).Visible = false; m_Chart.Wall(ChartWallType.Left).Visible = false; // setup bubble series NBubbleSeries bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble); bubble.Name = "Bubble Series"; bubble.InflateMargins = true; bubble.DataLabelStyle.Visible = false; bubble.UseXValues = true; bubble.UseZValues = true; bubble.BubbleShape = PointShape.Sphere; // fill with random data bubble.Values.FillRandomRange(Random, 10, -20, 20); bubble.XValues.FillRandomRange(Random, 10, -20, 20); bubble.ZValues.FillRandomRange(Random, 10, -20, 20); bubble.Sizes.FillRandomRange(Random, 10, 1, 6); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); XUsePositionCheck.Checked = true; YUsePositionCheck.Checked = true; ZUsePositionCheck.Checked = true; nChartControl1.Controller.Tools.Add(new NPanelSelectorTool()); nChartControl1.Controller.Tools.Add(new NTrackballTool()); }
/// <summary> /// Called to initialize the example /// </summary> /// <param name="chartControl"></param> public override void Create() { // set a chart title NLabel title = nChartControl1.Labels.AddHeader("XY Bubble Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); // setup chart m_Chart = nChartControl1.Charts[0]; NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; // add interlace style NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(new NArgbColor(Color.Beige)), null, true, 0, 0, 1, 1); stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); stripStyle.Interlaced = true; linearScale.StripStyles.Add(stripStyle); linearScale = new NLinearScaleConfigurator(); m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); m_Bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble); m_Bubble.DataLabelStyle.Visible = false; m_Bubble.Legend.Format = "<label>"; m_Bubble.Legend.Mode = SeriesLegendMode.DataPoints; m_Bubble.ShadowStyle.Type = ShadowType.Solid; m_Bubble.ShadowStyle.Offset = new NPointL(1.2f, 1.2f); m_Bubble.ShadowStyle.Color = Color.FromArgb(60, 0, 0, 0); m_Bubble.UseXValues = true; m_Bubble.AddDataPoint(new NBubbleDataPoint(27, 51, 1147995904, "India")); m_Bubble.AddDataPoint(new NBubbleDataPoint(50, 67, 1321851888, "China")); m_Bubble.AddDataPoint(new NBubbleDataPoint(76, 22, 109955400, "Mexico")); m_Bubble.AddDataPoint(new NBubbleDataPoint(210, 9, 142008838, "Russia")); m_Bubble.AddDataPoint(new NBubbleDataPoint(360, 4, 305843000, "USA")); m_Bubble.AddDataPoint(new NBubbleDataPoint(470, 5, 33560000, "Canada")); // apply layout ConfigureStandardLayout(m_Chart, title, nChartControl1.Legends[0]); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); nChartControl1.Controller.Tools.Add(new NPanelSelectorTool()); nChartControl1.Controller.Tools.Add(new NTrackballTool()); // init form controls NExampleHelpers.FillComboWithEnumValues(BubbleShapeComboBox, typeof(PointShape)); BubbleShapeComboBox.SelectedIndex = 6; LegendFormatComboBox.Items.Add("Value and Label"); LegendFormatComboBox.Items.Add("Value"); LegendFormatComboBox.Items.Add("Label"); LegendFormatComboBox.Items.Add("Size"); LegendFormatComboBox.SelectedIndex = 2; InflateMarginsCheckBox.IsChecked = true; DifferentColorsCheckBox.IsChecked = true; MaxBubbleSizeScrollBar.Value = m_Bubble.MaxSize.Value / 100.0f; MinBubbleSizeScrollBar.Value = m_Bubble.MinSize.Value / 100.0f; InflateMarginsCheckBox_Checked(null, null); DifferentColorsCheckBox_Checked(null, null); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithEnumValues(BubbleShapeDropDownList, typeof(PointShape)); BubbleShapeDropDownList.SelectedIndex = 6; WebExamplesUtilities.FillComboWithValues(MinBubbleSizeDropDownList, 0, 30, 5); WebExamplesUtilities.FillComboWithValues(MaxBubbleSizeDropDownList, 0, 30, 5); MinBubbleSizeDropDownList.SelectedIndex = 2; MaxBubbleSizeDropDownList.SelectedIndex = 4; DifferentColorsCheckBox.Checked = true; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("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.Enable3D = false; // setup X axis NOrdinalScaleConfigurator scaleX = (NOrdinalScaleConfigurator)chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator; scaleX.AutoLabels = false; scaleX.DisplayDataPointsBetweenTicks = false; scaleX.MajorTickMode = MajorTickMode.CustomTicks; scaleX.CustomMajorTicks.AddRange(new long[] { 0, 1, 2, 3, 4, 5 }); scaleX.CustomLabels.Add(new NCustomValueLabel(0, "A")); scaleX.CustomLabels.Add(new NCustomValueLabel(1, "B")); scaleX.CustomLabels.Add(new NCustomValueLabel(2, "C")); scaleX.CustomLabels.Add(new NCustomValueLabel(3, "D")); scaleX.CustomLabels.Add(new NCustomValueLabel(4, "E")); scaleX.CustomLabels.Add(new NCustomValueLabel(5, "F")); // add interlace stripe NLinearScaleConfigurator scaleY = (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); scaleY.StripStyles.Add(stripStyle); NBubbleSeries bubble = (NBubbleSeries)chart.Series.Add(SeriesType.Bubble); bubble.InflateMargins = true; bubble.DataLabelStyle.Visible = false; bubble.Legend.Mode = SeriesLegendMode.DataPoints; bubble.Legend.Format = "<size> <label>"; bubble.AddDataPoint(new NBubbleDataPoint(10, 10, "A")); bubble.AddDataPoint(new NBubbleDataPoint(15, 20, "B")); bubble.AddDataPoint(new NBubbleDataPoint(12, 25, "C")); bubble.AddDataPoint(new NBubbleDataPoint(8, 15, "D")); bubble.AddDataPoint(new NBubbleDataPoint(14, 17, "E")); bubble.AddDataPoint(new NBubbleDataPoint(11, 12, "F")); bubble.BubbleShape = (PointShape)BubbleShapeDropDownList.SelectedIndex; bubble.MinSize = new NLength(MinBubbleSizeDropDownList.SelectedIndex * 5, NRelativeUnit.ParentPercentage); bubble.MaxSize = new NLength(MaxBubbleSizeDropDownList.SelectedIndex * 5, NRelativeUnit.ParentPercentage); if (DifferentColorsCheckBox.Checked) { // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); } else { // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); } // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]); }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Glow filter - Inner and Outer glow"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // setup chart m_Chart = nChartControl1.Charts[0]; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal); m_Chart.Axis(StandardAxis.Depth).Visible = false; NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator(); m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale = new NLinearScaleConfigurator(); m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); m_Bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble); m_Bubble.DataLabelStyle.Visible = false; m_Bubble.Legend.Format = "<label> X:<xvalue> Y:<value> Size:<size>"; m_Bubble.Legend.Mode = SeriesLegendMode.DataPoints; m_Bubble.MinSize = new NLength(10.0f, NRelativeUnit.ParentPercentage); m_Bubble.MaxSize = new NLength(20.0f, NRelativeUnit.ParentPercentage); m_Bubble.UseXValues = true; m_Bubble.BorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); m_GlowFilter = new NGlowImageFilter(); NFillStyle fillStyle = new NColorFillStyle(Color.Gold); fillStyle.ImageFiltersStyle.Filters.Add(m_GlowFilter); m_Bubble.AddDataPoint(new NBubbleDataPoint(10, 34, 10, "Company1", fillStyle)); fillStyle = new NColorFillStyle(Color.DarkOrange); fillStyle.ImageFiltersStyle.Filters.Add(m_GlowFilter); m_Bubble.AddDataPoint(new NBubbleDataPoint(15, 12, 20, "Company2", fillStyle)); fillStyle = new NColorFillStyle(Color.Crimson); fillStyle.ImageFiltersStyle.Filters.Add(m_GlowFilter); m_Bubble.AddDataPoint(new NBubbleDataPoint(12, 24, 25, "Company3", fillStyle)); fillStyle = new NColorFillStyle(Color.DarkOrchid); fillStyle.ImageFiltersStyle.Filters.Add(m_GlowFilter); m_Bubble.AddDataPoint(new NBubbleDataPoint(8, 56, 15, "Company4", fillStyle)); BubbleShapeCombo.SelectedIndex = 7; InflateMargins.Checked = true; m_bUpdate = true; GlowTypeComboBox.SelectedIndex = (int)m_GlowFilter.GlowType; DepthNumericUpDown.Value = (decimal)m_GlowFilter.Depth.Value; BlurTypeComboBox.SelectedIndex = (int)m_GlowFilter.BlurType; OriginalOpacityNumericUpDown.Value = (decimal)m_GlowFilter.OriginalOpacity; m_bUpdate = false; }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("XY Bubble Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); // setup chart m_Chart = nChartControl1.Charts[0]; NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; // add interlace style NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(new NArgbColor(Color.Beige)), null, true, 0, 0, 1, 1); stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); stripStyle.Interlaced = true; linearScale.StripStyles.Add(stripStyle); linearScale = new NLinearScaleConfigurator(); m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); m_Bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble); m_Bubble.DataLabelStyle.Visible = false; m_Bubble.Legend.Format = "<label>"; m_Bubble.Legend.Mode = SeriesLegendMode.DataPoints; m_Bubble.ShadowStyle.Type = ShadowType.Solid; m_Bubble.ShadowStyle.Offset = new NPointL(1.2f, 1.2f); m_Bubble.ShadowStyle.Color = Color.FromArgb(60, 0, 0, 0); m_Bubble.UseXValues = true; m_Bubble.AddDataPoint(new NBubbleDataPoint(27, 51, 1147995904, "India")); m_Bubble.AddDataPoint(new NBubbleDataPoint(50, 67, 1321851888, "China")); m_Bubble.AddDataPoint(new NBubbleDataPoint(76, 22, 109955400, "Mexico")); m_Bubble.AddDataPoint(new NBubbleDataPoint(210, 9, 142008838, "Russia")); m_Bubble.AddDataPoint(new NBubbleDataPoint(360, 4, 305843000, "USA")); m_Bubble.AddDataPoint(new NBubbleDataPoint(470, 5, 33560000, "Canada")); // apply layout ConfigureStandardLayout(m_Chart, title, nChartControl1.Legends[0]); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); // init form controls BubbleShapeCombo.FillFromEnum(typeof(PointShape)); BubbleShapeCombo.SelectedIndex = 7; AxesRoundToTick.Checked = true; InflateMargins.Checked = true; MinBubbleSizeScroll.Value = 4; MaxBubbleSizeScroll.Value = 20; }
/// <summary> /// Called to initialize the example /// </summary> /// <param name="chartControl"></param> public override void Create() { nChartControl1.Controller.Tools.Add(new NPanelSelectorTool()); nChartControl1.Controller.Tools.Add(new NTrackballTool()); // set a chart title NLabel title = new NLabel("XYZ Bubble Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); // setup chart m_Chart = nChartControl1.Charts[0]; m_Chart.Enable3D = true; m_Chart.Width = 50; m_Chart.Depth = 50; m_Chart.Height = 50; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); NLinearScaleConfigurator depthScale = new NLinearScaleConfigurator(); depthScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; depthScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true); depthScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true); m_Chart.Axis(StandardAxis.Depth).ScaleConfigurator = depthScale; NLinearScaleConfigurator yScale = new NLinearScaleConfigurator(); yScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; yScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); yScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true); // add interlace style NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(new NArgbColor(Color.Beige)), null, true, 0, 0, 1, 1); stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); stripStyle.Interlaced = true; yScale.StripStyles.Add(stripStyle); m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = yScale; // switch the x axis in linear mode NLinearScaleConfigurator xScale = new NLinearScaleConfigurator(); xScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; xScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true); xScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = xScale; m_Bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble); m_Bubble.InflateMargins = true; m_Bubble.DataLabelStyle.Visible = false; m_Bubble.BubbleShape = PointShape.Sphere; m_Bubble.Legend.Format = "x:<xvalue> y:<value> z:<zvalue> sz:<size>"; m_Bubble.Legend.Mode = SeriesLegendMode.DataPoints; m_Bubble.MinSize = new NLength(10.0f, NRelativeUnit.ParentPercentage); m_Bubble.MaxSize = new NLength(20.0f, NRelativeUnit.ParentPercentage); m_Bubble.UseXValues = true; m_Bubble.UseZValues = true; m_Bubble.Values.ValueFormatter = new NNumericValueFormatter("0.#"); m_Bubble.XValues.ValueFormatter = new NNumericValueFormatter("0.#"); m_Bubble.ZValues.ValueFormatter = new NNumericValueFormatter("0.#"); m_Bubble.Sizes.ValueFormatter = new NNumericValueFormatter("0.#"); GenerateData(); // apply layout ConfigureStandardLayout(m_Chart, title, nChartControl1.Legends[0]); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); }
public override void Initialize() { base.Initialize(); // load textures from resources Bitmap bmp0 = NResourceHelper.BitmapFromResource(this.GetType(), "Back.png", "Nevron.Examples.Chart.WinForm.Resources"); Bitmap bmp1 = NResourceHelper.BitmapFromResource(this.GetType(), "Leafs.png", "Nevron.Examples.Chart.WinForm.Resources"); Bitmap bmp2 = NResourceHelper.BitmapFromResource(this.GetType(), "Banner.png", "Nevron.Examples.Chart.WinForm.Resources"); NImageFillStyle imageFillStyle = new NImageFillStyle(bmp0); imageFillStyle.TextureMappingStyle.MapLayout = MapLayout.Tiled; nChartControl1.BackgroundStyle.FillStyle = imageFillStyle; // add label NLabel title = nChartControl1.Labels.AddHeader("Image Fill Style"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // setup chart and axes m_Chart = nChartControl1.Charts[0]; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective); m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.SoftTopLeft); m_Chart.Axis(StandardAxis.Depth).Visible = false; NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.LineStyle.Color = Color.White; linearScale = new NLinearScaleConfigurator(); m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.LineStyle.Color = Color.White; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); // Setup walls Color c = Color.FromArgb(128, 128, 192); imageFillStyle = new NImageFillStyle(bmp1); imageFillStyle.TextureMappingStyle.MapLayout = MapLayout.Tiled; m_Chart.Wall(ChartWallType.Back).FillStyle = imageFillStyle; m_Chart.Wall(ChartWallType.Left).FillStyle = imageFillStyle; m_Chart.Wall(ChartWallType.Floor).FillStyle = imageFillStyle; // create bubble chart m_Bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble); m_Bubble.DataLabelStyle.Visible = false; m_Bubble.Legend.Mode = SeriesLegendMode.DataPoints; m_Bubble.BubbleShape = PointShape.Ellipse; m_Bubble.UseXValues = true; m_Bubble.InflateMargins = true; m_Bubble.BorderStyle.Width = new NLength(1, NGraphicsUnit.Pixel); m_Bubble.FillStyle = new NImageFillStyle(bmp2); GenerateData(); }
protected void Page_Load(object sender, EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Bubble Palette"); 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 = false; NLinearScaleConfigurator linearScale = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator; linearScale.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); linearScale.StripStyles.Add(stripStyle); NOrdinalScaleConfigurator ordinalScale = chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator; ordinalScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; ordinalScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); // add a bubble series NBubbleSeries bubble = (NBubbleSeries)chart.Series.Add(SeriesType.Bubble); bubble.DataLabelStyle.VertAlign = VertAlign.Center; bubble.DataLabelStyle.Visible = false; bubble.Legend.Mode = SeriesLegendMode.DataPoints; bubble.Legend.Format = "<size>"; bubble.MinSize = new NLength(7.0f, NRelativeUnit.ParentPercentage); bubble.MaxSize = new NLength(16.0f, NRelativeUnit.ParentPercentage); for (int i = 0; i < 10; i++) { bubble.Values.Add(i); bubble.Sizes.Add(i * 10 + 10); } bubble.InflateMargins = true; NPalette palette = new NPalette(); palette.SmoothPalette = true; palette.Clear(); palette.Add(0, Color.Green); palette.Add(60, Color.Yellow); palette.Add(120, Color.Red); bubble.Palette = palette; // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]); }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("2D Bubble Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); // configure the chart m_Chart = nChartControl1.Charts[0]; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal); m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); m_Chart.Axis(StandardAxis.Depth).Visible = false; NLinearScaleConfigurator linearScale = m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator; linearScale.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); linearScale.StripStyles.Add(stripStyle); NOrdinalScaleConfigurator ordinalScale = m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator; ordinalScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; ordinalScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); // add a bubble series m_Bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble); m_Bubble.DataLabelStyle.VertAlign = VertAlign.Center; m_Bubble.DataLabelStyle.Visible = false; m_Bubble.Legend.Mode = SeriesLegendMode.DataPoints; m_Bubble.MinSize = new NLength(7.0f, NRelativeUnit.ParentPercentage); m_Bubble.MaxSize = new NLength(16.0f, NRelativeUnit.ParentPercentage); m_Bubble.AddDataPoint(new NBubbleDataPoint(10, 10, "Company 1")); m_Bubble.AddDataPoint(new NBubbleDataPoint(15, 20, "Company 2")); m_Bubble.AddDataPoint(new NBubbleDataPoint(12, 25, "Company 3")); m_Bubble.AddDataPoint(new NBubbleDataPoint(8, 15, "Company 4")); m_Bubble.AddDataPoint(new NBubbleDataPoint(14, 17, "Company 5")); m_Bubble.AddDataPoint(new NBubbleDataPoint(11, 12, "Company 6")); // apply layout ConfigureStandardLayout(m_Chart, title, nChartControl1.Legends[0]); // init form controls BubbleShapeCombo.FillFromEnum(typeof(PointShape)); BubbleShapeCombo.SelectedIndex = 6; LegendFormatCombo.Items.Add("Value and Label"); LegendFormatCombo.Items.Add("Value"); LegendFormatCombo.Items.Add("Label"); LegendFormatCombo.Items.Add("Size"); LegendFormatCombo.SelectedIndex = 2; InflateMargins.Checked = true; DifferentColors.Checked = true; }
protected void Page_Load(object sender, EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Settings.JitterMode = JitterMode.Enabled; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("XYZ 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.Enable3D = true; chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); chart.Width = 60; chart.Height = 60; chart.Depth = 60; // setup Y axis NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; scaleY.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; scaleY.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 8); // add interlace stripe NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); scaleY.StripStyles.Add(stripStyle); // setup X axis NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator(); scaleX.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; scaleX.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 8); scaleX.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back, ChartWallType.Floor }; chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; // setup Z axis NLinearScaleConfigurator scaleZ = new NLinearScaleConfigurator(); scaleZ.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; scaleZ.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 8); scaleZ.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Left, ChartWallType.Floor }; chart.Axis(StandardAxis.Depth).ScaleConfigurator = scaleZ; // setup bubble series NBubbleSeries bubble = (NBubbleSeries)chart.Series.Add(SeriesType.Bubble); bubble.InflateMargins = true; bubble.DataLabelStyle.Visible = false; bubble.Legend.Mode = SeriesLegendMode.DataPoints; bubble.Legend.Format = "<label>"; bubble.BubbleShape = PointShape.Sphere; bubble.UseXValues = true; bubble.UseZValues = true; GenerateData(); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]); }