public override void Initialize() { base.Initialize(); // set a chart title NLabel title = new NLabel("XY Bars"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); // configure the chart m_Chart = nChartControl1.Charts[0]; m_Chart.Enable3D = true; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.OrthogonalHalf); m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); m_Chart.Axis(StandardAxis.Depth).Visible = false; // switch the categories axis in numeric mode m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NLinearScaleConfigurator(); // add interlaced stripe NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator(); NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(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); m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale; // create the shape series m_Shape = (NShapeSeries)m_Chart.Series.Add(SeriesType.Shape); // show information about the data points in the legend m_Shape.Legend.Mode = SeriesLegendMode.DataPoints; // show the Y size and label in the legend m_Shape.Legend.Format = "<ysize> <label>"; // show the Y size and label in the data point labels m_Shape.DataLabelStyle.Format = "<ysize> <label>"; // use custom X positions m_Shape.UseXValues = true; // X sizes are specified in Model units (the default is Scale) // this will make the bars size independant from the scale of the X axis m_Shape.XSizesUnits = MeasurementUnits.Model; // this will require to set the InflateMargins flag to true since in this mode // scale is determined only by the X positions of the shape and will not take // into account the size of the bars. m_Shape.InflateMargins = true; // position all shapes at the series Z order m_Shape.UseZValues = false; // add the bars // add Bar1 m_Shape.AddDataPoint(new NShapeDataPoint( 10, // Y center of bar -> half its Y size 12, // X position 0, // Z position - not used since UseZValue is set to false 10, // X size - 10 model units 20, // Y size of bar 0.66, // Z size - 2 thirds of series depth "Bar1", // label new NColorFillStyle(Color.LightGreen) )); // add Bar2 m_Shape.AddDataPoint(new NShapeDataPoint( 20, // Y center of bar -> half its Y size 34, // X position - not used since UseXValue is set to false 0, // Z position - not used since UseZValue is set to false 10, // X size - 10 model units 40, // Y size of bar 0.33, // Z size - 1 third of series depth "Bar2", // label new NColorFillStyle(Color.LightCoral) )); // add Bar3 m_Shape.AddDataPoint(new NShapeDataPoint( 15, // Y center of bar -> half its Y size 50, // X position - not used since UseXValue is set to false 0, // Z position - not used since UseZValue is set to false 10, // X size - 10 model units 30, // Y size of bar 0.5, // Z size - half series depth "Bar3", // label new NColorFillStyle(Color.LightSalmon) )); // 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 InflateMarginsCheckBox.Checked = true; AxesRoundToTickCheck.Checked = true; StyleCombo.SelectedIndex = 0; }
public override void Initialize() { base.Initialize(); nChartControl1.Controller.Tools.Add(new NPanelSelectorTool()); nChartControl1.Controller.Tools.Add(new NTrackballTool()); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("XYZ Scatter Bubbles"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); // chart settings m_Chart = nChartControl1.Charts[0]; m_Chart.Enable3D = true; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); m_Chart.Projection.Elevation -= 10; m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); m_Chart.Depth = 55.0f; m_Chart.Width = 55.0f; m_Chart.Height = 55.0f; // switch the PrimaryX and Depth axes in numeric mode in order to correctly scale the custom X and Z positions NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator(); m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true); linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale = new NLinearScaleConfigurator(); m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true); linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; // add interlaced stripe NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(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.Depth).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true); linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true); // create the shape series m_Shape = (NShapeSeries)m_Chart.Series.Add(SeriesType.Shape); m_Shape.DataLabelStyle.Visible = false; m_Shape.DataLabelStyle.Format = "<ysize> <label>"; // show information about the data points in the legend m_Shape.Legend.Mode = SeriesLegendMode.DataPoints; // show the Y size and label in the legend m_Shape.Legend.Format = "<ysize> <label>"; // use custom X positions m_Shape.UseXValues = true; // use custom Z positions m_Shape.UseZValues = true; // X sizes are specified in Model units (the default is Scale) // they will not depend on the X axis scale m_Shape.XSizesUnits = MeasurementUnits.Model; // Z sizes are specified in Model units (the default is Scale) // they will not depend on the Z axis scale m_Shape.ZSizesUnits = MeasurementUnits.Model; // Y sizes are specified in Model units (the default is Scale) // they will not depend on the Y axis scale m_Shape.YSizesUnits = MeasurementUnits.Model; // this will require to set the InflateMargins flag to true since in this mode // scale is determined only by the X positions of the shape and will not take // into account the size of the bubbles. m_Shape.InflateMargins = true; // add the bubbles m_Shape.AddDataPoint(new NShapeDataPoint(10, 12, 56, 24, 24, 24, "bubble1")); m_Shape.AddDataPoint(new NShapeDataPoint(20, 14, 12, 10, 10, 10, "bubble2")); m_Shape.AddDataPoint(new NShapeDataPoint(15, 50, 45, 19, 19, 19, "bubble3")); // 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 AxesRoundToTickCheck.Checked = true; InflateMarginsCheckBox.Checked = true; StyleCombo.SelectedIndex = 6; }
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("Shape Series used to display a house"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); // setup chart m_Chart = nChartControl1.Charts[0]; m_Chart.Enable3D = true; m_Chart.Depth = 55.0f; m_Chart.Width = 55.0f; m_Chart.Height = 55.0f; m_Chart.Projection.Type = ProjectionType.Perspective; m_Chart.Projection.Rotation = -19.0f; m_Chart.Projection.Elevation = 20.0f; // configure axes NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator(); m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale; linearScale.MajorTickMode = MajorTickMode.AutoMaxCount; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true); linearScale = new NLinearScaleConfigurator(); m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale; linearScale.MajorTickMode = MajorTickMode.AutoMaxCount; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true); linearScale = new NLinearScaleConfigurator(); m_Chart.Axis(StandardAxis.Depth).ScaleConfigurator = linearScale; linearScale.MajorTickMode = MajorTickMode.AutoMaxCount; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true); linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true); NLegend legend = (NLegend)nChartControl1.Legends[0]; legend.Data.MarkSize = new NSizeL(20, 20); // create the door NShapeSeries shape = (NShapeSeries)m_Chart.Series.Add(SeriesType.Shape); shape.Name = "door"; shape.DataLabelStyle.Visible = false; shape.UseXValues = true; shape.UseZValues = true; shape.Shape = BarShape.Bar; shape.AddDataPoint(new NShapeDataPoint(-0.5, -0.25, -1.0, 0.5, 1.5, 0.02)); NImageFillStyle doorFS = new NImageFillStyle(NResourceHelper.BitmapFromResource(this.GetType(), "Door.jpg", "Nevron.Examples.Chart.WinForm.Resources")); shape.FillStyle = doorFS; // create the window shape = (NShapeSeries)m_Chart.Series.Add(SeriesType.Shape); shape.Name = "window"; shape.DataLabelStyle.Visible = false; shape.UseXValues = true; shape.UseZValues = true; shape.Shape = BarShape.Bar; shape.AddDataPoint(new NShapeDataPoint(0.4, 0.0, -1.0, 0.75, 1.0, 0.02)); NImageFillStyle windowFS = new NImageFillStyle(NResourceHelper.BitmapFromResource(this.GetType(), "Window.jpg", "Nevron.Examples.Chart.WinForm.Resources")); shape.FillStyle = windowFS; // create the house shape = (NShapeSeries)m_Chart.Series.Add(SeriesType.Shape); shape.Name = "house"; shape.DataLabelStyle.Visible = false; shape.UseXValues = true; shape.UseZValues = true; shape.Shape = BarShape.Bar; shape.AddDataPoint(new NShapeDataPoint(0.0, 0.0, 0.0, 2.0, 2.0, 2.0)); shape.FillStyle = new NColorFillStyle(Color.White); NImageFillStyle houseFS = new NImageFillStyle(NResourceHelper.BitmapFromResource(this.GetType(), "Cobblestone.jpg", "Nevron.Examples.Chart.WinForm.Resources")); houseFS.TextureMappingStyle.MapLayout = MapLayout.Tiled; houseFS.TextureMappingStyle.HorizontalScale = 0.1f; houseFS.TextureMappingStyle.VerticalScale = 0.1f; shape.FillStyle = houseFS; // create the roof shape = (NShapeSeries)m_Chart.Series.Add(SeriesType.Shape); shape.Name = "roof"; shape.DataLabelStyle.Visible = false; shape.UseXValues = true; shape.UseZValues = true; shape.Shape = BarShape.Pyramid; shape.AddDataPoint(new NShapeDataPoint(0.0, 1.5, 0.0, 2.4, 1.0, 2.4)); NImageFillStyle roofFS = new NImageFillStyle(NResourceHelper.BitmapFromResource(this.GetType(), "Rooftile.jpg", "Nevron.Examples.Chart.WinForm.Resources")); roofFS.TextureMappingStyle.MapLayout = MapLayout.Tiled; roofFS.TextureMappingStyle.HorizontalScale = 0.2f; roofFS.TextureMappingStyle.VerticalScale = 0.2f; shape.FillStyle = roofFS; // create the chimney shape = (NShapeSeries)m_Chart.Series.Add(SeriesType.Shape); shape.Name = "chimney"; shape.DataLabelStyle.Visible = false; shape.UseXValues = true; shape.UseZValues = true; shape.Shape = BarShape.Cylinder; shape.AddDataPoint(new NShapeDataPoint(0.75, 1.5, 0.0, 0.2, 1.0, 0.2)); NImageFillStyle chimneyFS = new NImageFillStyle(NResourceHelper.BitmapFromResource(this.GetType(), "Bricks.jpg", "Nevron.Examples.Chart.WinForm.Resources")); chimneyFS.TextureMappingStyle.MapLayout = MapLayout.Tiled; chimneyFS.TextureMappingStyle.HorizontalScale = 0.1f; chimneyFS.TextureMappingStyle.VerticalScale = 0.1f; shape.FillStyle = chimneyFS; // apply layout ConfigureStandardLayout(m_Chart, title, nChartControl1.Legends[0]); }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Bars with different X and Z sizes"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); // configure the chart m_Chart = nChartControl1.Charts[0]; m_Chart.Enable3D = true; m_Chart.Axis(StandardAxis.Depth).Visible = false; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1); m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); // add interlaced stripe NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator(); NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(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); m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale; // create the shape series m_Shape = (NShapeSeries)m_Chart.Series.Add(SeriesType.Shape); // show information about the data points in the legend m_Shape.Legend.Mode = SeriesLegendMode.DataPoints; // show the Y size and label in the legend m_Shape.Legend.Format = "<ysize> <label>"; // show the Y size and label in the data point labels m_Shape.DataLabelStyle.Format = "<ysize> <label>"; // use default category positions m_Shape.UseXValues = false; m_Shape.UseZValues = false; // add the bars // add Bar1 m_Shape.AddDataPoint(new NShapeDataPoint( 10, // Y center of bar -> half its Y size 0, // X position - not used since UseXValue is set to false 0, // Z position - not used since UseZValue is set to false 0.5, // X size - half category in width 20, // Y size of bar 0.66, // Z size - 2 thirds of series depth "Bar1" // label )); // add Bar2 m_Shape.AddDataPoint(new NShapeDataPoint( 20, // Y center of bar -> half its Y size 0, // X position - not used since UseXValue is set to false 0, // Z position - not used since UseZValue is set to false 0.33, // X size - approximately 1 third of category width 40, // Y size of bar 0.33, // Z size - 1 third of series depth "Bar2" // label )); // add Bar3 m_Shape.AddDataPoint(new NShapeDataPoint( 15, // Y center of bar -> half its Y size 0, // X position - not used since UseXValue is set to false 0, // Z position - not used since UseZValue is set to false 0.5, // X size - half category width 30, // Y size of bar 0.5, // Z size - half series depth "Bar3" // label) )); // 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 StyleCombo.FillFromEnum(typeof(BarShape)); StyleCombo.SelectedIndex = 0; }