Esempio n. 1
0
        private void ChimneyFillStyleButton_Click(object sender, System.EventArgs e)
        {
            NShapeSeries shape = (NShapeSeries)m_Chart.Series[4];
            NFillStyle   fillStyleResult;

            if (NFillStyleTypeEditor.Edit(shape.FillStyle, out fillStyleResult))
            {
                shape.FillStyle = fillStyleResult;
                nChartControl1.Refresh();
            }
        }
        void InitializeChartData(NCartesianChart chart, NCustomToolsData.NPopulationData data, bool invert, Color color)
        {
            chart.BoundsMode = BoundsMode.Stretch;

            NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator();

            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX;
            scaleX.Invert              = invert;
            scaleX.AutoLabels          = false;
            scaleX.CustomLabelFitModes = new LabelFitMode[] { LabelFitMode.AutoScale };
            scaleX.MajorTickMode       = MajorTickMode.CustomTicks;

            NLinearScaleConfigurator scaleY = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator;

            scaleY.LabelValueFormatter = new NNumericValueFormatter("0,,M");

            // add the shape chart
            NShapeSeries shape1 = new NShapeSeries();

            chart.Series.Add(shape1);

            shape1.FillStyle = new NColorFillStyle(color);
            shape1.DataLabelStyle.Visible = false;
            shape1.UseXValues             = true;
            shape1.XSizesUnits            = MeasurementUnits.Scale;
            shape1.YSizesUnits            = MeasurementUnits.Scale;

            int nRowCount = data.Rows.Count;

            for (int i = 0; i < nRowCount; i++)
            {
                NCustomToolsData.NPopulationDataEntry en = data.Rows[i];

                double value = en.Value;
                double begin = en.AgeRange.Start;
                double end   = en.AgeRange.End + 1;

                shape1.XValues.Add((begin + end) / 2);
                shape1.XSizes.Add(Math.Abs(begin - end));

                shape1.Values.Add(value / 2);
                shape1.YSizes.Add(value);

                shape1.ZSizes.Add(0);
                shape1.InteractivityStyles.Add(i, new NInteractivityStyle(true, string.Format("{0}:{1}", data.Id, i), null, CursorType.Hand));
            }
        }
Esempio n. 3
0
        private void CreateBoxes(NChart chart)
        {
            NShapeSeries shape = new NShapeSeries();

            chart.Series.Add(shape);
            shape.DataLabelStyle.Visible = false;
            shape.InflateMargins         = true;
            shape.Shape       = BarShape.Bar;
            shape.UseXValues  = true;
            shape.UseZValues  = true;
            shape.XSizesUnits = MeasurementUnits.Model;
            shape.YSizesUnits = MeasurementUnits.Model;
            shape.ZSizesUnits = MeasurementUnits.Model;

            Color color = Color.FromArgb(147, 120, 197);

            shape.FillStyle         = new NColorFillStyle(color);
            shape.BorderStyle.Color = color;

            shape.Values.Add(440);
            shape.XValues.Add(20);
            shape.ZValues.Add(25);
            shape.XSizes.Add(4);
            shape.YSizes.Add(4);
            shape.ZSizes.Add(4);

            shape.Values.Add(480);
            shape.XValues.Add(14);
            shape.ZValues.Add(25);
            shape.XSizes.Add(3);
            shape.YSizes.Add(3);
            shape.ZSizes.Add(3);

            shape.Values.Add(500);
            shape.XValues.Add(8);
            shape.ZValues.Add(25);
            shape.XSizes.Add(2);
            shape.YSizes.Add(2);
            shape.ZSizes.Add(2);
        }
Esempio n. 4
0
        private void CreateSpheres(NChart chart)
        {
            NShapeSeries shape = new NShapeSeries();

            chart.Series.Add(shape);
            shape.DataLabelStyle.Visible = false;
            shape.InflateMargins         = true;
            shape.Shape       = BarShape.Ellipsoid;
            shape.UseXValues  = true;
            shape.UseZValues  = true;
            shape.XSizesUnits = MeasurementUnits.Model;
            shape.YSizesUnits = MeasurementUnits.Model;
            shape.ZSizesUnits = MeasurementUnits.Model;
            shape.FillStyle   = new NColorFillStyle(Color.FromArgb(202, 100, 92));
            shape.BorderStyle = new NStrokeStyle(0, Color.White);

            shape.Values.Add(200);
            shape.XValues.Add(10);
            shape.ZValues.Add(10);
            shape.XSizes.Add(8);
            shape.YSizes.Add(8);
            shape.ZSizes.Add(8);
        }
Esempio n. 5
0
        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;
        }
Esempio n. 6
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("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]);
        }
        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);
        }
Esempio n. 8
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;
        }
Esempio n. 9
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("Shape Series");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic);

            // no legend
            nChartControl1.Legends.Clear();

            // setup chart
            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;

            // setup X axis
            NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator();

            m_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();

            m_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();

            m_Chart.Axis(StandardAxis.Depth).ScaleConfigurator = scaleZ;
            scaleZ.MajorGridStyle.ShowAtWalls       = new ChartWallType[] { ChartWallType.Left, ChartWallType.Floor };
            scaleZ.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;

            // setup shape series
            m_Shape                        = (NShapeSeries)m_Chart.Series.Add(SeriesType.Shape);
            m_Shape.FillStyle              = new NColorFillStyle(Color.Red);
            m_Shape.BorderStyle.Color      = Color.DarkRed;
            m_Shape.DataLabelStyle.Visible = false;
            m_Shape.UseXValues             = true;
            m_Shape.UseZValues             = true;

            // populate with random data
            m_Shape.Values.FillRandomRange(Random, 10, -100, 100);
            m_Shape.XValues.FillRandomRange(Random, 10, -100, 100);
            m_Shape.ZValues.FillRandomRange(Random, 10, -100, 100);

            m_Shape.YSizes.FillRandomRange(Random, 10, 5, 20);
            m_Shape.XSizes.FillRandomRange(Random, 10, 5, 20);
            m_Shape.ZSizes.FillRandomRange(Random, 10, 5, 20);

            // apply layout
            ConfigureStandardLayout(m_Chart, title, null);

            // init form controls
            ShapeCombo.SelectedIndex     = 0;
            UseXValuesCheck.Checked      = true;
            UseZValuesCheck.Checked      = true;
            DifferentColorsCheck.Checked = true;
        }
Esempio n. 10
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;
        }