예제 #1
0
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // set a chart title
            NLabel title = new NLabel("3D Bar Chart");

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

            // configure chart
            NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];

            chart.Enable3D = true;
            chart.Width    = 65;
            chart.Height   = 40;
            chart.Axis(StandardAxis.Depth).Visible = false;
            chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1);
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);

            // add interlaced stripe
            NLinearScaleConfigurator linearScale = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator;
            NScaleStripStyle         stripStyle  = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;
            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.SetShowAtWall(ChartWallType.Left, true);
            linearScale.StripStyles.Add(stripStyle);

            // setup a bar series
            NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar.Name = "Bar Series";
            bar.DataLabelStyle.Visible = true;
            bar.HasBottomEdge          = false;

            // add some data to the bar series
            bar.AddDataPoint(new NDataPoint(18, "C++"));
            bar.AddDataPoint(new NDataPoint(15, "Ruby"));
            bar.AddDataPoint(new NDataPoint(21, "Python"));
            bar.AddDataPoint(new NDataPoint(23, "Java"));
            bar.AddDataPoint(new NDataPoint(27, "Javascript"));
            bar.AddDataPoint(new NDataPoint(29, "C#"));
            bar.AddDataPoint(new NDataPoint(26, "PHP"));

            // apply layout
            ConfigureStandardLayout(chart, title, nChartControl1.Legends[0]);

            // init form controls
            NExampleHelpers.FillComboWithEnumValues(BarStyleComboBox, typeof(BarShape));
            BarStyleComboBox.SelectedIndex = 0;

            NExampleHelpers.FillComboWithValues(BarEdgePercentComboBox, 0, 50, 10);
            BarEdgePercentComboBox.SelectedIndex = 5;

            HasTopEdgeCheckBox.IsChecked          = bar.HasTopEdge;
            HasBottomEdgeCheckBox.IsChecked       = bar.HasBottomEdge;
            DifferentFIllStylesCheckBox.IsChecked = true;
            DifferentFillStylesCheckBox_Checked(null, null);
        }
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // create a title
            NLabel title = new NLabel("2D Bar Chart");

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

            // configure chart
            NChart chart = nChartControl1.Charts[0];

            chart.Axis(StandardAxis.Depth).Visible = false;

            // add interlace stripe
            NLinearScaleConfigurator linearScale = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator;
            NScaleStripStyle         stripStyle  = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;
            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.SetShowAtWall(ChartWallType.Left, true);
            linearScale.StripStyles.Add(stripStyle);

            // setup a bar series
            NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar.Name = "Bar Series";
            bar.BorderStyle.Width      = new NLength(0, NGraphicsUnit.Pixel);
            bar.ShadowStyle.Type       = ShadowType.GaussianBlur;
            bar.ShadowStyle.Offset     = new NPointL(2, 2);
            bar.ShadowStyle.Color      = Color.FromArgb(80, 0, 0, 0);
            bar.ShadowStyle.FadeLength = new NLength(5);
            bar.HasBottomEdge          = false;

            // add some data to the bar series
            bar.AddDataPoint(new NDataPoint(18, "C++"));
            bar.AddDataPoint(new NDataPoint(15, "Ruby"));
            bar.AddDataPoint(new NDataPoint(21, "Python"));
            bar.AddDataPoint(new NDataPoint(23, "Java"));
            bar.AddDataPoint(new NDataPoint(27, "Javascript"));
            bar.AddDataPoint(new NDataPoint(29, "C#"));
            bar.AddDataPoint(new NDataPoint(26, "PHP"));

            // apply layout
            ConfigureStandardLayout(chart, title, nChartControl1.Legends[0]);

            // init form controls
            NExampleHelpers.FillComboWithEnumValues(BarStyleComboBox, typeof(BarShape));
            BarStyleComboBox.SelectedIndex = 0;

            NExampleHelpers.FillComboWithValues(BarEdgePercentComboBox, 0, 50, 10);
            BarEdgePercentComboBox.SelectedIndex = 5;

            HasTopEdgeCheckBox.IsChecked          = bar.HasTopEdge;
            HasBottomEdgeCheckBox.IsChecked       = bar.HasBottomEdge;
            DifferentFIllStylesCheckBox.IsChecked = true;
            DifferentFillStylesCheckBox_Checked(null, null);
        }
예제 #3
0
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // remove all legends
            nChartControl1.Legends.Clear();

            // set a chart title
            NLabel title = new NLabel("Three Line Break");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic);
            title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue);

            NChart chart = nChartControl1.Charts[0];

            NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;
            // 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);
            scaleY.StripStyles.Add(stripStyle);

            // setup X axis
            NPriceScaleConfigurator priceConfigurator = new NPriceScaleConfigurator();

            priceConfigurator.InnerMajorTickStyle.LineStyle.Width = new NLength(0);
            priceConfigurator.MajorGridStyle.ShowAtWalls          = new ChartWallType[] { ChartWallType.Back };
            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator   = priceConfigurator;

            // setup line break series
            m_ThreeLineBreak = new NThreeLineBreakSeries();
            chart.Series.Add(m_ThreeLineBreak);
            m_ThreeLineBreak.UseXValues = true;

            GenerateData(m_ThreeLineBreak);

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

            NExampleHelpers.FillComboWithValues(BarWidthPercentComboBox, 0, 100, 10);
            BarWidthPercentComboBox.SelectedIndex = 2;

            NExampleHelpers.FillComboWithValues(NumberOfLinesToBreakComboBox, 1, 10, 1);
            NumberOfLinesToBreakComboBox.SelectedIndex = 4;
        }
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // remove all legends
            nChartControl1.Legends.Clear();

            // set a chart title
            NLabel title = new NLabel("Point and Figure");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic);
            title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue);

            const int nInitialBoxSize = 5;

            NChart chart = nChartControl1.Charts[0];

            chart.BoundsMode = BoundsMode.Stretch;

            // setup X axis
            NPriceScaleConfigurator priceConfigurator = new NPriceScaleConfigurator();

            priceConfigurator.LabelValueFormatter                 = new NDateTimeValueFormatter(DateTimeValueFormat.Date);
            priceConfigurator.MajorTickMode                       = MajorTickMode.AutoMaxCount;
            priceConfigurator.MajorGridStyle.ShowAtWalls          = new ChartWallType[] { ChartWallType.Back };
            priceConfigurator.InnerMajorTickStyle.LineStyle.Width = new NLength(0);
            priceConfigurator.MaxTickCount = 8;

            NNumericRangeSamplerProvider provider = new NNumericRangeSamplerProvider();

            provider.SamplingMode = SamplingMode.CustomStep;
            provider.CustomStep   = 1;
            provider.UseOrigin    = true;
            provider.Origin       = -0.5;
            priceConfigurator.MajorGridStyle.RangeSamplerProvider = provider;

            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = priceConfigurator;

            // setup Y axis
            NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;

            scaleY.MajorTickMode                  = MajorTickMode.CustomStep;
            scaleY.CustomStep                     = nInitialBoxSize;
            scaleY.OuterMajorTickStyle.Width      = new NLength(0);
            scaleY.InnerMajorTickStyle.Width      = new NLength(0);
            scaleY.AutoMinorTicks                 = true;
            scaleY.MinorTickCount                 = 1;
            scaleY.RoundToTickMin                 = false;
            scaleY.RoundToTickMax                 = false;
            scaleY.MajorGridStyle.LineStyle.Width = new NLength(0);
            scaleY.MinorGridStyle.LineStyle.Width = new NLength(1);
            scaleY.MinorGridStyle.ShowAtWalls     = new ChartWallType[] { ChartWallType.Back };

            float[] highValues = new float[20] {
                21.3F, 42.4F, 11.2F, 65.7F, 38.0F, 71.3F, 49.54F, 83.7F, 13.9F, 56.12F, 27.43F, 23.1F, 31.0F, 75.4F, 9.3F, 39.12F, 10.0F, 44.23F, 21.76F, 49.2F
            };
            float[] lowValues = new float[20] {
                12.1F, 14.32F, 8.43F, 36.0F, 13.5F, 47.34F, 24.54F, 68.11F, 6.87F, 23.3F, 12.12F, 14.54F, 25.0F, 37.2F, 3.9F, 23.11F, 1.9F, 14.0F, 8.23F, 34.21F
            };

            // setup Point & Figure series
            m_PointAndFigure            = (NPointAndFigureSeries)chart.Series.Add(SeriesType.PointAndFigure);
            m_PointAndFigure.UseXValues = true;

            // fill data
            m_PointAndFigure.HighValues.AddRange(highValues);
            m_PointAndFigure.LowValues.AddRange(lowValues);

            DateTime dt = new DateTime(2007, 1, 1);

            for (int i = 0; i < 20; i++)
            {
                m_PointAndFigure.XValues.Add(dt);
                dt = dt.AddDays(1);
            }

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

            NExampleHelpers.FillComboWithValues(BoxSizeComboBox, 1, 10, 1);
            BoxSizeComboBox.SelectedIndex = nInitialBoxSize + 1;

            NExampleHelpers.FillComboWithValues(ReversalAmountComboBox, 1, 10, 1);
            ReversalAmountComboBox.SelectedIndex = 3;
        }