Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                SampleFormattedLabelDropDownList.Items.Add("Font size and color");
                SampleFormattedLabelDropDownList.Items.Add("Font style control");
                SampleFormattedLabelDropDownList.Items.Add("Subscript and superscript");
                SampleFormattedLabelDropDownList.Items.Add("Shapes");
                SampleFormattedLabelDropDownList.Items.Add("Bullets");
                SampleFormattedLabelDropDownList.Items.Add("Fill Effects");
                SampleFormattedLabelDropDownList.Items.Add("Borders");
                SampleFormattedLabelDropDownList.Items.Add("Shadows");
                SampleFormattedLabelDropDownList.Items.Add("Background Fill and Stroke");
                SampleFormattedLabelDropDownList.SelectedIndex = 8;

                WebExamplesUtilities.FillComboWithFontNames(FontDropDownList, "Arial");
                WebExamplesUtilities.FillComboWithValues(FontSizeDropDownList, 8, 52, 1);

                WebExamplesUtilities.FillComboWithColorNames(FontColorDropDownList, KnownColor.Black);

                HasBackplaneCheckBox.Checked = true;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;
            nChartControl1.Panels.Clear();
            NLabel label = new NLabel();

            try
            {
                label.TextStyle.FontStyle = new NFontStyle(FontDropDownList.SelectedItem.Text, FontSizeDropDownList.SelectedIndex + 8);
            }
            catch
            {
            }

            label.Text = GetFormattedString((int)label.TextStyle.FontStyle.EmSize.Value);

            label.TextStyle.FillStyle                   = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(FontColorDropDownList));
            label.TextStyle.TextFormat                  = TextFormat.XML;
            label.TextStyle.BackplaneStyle.Visible      = HasBackplaneCheckBox.Checked;
            label.TextStyle.StringFormatStyle.HorzAlign = HorzAlign.Left;
            label.TextStyle.StringFormatStyle.VertAlign = VertAlign.Top;
            label.TextStyle.TextFormat                  = TextFormat.XML;
            label.Location = new NPointL(new NLength(5, NRelativeUnit.ParentPercentage),
                                         new NLength(5, NRelativeUnit.ParentPercentage));

            nChartControl1.Panels.Add(label);
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                WebExamplesUtilities.FillComboWithEnumValues(MarkerShapeDropDown, typeof(PointShape));
                MarkerShapeDropDown.SelectedIndex = 0;

                WebExamplesUtilities.FillComboWithEnumValues(Marker3ShapeDropDown, typeof(PointShape));
                Marker3ShapeDropDown.SelectedIndex = 1;

                WebExamplesUtilities.FillComboWithValues(WidthDropDownList, 0, 5, 1);
                WebExamplesUtilities.FillComboWithValues(HeightDropDownList, 0, 5, 1);
                WebExamplesUtilities.FillComboWithPercents(DepthDropDownList, 10);
                WebExamplesUtilities.FillComboWithPercents(LineDepthDropDownList, 10);
                WebExamplesUtilities.FillComboWithColorNames(MarkerColorDropDown, KnownColor.Tan);
                WebExamplesUtilities.FillComboWithColorNames(Marker3ColorDropDown, KnownColor.Salmon);

                LineDepthDropDownList.SelectedIndex = 3;
                WidthDropDownList.SelectedIndex     = 2;
                HeightDropDownList.SelectedIndex    = 2;
                AutoDepthCheckBox.Checked           = true;
                MarkersVisibleCheckBox.Checked      = true;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;
            nChartControl1.Settings.JitterMode = JitterMode.Enabled;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Series Markers");

            title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;

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

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

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

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

            NLineSeries line = (NLineSeries)chart.Series.Add(SeriesType.Line);

            line.InflateMargins   = true;
            line.Legend.Mode      = SeriesLegendMode.DataPoints;
            line.LineSegmentShape = LineSegmentShape.Line;
            line.Values.FillRandom(Random, 5);
            line.DataLabelStyle.Visible = false;
            line.FillStyle         = new NColorFillStyle(Color.DarkGray);
            line.BorderStyle.Color = Color.DarkGray;

            DepthDropDownList.Enabled  = !AutoDepthCheckBox.Checked;
            line.MarkerStyle.AutoDepth = AutoDepthCheckBox.Checked;

            if (AutoDepthCheckBox.Checked)
            {
                line.MarkerStyle.Depth = new NLength((float)(DepthDropDownList.SelectedIndex * 10), NRelativeUnit.ParentPercentage);
            }

            line.DepthPercent                  = LineDepthDropDownList.SelectedIndex * 10;
            line.MarkerStyle.Height            = new NLength((float)HeightDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage);
            line.MarkerStyle.Width             = new NLength((float)WidthDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage);
            line.MarkerStyle.Visible           = MarkersVisibleCheckBox.Checked;
            line.MarkerStyle.FillStyle         = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(MarkerColorDropDown));
            line.MarkerStyle.BorderStyle.Color = WebExamplesUtilities.ColorFromDropDownList(MarkerColorDropDown);
            line.MarkerStyle.PointShape        = (PointShape)MarkerShapeDropDown.SelectedIndex;

            NMarkerStyle marker = new NMarkerStyle();

            marker.Visible           = true;
            marker.FillStyle         = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(Marker3ColorDropDown));
            marker.BorderStyle.Color = WebExamplesUtilities.ColorFromDropDownList(Marker3ColorDropDown);
            marker.PointShape        = (PointShape)Marker3ShapeDropDown.SelectedIndex;
            line.MarkerStyles[3]     = marker;

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                WebExamplesUtilities.FillComboWithEnumValues(ShapeStyleDropDownList, typeof(BarShape));
                ShapeStyleDropDownList.SelectedIndex = 0;

                WebExamplesUtilities.FillComboWithColorNames(ShapesColorDropDownList, KnownColor.DarkOrange);

                WebExamplesUtilities.FillComboWithPredefinedProjections(ProjectionDropDownList);
                ProjectionDropDownList.SelectedIndex = (int)PredefinedProjection.PerspectiveTilted;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Shape Series");

            title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;

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

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

            chart.Enable3D = true;
            chart.Depth    = 50;
            chart.Projection.SetPredefinedProjection((PredefinedProjection)ProjectionDropDownList.SelectedIndex);
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);

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

            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX;
            scaleX.MajorGridStyle.ShowAtWalls       = new ChartWallType[] { ChartWallType.Back, ChartWallType.Floor };
            scaleX.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;

            // setup Y axis
            NLinearScaleConfigurator scaleY = new NLinearScaleConfigurator();

            chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = scaleY;
            scaleY.MajorGridStyle.ShowAtWalls       = new ChartWallType[] { ChartWallType.Back, ChartWallType.Left };
            scaleY.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;

            // add interlaced stripe
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back, ChartWallType.Left };
            stripStyle.Interlaced  = true;
            scaleY.StripStyles.Add(stripStyle);

            // setup Z axis
            NLinearScaleConfigurator scaleZ = new NLinearScaleConfigurator();

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

            // setup shape series
            NShapeSeries shape = (NShapeSeries)chart.Series.Add(SeriesType.Shape);

            shape.Name = "Shape Series";
            shape.DataLabelStyle.Visible = false;

            // populate with random data
            shape.Values.FillRandomRange(Random, 10, -100, 100);
            shape.XValues.FillRandomRange(Random, 10, -100, 100);
            shape.ZValues.FillRandomRange(Random, 10, -100, 100);
            shape.YSizes.FillRandomRange(Random, 10, 5, 20);
            shape.XSizes.FillRandomRange(Random, 10, 5, 20);
            shape.ZSizes.FillRandomRange(Random, 10, 5, 20);

            shape.Shape     = (BarShape)ShapeStyleDropDownList.SelectedIndex;
            shape.FillStyle = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(ShapesColorDropDownList));

            shape.UseXValues = UseXValueCheckBox.Checked;
            shape.UseZValues = UseZValueCheckBox.Checked;

            if (DifferentColorsCheckBox.Checked)
            {
                ShapesColorDropDownList.Enabled = false;

                NChartPalette palette = new NChartPalette();
                palette.SetPredefinedPalette(ChartPredefinedPalette.Nevron);

                for (int i = 0; i < shape.Values.Count; i++)
                {
                    shape.FillStyles[i] = new NColorFillStyle(palette.SeriesColors[i % palette.SeriesColors.Count]);
                }
            }
            else
            {
                ShapesColorDropDownList.Enabled = true;
                shape.FillStyles.Clear();
                shape.FillStyle = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(ShapesColorDropDownList));
            }

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, null);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                // init form controls
                FormatDropDownList.Items.Add("[value] [label]");
                FormatDropDownList.Items.Add("[index] [cumulative]");
                FormatDropDownList.Items.Add("[percent] [total]");
                FormatDropDownList.SelectedIndex = 0;

                ModeDropDownList.Items.Add("Disabled");
                ModeDropDownList.Items.Add("Series");
                ModeDropDownList.Items.Add("DataPoints");
                ModeDropDownList.Items.Add("SeriesCustom");
                ModeDropDownList.SelectedIndex = 2;

                WebExamplesUtilities.FillComboWithEnumValues(PointShapeDropDownList, typeof(PointShape));
                PointShapeDropDownList.SelectedIndex = 0;

                WebExamplesUtilities.FillComboWithColorNames(ColorDropDownList, KnownColor.DarkOrange);

                DifferentColorsCheckBox.Checked = true;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel title = new NLabel("Series Legend");

            title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;
            nChartControl1.Panels.Add(title);

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

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

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

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

            NPointSeries point = (NPointSeries)chart.Series.Add(SeriesType.Point);

            point.DataLabelStyle.Visible = false;
            point.InflateMargins         = true;
            point.PointShape             = (PointShape)PointShapeDropDownList.SelectedIndex;
            point.Legend.Mode            = (SeriesLegendMode)ModeDropDownList.SelectedIndex;

            point.AddDataPoint(new NDataPoint(16, "Agriculture"));
            point.AddDataPoint(new NDataPoint(42, "Construction"));
            point.AddDataPoint(new NDataPoint(56, "Manufacturing"));
            point.AddDataPoint(new NDataPoint(23, "Services"));
            point.AddDataPoint(new NDataPoint(47, "Healthcare"));
            point.AddDataPoint(new NDataPoint(38, "Finance"));

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

            if (DifferentColorsCheckBox.Checked)
            {
                NChartPalette palette = new NChartPalette();
                palette.SetPredefinedPalette(ChartPredefinedPalette.Nevron);

                for (int i = 0; i < point.Values.Count; i++)
                {
                    point.FillStyles[i] = new NColorFillStyle(palette.SeriesColors[i % palette.SeriesColors.Count]);
                }
                ColorDropDownList.Enabled = false;
            }
            else
            {
                point.FillStyle           = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(ColorDropDownList));
                ColorDropDownList.Enabled = true;
            }

            if (ModeDropDownList.SelectedIndex == 2)
            {
                FormatDropDownList.Enabled = true;
                point.Legend.Format        = WebExamplesUtilities.GetXmlFormatString(FormatDropDownList.SelectedItem.Text);
            }
            else
            {
                FormatDropDownList.Enabled = false;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                WebExamplesUtilities.FillComboWithEnumValues(PointShapeDropDownList, typeof(PointShape));
                PointShapeDropDownList.SelectedIndex = 0;

                DataLabelFormatDropDownList.Items.Add("Value and Label");
                DataLabelFormatDropDownList.Items.Add("Value");
                DataLabelFormatDropDownList.Items.Add("Label");
                DataLabelFormatDropDownList.SelectedIndex = 0;

                WebExamplesUtilities.FillComboWithValues(PointSizeDropDownList, 0, 10, 1);
                PointSizeDropDownList.SelectedIndex = 4;

                WebExamplesUtilities.FillComboWithColorNames(PointColorDropDownList, KnownColor.Orange);

                DifferentColorsCheckBox.Checked     = true;
                LeftAxisRoundToTickCheckBox.Checked = true;
                ShowDataLabelsCheckBox.Checked      = true;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Point 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;

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

            linearScaleConfigurator.RoundToTickMin = LeftAxisRoundToTickCheckBox.Checked;
            linearScaleConfigurator.RoundToTickMax = LeftAxisRoundToTickCheckBox.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);
            linearScaleConfigurator.StripStyles.Add(stripStyle);

            // hide the depth axis
            chart.Axis(StandardAxis.Depth).Visible = false;

            // setup point series
            NPointSeries point = (NPointSeries)chart.Series.Add(SeriesType.Point);

            point.Name          = "Point Series";
            point.Legend.Format = "<label>";
            point.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(7);
            point.PointShape     = (PointShape)PointShapeDropDownList.SelectedIndex;
            point.Size           = new NLength((float)PointSizeDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage);
            point.InflateMargins = InflateMarginsCheckBox.Checked;

            point.AddDataPoint(new NDataPoint(23, "A"));
            point.AddDataPoint(new NDataPoint(67, "B"));
            point.AddDataPoint(new NDataPoint(47, "C"));
            point.AddDataPoint(new NDataPoint(12, "D"));
            point.AddDataPoint(new NDataPoint(56, "E"));
            point.AddDataPoint(new NDataPoint(78, "F"));

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, null);

            if (DifferentColorsCheckBox.Checked)
            {
                PointColorDropDownList.Enabled = false;

                NChartPalette palette = new NChartPalette();
                palette.SetPredefinedPalette(ChartPredefinedPalette.Nevron);

                for (int i = 0; i < point.Values.Count; i++)
                {
                    point.FillStyles[i] = new NColorFillStyle(palette.SeriesColors[i % palette.SeriesColors.Count]);
                }

                point.Legend.Mode = SeriesLegendMode.DataPoints;
            }
            else
            {
                PointColorDropDownList.Enabled = true;
                point.FillStyles.Clear();
                point.FillStyle   = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(PointColorDropDownList));
                point.Legend.Mode = SeriesLegendMode.Series;
            }

            if (ShowDataLabelsCheckBox.Checked)
            {
                point.DataLabelStyle.Visible        = true;
                DataLabelFormatDropDownList.Enabled = true;

                switch (DataLabelFormatDropDownList.SelectedIndex)
                {
                case 0:
                    point.DataLabelStyle.Format = "<value> <label>";
                    break;

                case 1:
                    point.DataLabelStyle.Format = "<value>";
                    break;

                case 2:
                    point.DataLabelStyle.Format = "<label>";
                    break;
                }
            }
            else
            {
                point.DataLabelStyle.Visible        = false;
                DataLabelFormatDropDownList.Enabled = false;
            }
        }
Beispiel #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                WebExamplesUtilities.FillComboWithColorNames(UpColorDropDownList, KnownColor.Red);
                WebExamplesUtilities.FillComboWithColorNames(DownColorDropDownList, KnownColor.Black);
                ProportionalXCheckBox.Checked = false;
                ProportionalYCheckBox.Checked = false;
                WebExamplesUtilities.FillComboWithFloatValues(BoxSizeDropdownlist, 0.5F, 10, 0.5F);
                BoxSizeDropdownlist.SelectedIndex = 9;
                WebExamplesUtilities.FillComboWithValues(ReversalAmountDropDownList, 1, 5, 1);
                ReversalAmountDropDownList.SelectedIndex = 2;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Point and Figure");

            title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;

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

            // configure the chart
            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                     = 5;
            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
            NPointAndFigureSeries pointAndFigure = (NPointAndFigureSeries)chart.Series.Add(SeriesType.PointAndFigure);

            pointAndFigure.UseXValues = true;

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

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

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

            double dBoxSize = Convert.ToDouble(BoxSizeDropdownlist.SelectedValue);

            pointAndFigure.BoxSize = dBoxSize;
            scaleY.CustomStep      = dBoxSize;

            pointAndFigure.ProportionalX         = ProportionalXCheckBox.Checked;
            pointAndFigure.ProportionalY         = ProportionalYCheckBox.Checked;
            pointAndFigure.ReversalAmount        = Convert.ToInt32(ReversalAmountDropDownList.SelectedValue);
            pointAndFigure.UpStrokeStyle.Color   = WebExamplesUtilities.ColorFromDropDownList(UpColorDropDownList);
            pointAndFigure.DownStrokeStyle.Color = WebExamplesUtilities.ColorFromDropDownList(DownColorDropDownList);

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, null);
        }
Beispiel #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                StandardBorderDropDownList.Items.Add("None");
                StandardBorderDropDownList.Items.Add("SingleFixed");
                StandardBorderDropDownList.Items.Add("Sunken");
                StandardBorderDropDownList.Items.Add("Raised");
                StandardBorderDropDownList.Items.Add("SunkenRaised");
                StandardBorderDropDownList.Items.Add("RaisedSunken");

                WebExamplesUtilities.FillComboWithColorNames(BorderColorDropDownList, KnownColor.White);
                WebExamplesUtilities.FillComboWithValues(BevelWidthDropDownList, 1, 10, 1);
                WebExamplesUtilities.FillComboWithValues(BorderWidthDownList, 1, 10, 1);

                StandardBorderDropDownList.SelectedIndex = 2;
            }

            nChartControl1.Settings.JitterMode = JitterMode.Enabled;

            // set an image frame
            NStandardFrameStyle standardFrameStyle = new NStandardFrameStyle();

            standardFrameStyle.SetPredefinedFrameStyle((PredefinedStandardFrame)(StandardBorderDropDownList.SelectedIndex));
            standardFrameStyle.InnerBevelWidth  = new NLength(BevelWidthDropDownList.SelectedIndex + 1, NGraphicsUnit.Pixel);
            standardFrameStyle.OuterBevelWidth  = new NLength(BevelWidthDropDownList.SelectedIndex + 1, NGraphicsUnit.Pixel);
            standardFrameStyle.OuterBorderColor = WebExamplesUtilities.ColorFromDropDownList(BorderColorDropDownList);
            standardFrameStyle.OuterBorderWidth = new NLength(BorderWidthDownList.SelectedIndex + 1, NGraphicsUnit.Pixel);

            nChartControl1.BackgroundStyle.FrameStyle = standardFrameStyle;
            nChartControl1.BackgroundStyle.FillStyle  = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.LightSteelBlue, Color.White);

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Standard Border");

            title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;

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

            chart.Enable3D = true;
            chart.Depth    = 50;
            chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted);
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);

            NStandardScaleConfigurator scaleX = (NStandardScaleConfigurator)chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator;

            scaleX.MajorTickMode = MajorTickMode.AutoMaxCount;

            NStandardScaleConfigurator scaleZ = (NStandardScaleConfigurator)chart.Axis(StandardAxis.Depth).ScaleConfigurator;

            scaleZ.MajorTickMode = MajorTickMode.AutoMaxCount;

            // add the first bar
            NBarSeries bar1 = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar1.MultiBarMode           = MultiBarMode.Series;
            bar1.Name                   = "Bar1";
            bar1.DataLabelStyle.Visible = false;
            bar1.BorderStyle.Color      = Color.Crimson;
            bar1.FillStyle              = new NColorFillStyle(Color.Crimson);
            bar1.Values.FillRandomRange(Random, 5, 10, 40);

            // add the second bar
            NBarSeries bar2 = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar2.MultiBarMode           = MultiBarMode.Series;
            bar2.Name                   = "Bar2";
            bar2.DataLabelStyle.Visible = false;
            bar2.BorderStyle.Color      = Color.PaleGreen;
            bar2.FillStyle              = new NColorFillStyle(Color.PaleGreen);
            bar2.Values.FillRandomRange(Random, 5, 30, 60);

            // add the third bar
            NBarSeries bar3 = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar3.MultiBarMode           = MultiBarMode.Series;
            bar3.Name                   = "Bar3";
            bar3.DataLabelStyle.Visible = false;
            bar3.BorderStyle.Color      = Color.CornflowerBlue;
            bar3.FillStyle              = new NColorFillStyle(Color.CornflowerBlue);
            bar3.Values.FillRandomRange(Random, 5, 50, 80);

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]);
        }
Beispiel #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                WebExamplesUtilities.FillComboWithColorNames(UpColorDropDownList, KnownColor.Black);
                WebExamplesUtilities.FillComboWithColorNames(DownColorDropDownList, KnownColor.Black);
                WebExamplesUtilities.FillComboWithValues(UpStrokeDropDownList, 1, 3, 1);
                UpStrokeDropDownList.SelectedIndex = 1;
                WebExamplesUtilities.FillComboWithValues(DownStrokeDropDownList, 1, 3, 1);
                reversalAmountDropdownlist.Items.AddRange(new ListItem[]
                                                          { new ListItem("0.5"),
                                                            new ListItem("1"),
                                                            new ListItem("2"),
                                                            new ListItem("1%"),
                                                            new ListItem("2%"),
                                                            new ListItem("5%") });
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

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

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Kagi Chart");

            title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;

            NChart chart = nChartControl1.Charts[0];

            chart.BoundsMode = BoundsMode.Stretch;

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

            priceConfigurator.InnerMajorTickStyle.LineStyle.Width = new NLength(0);
            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator   = priceConfigurator;

            // setup Y axis
            NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;
            NScaleStripStyle         stripStyle  = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

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

            //Setup Kagi series
            NKagiSeries kagi = (NKagiSeries)chart.Series.Add(SeriesType.Kagi);

            kagi.UpStrokeStyle.Color   = WebExamplesUtilities.ColorFromDropDownList(UpColorDropDownList);
            kagi.DownStrokeStyle.Color = WebExamplesUtilities.ColorFromDropDownList(DownColorDropDownList);
            kagi.UpStrokeStyle.Width   = new NLength(Convert.ToInt32(UpStrokeDropDownList.SelectedValue));
            kagi.DownStrokeStyle.Width = new NLength(Convert.ToInt32(DownStrokeDropDownList.SelectedValue));
            kagi.UseXValues            = true;

            switch (reversalAmountDropdownlist.SelectedIndex)
            {
            case 0:
                kagi.ReversalAmount           = 0.5;
                kagi.ReversalAmountInPercents = false;
                break;

            case 1:
                kagi.ReversalAmount           = 1;
                kagi.ReversalAmountInPercents = false;
                break;

            case 2:
                kagi.ReversalAmount           = 2;
                kagi.ReversalAmountInPercents = false;
                break;

            case 3:
                kagi.ReversalAmount           = 1;
                kagi.ReversalAmountInPercents = true;
                break;

            case 4:
                kagi.ReversalAmount           = 2;
                kagi.ReversalAmountInPercents = true;
                break;

            case 5:
                kagi.ReversalAmount           = 5;
                kagi.ReversalAmountInPercents = true;
                break;
            }

            GenerateData(kagi);

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, null);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                WebExamplesUtilities.FillComboWithEnumValues(MarkerShapeDropDownList, typeof(PointShape));
                MarkerShapeDropDownList.SelectedIndex = 1;

                WebExamplesUtilities.FillComboWithColorNames(RadarColor1DropDownList, KnownColor.SlateBlue);
                WebExamplesUtilities.FillComboWithColorNames(RadarColor2DropDownList, KnownColor.Crimson);

                ShowMarkersCheckBox.Checked = true;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Radar Area");

            title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;
            title.ContentAlignment           = ContentAlignment.BottomRight;
            title.Location = new NPointL(
                new NLength(2, NRelativeUnit.ParentPercentage),
                new NLength(2, NRelativeUnit.ParentPercentage));

            // create and configure a radar chart
            NRadarChart radarChart = new NRadarChart();

            nChartControl1.Charts.Clear();
            nChartControl1.Charts.Add(radarChart);
            radarChart.BoundsMode = BoundsMode.Fit;
            radarChart.Location   = new NPointL(new NLength(0, NRelativeUnit.ParentPercentage), new NLength(0, NRelativeUnit.ParentPercentage));
            radarChart.Size       = new NSizeL(new NLength(100, NRelativeUnit.ParentPercentage), new NLength(100, NRelativeUnit.ParentPercentage));
            radarChart.Padding    = new NMarginsL(7, 7, 7, 7);

            // set some axis labels
            AddAxis(radarChart, "Vitamin A");
            AddAxis(radarChart, "Vitamin B1");
            AddAxis(radarChart, "Vitamin B2");
            AddAxis(radarChart, "Vitamin B6");
            AddAxis(radarChart, "Vitamin B12");
            AddAxis(radarChart, "Vitamin C");
            AddAxis(radarChart, "Vitamin D");
            AddAxis(radarChart, "Vitamin E");

            Color color1 = WebExamplesUtilities.ColorFromDropDownList(RadarColor1DropDownList);
            Color color2 = WebExamplesUtilities.ColorFromDropDownList(RadarColor2DropDownList);

            // setup radar series 1
            NRadarAreaSeries radarArea1 = (NRadarAreaSeries)radarChart.Series.Add(SeriesType.RadarArea);

            radarArea1.Name = "Series 1";
            radarArea1.DataLabelStyle.Visible = ShowDataLabelsCheckBox.Checked;
            radarArea1.DataLabelStyle.Format  = "<value>";
            radarArea1.BorderStyle.Color      = color1;
            radarArea1.FillStyle                     = new NColorFillStyle(Color.FromArgb(125, color1));
            radarArea1.MarkerStyle.Visible           = ShowMarkersCheckBox.Checked;
            radarArea1.MarkerStyle.PointShape        = (PointShape)MarkerShapeDropDownList.SelectedIndex;
            radarArea1.MarkerStyle.Height            = new NLength(1.5f, NRelativeUnit.ParentPercentage);
            radarArea1.MarkerStyle.Width             = new NLength(1.5f, NRelativeUnit.ParentPercentage);
            radarArea1.MarkerStyle.FillStyle         = new NColorFillStyle(color1);
            radarArea1.MarkerStyle.BorderStyle.Color = color1;
            radarArea1.Values.FillRandomRange(Random, 8, 0, 100);

            // setup radar series 2
            NRadarAreaSeries radarArea2 = (NRadarAreaSeries)radarChart.Series.Add(SeriesType.RadarArea);

            radarArea2.Name = "Series 2";
            radarArea2.DataLabelStyle.Visible = ShowDataLabelsCheckBox.Checked;
            radarArea2.DataLabelStyle.Format  = "<value>";
            radarArea2.BorderStyle.Color      = color2;
            radarArea2.FillStyle                     = new NColorFillStyle(Color.FromArgb(125, color2));
            radarArea2.MarkerStyle.Visible           = ShowMarkersCheckBox.Checked;
            radarArea2.MarkerStyle.PointShape        = (PointShape)MarkerShapeDropDownList.SelectedIndex;
            radarArea2.MarkerStyle.Height            = new NLength(1.5f, NRelativeUnit.ParentPercentage);
            radarArea2.MarkerStyle.Width             = new NLength(1.5f, NRelativeUnit.ParentPercentage);
            radarArea2.MarkerStyle.FillStyle         = new NColorFillStyle(color2);
            radarArea2.MarkerStyle.BorderStyle.Color = color2;
            radarArea2.Values.FillRandomRange(Random, 8, 0, 100);
        }
Beispiel #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                // fill the combo
                LineStyleDropDownList.Items.Add("Line");
                LineStyleDropDownList.Items.Add("Tape");
                LineStyleDropDownList.Items.Add("Tube");
                LineStyleDropDownList.Items.Add("Ellipsoid");
                LineStyleDropDownList.SelectedIndex = 0;

                WebExamplesUtilities.FillComboWithEnumValues(MarkerShapeDropDownList, typeof(PointShape));
                MarkerShapeDropDownList.SelectedIndex = 7;

                WebExamplesUtilities.FillComboWithValues(LineWidthDropDownList, 0, 5, 1);
                LineWidthDropDownList.SelectedIndex = 1;

                WebExamplesUtilities.FillComboWithColorNames(LineColorDropDownList);
                LineColorDropDownList.SelectedIndex = 34;

                WebExamplesUtilities.FillComboWithColorNames(LineFillColorDropDownList);
                LineFillColorDropDownList.SelectedIndex = 72;

                WebExamplesUtilities.FillComboWithValues(MarkerSizeDropDownList, 0, 10, 1);
                MarkerSizeDropDownList.SelectedIndex = 2;

                ShowMarkersCheckBox.Checked         = true;
                LeftAxisRoundToTickCheckBox.Checked = true;
                InflateMarginsCheckBox.Checked      = true;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("2D Line Chart");

            title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;

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

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

            chart.BoundsMode = BoundsMode.Stretch;

            NLinearScaleConfigurator linearScaleConfigurator = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;

            linearScaleConfigurator.RoundToTickMin = LeftAxisRoundToTickCheckBox.Checked;
            linearScaleConfigurator.RoundToTickMax = LeftAxisRoundToTickCheckBox.Checked;
            chart.Axis(StandardAxis.Depth).Visible = false;

            // setup the line series
            NLineSeries line = (NLineSeries)chart.Series.Add(SeriesType.Line);

            line.Values.FillRandom(Random, 10);
            line.DataLabelStyle.Visible = false;
            line.Legend.Mode            = SeriesLegendMode.DataPoints;

            line.BorderStyle.Width = new NLength(LineWidthDropDownList.SelectedIndex, NGraphicsUnit.Pixel);
            line.BorderStyle.Color = WebExamplesUtilities.ColorFromDropDownList(LineColorDropDownList);
            line.FillStyle         = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(LineFillColorDropDownList));

            line.InflateMargins      = InflateMarginsCheckBox.Checked;
            line.MarkerStyle.Visible = ShowMarkersCheckBox.Checked;

            line.ShadowStyle.Type       = ShadowType.GaussianBlur;
            line.ShadowStyle.Offset     = new NPointL(new NLength(3, NGraphicsUnit.Pixel), new NLength(3, NGraphicsUnit.Pixel));
            line.ShadowStyle.FadeLength = new NLength(5, NGraphicsUnit.Pixel);
            line.ShadowStyle.Color      = Color.FromArgb(55, 0, 0, 0);

            bool bSimpleLine = (LineStyleDropDownList.SelectedIndex == 0);

            switch (LineStyleDropDownList.SelectedIndex)
            {
            case 0:                     // line
                line.LineSegmentShape = LineSegmentShape.Line;
                break;

            case 1:                     // tape
                line.LineSegmentShape = LineSegmentShape.Tape;
                break;

            case 2:                     // tube
                line.LineSegmentShape = LineSegmentShape.Tube;
                break;

            case 3:                     // elipsoid
                line.LineSegmentShape = LineSegmentShape.Ellipsoid;
                break;
            }

            LineFillColorDropDownList.Enabled = !bSimpleLine;

            MarkerShapeDropDownList.Enabled = ShowMarkersCheckBox.Checked;
            MarkerSizeDropDownList.Enabled  = ShowMarkersCheckBox.Checked;

            if (line.MarkerStyle.Visible)
            {
                line.MarkerStyle.PointShape        = (PointShape)MarkerShapeDropDownList.SelectedIndex;
                line.MarkerStyle.Height            = new NLength((float)MarkerSizeDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage);
                line.MarkerStyle.Width             = new NLength((float)MarkerSizeDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage);
                line.MarkerStyle.FillStyle         = new NColorFillStyle(Red);
                line.MarkerStyle.BorderStyle.Color = WebExamplesUtilities.ColorFromDropDownList(LineColorDropDownList);
            }

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, null);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                WebExamplesUtilities.FillComboWithColorNames(UpColorDropDownList, KnownColor.White);
                WebExamplesUtilities.FillComboWithColorNames(DownColorDropDownList, KnownColor.Black);
                BoxWidthDropDownList.Items.AddRange(new ListItem[]
                {
                    new ListItem("50%"),
                    new ListItem("75%"),
                    new ListItem("100%")
                });
                BoxWidthDropDownList.SelectedIndex = 2;
                WebExamplesUtilities.FillComboWithValues(NumberOfLinesDropDownList, 1, 4, 1);
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Three Line Break");

            title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;

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

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

            chart.BoundsMode = BoundsMode.Stretch;

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

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

            // 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
            NThreeLineBreakSeries threeLineBreak = (NThreeLineBreakSeries)chart.Series.Add(SeriesType.ThreeLineBreak);

            threeLineBreak.UseXValues = true;

            threeLineBreak.UpFillStyle          = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(UpColorDropDownList));
            threeLineBreak.DownFillStyle        = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(DownColorDropDownList));
            threeLineBreak.NumberOfLinesToBreak = Convert.ToInt32(NumberOfLinesDropDownList.SelectedValue);

            switch (BoxWidthDropDownList.SelectedIndex)
            {
            case 0:
                threeLineBreak.BoxWidthPercent = 50;
                break;

            case 1:
                threeLineBreak.BoxWidthPercent = 75;
                break;

            case 2:
                threeLineBreak.BoxWidthPercent = 100;
                break;
            }

            GenerateData(threeLineBreak);

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, null);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                WebExamplesUtilities.FillComboWithColorNames(GroupedPieColorDropDownList);
                GroupedPieColorDropDownList.SelectedIndex = 20;

                // init form controls
                ThresholdValueTextBox.Text  = "34";
                GroupedPieLabelTextBox.Text = "Other";
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;
            nChartControl1.Settings.JitterMode = JitterMode.Enabled;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Grouped Pie Chart");

            title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;
            title.ContentAlignment           = ContentAlignment.BottomRight;
            title.Location = new NPointL(
                new NLength(2, NRelativeUnit.ParentPercentage),
                new NLength(2, NRelativeUnit.ParentPercentage));

            // setup legend
            NLegend legend = nChartControl1.Legends[0];

            legend.OuterBottomBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel);
            legend.OuterLeftBorderStyle.Width   = new NLength(0, NGraphicsUnit.Pixel);
            legend.OuterRightBorderStyle.Width  = new NLength(0, NGraphicsUnit.Pixel);
            legend.OuterTopBorderStyle.Width    = new NLength(0, NGraphicsUnit.Pixel);
            legend.FillStyle.SetTransparencyPercent(70);
            legend.HorizontalBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel);
            legend.VerticalBorderStyle.Width   = new NLength(0, NGraphicsUnit.Pixel);

            // by default the control contains a Cartesian chart -> remove it and create a Pie chart
            NChart chart = new NPieChart();

            nChartControl1.Charts.Clear();
            nChartControl1.Charts.Add(chart);

            chart.Enable3D        = true;
            chart.DisplayOnLegend = nChartControl1.Legends[0];
            chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveElevated);
            chart.BoundsMode = BoundsMode.Fit;
            chart.Location   = new NPointL(
                new NLength(20, NRelativeUnit.ParentPercentage),
                new NLength(20, NRelativeUnit.ParentPercentage));
            chart.Size = new NSizeL(
                new NLength(60, NRelativeUnit.ParentPercentage),
                new NLength(60, NRelativeUnit.ParentPercentage));

            // setup pie series
            NPieSeries pie = (NPieSeries)chart.Series.Add(SeriesType.Pie);

            pie.Legend.Mode = SeriesLegendMode.None;
            pie.PieStyle    = PieStyle.SmoothEdgePie;

            int count = 10;

            pie.Values.FillRandomRange(Random, count, 1, 100);

            for (int i = 0; i < count; i++)
            {
                pie.Detachments.Add(0);
                pie.Labels.Add(arrLabels[i]);
                pie.FillStyles[i] = arrCustomColors2[i % arrCustomColors2.Length];
            }

            if (GroupPiesCheckBox.Checked == true)
            {
                try
                {
                    Color  groupColor  = WebExamplesUtilities.ColorFromDropDownList(GroupedPieColorDropDownList);
                    double dGroupValue = Int32.Parse(ThresholdValueTextBox.Text);

                    // get a subset containing the pies which are smaller than the specified value
                    NDataSeriesSubset smallerThanValue = pie.Values.Filter(Nevron.Chart.CompareMethod.Less, dGroupValue);

                    // determine the sum of the filtered pies
                    double dOtherSliceValue = pie.Values.Evaluate("SUM", smallerThanValue);

                    // remove the data points contained in the
                    for (int i = pie.GetDataPointCount(); i >= 0; i--)
                    {
                        if (smallerThanValue.Contains(i))
                        {
                            pie.RemoveDataPointAt(i);
                        }
                    }

                    // add a detached pie with the specified group label and color
                    NDataPoint dp = new NDataPoint(dOtherSliceValue, GroupedPieLabelTextBox.Text);
                    dp[DataPointValue.PieDetachment] = 1.0;
                    dp[DataPointValue.FillStyle]     = new NColorFillStyle(groupColor);
                    dp[DataPointValue.StrokeStyle]   = new NStrokeStyle(1, groupColor);
                    pie.AddDataPoint(dp);
                }
                catch
                {
                }
            }
            else
            {
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                // init form controls
                WebExamplesUtilities.FillComboWithEnumValues(MarkerShapeDropDownList, typeof(PointShape));
                MarkerShapeDropDownList.SelectedIndex = 0;

                ChartTypeDropDownList.Items.Add("Bar");
                ChartTypeDropDownList.Items.Add("Line");
                ChartTypeDropDownList.Items.Add("Area");
                ChartTypeDropDownList.Items.Add("SmoothLine");
                ChartTypeDropDownList.Items.Add("Point");

                EmptyDataPointsValueModeDropDownList.Items.Add("Skip");
                EmptyDataPointsValueModeDropDownList.Items.Add("Average");
                EmptyDataPointsValueModeDropDownList.Items.Add("CustomValue");
                EmptyDataPointsValueModeDropDownList.SelectedIndex = 0;

                EmptyDataPointsAppearanceDropDownList.Items.Add("None");
                EmptyDataPointsAppearanceDropDownList.Items.Add("Normal");
                EmptyDataPointsAppearanceDropDownList.Items.Add("Special");
                EmptyDataPointsAppearanceDropDownList.SelectedIndex = 0;

                EmptyDataPointsMarkerModeDropDown.Items.Add("Normal Marker");
                EmptyDataPointsMarkerModeDropDown.Items.Add("Special Marker");

                WebExamplesUtilities.FillComboWithColorNames(EmptyDataPointsColorDropDownList, KnownColor.OrangeRed);
                WebExamplesUtilities.FillComboWithColorNames(MarkerColorDropDownList, KnownColor.OrangeRed);

                ShowMarkersCheckBox.Checked = false;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // add header
            NLabel header = nChartControl1.Labels.AddHeader("Empty Data Points");

            header.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;
            header.ContentAlignment           = ContentAlignment.BottomRight;
            header.Location = new NPointL(
                new NLength(2, NRelativeUnit.ParentPercentage),
                new NLength(2, NRelativeUnit.ParentPercentage));

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

            chart.Enable3D = true;
            chart.Width    = 80.0f;
            chart.Height   = 70.0f;
            chart.Axis(StandardAxis.Depth).Visible = false;
            chart.BoundsMode = BoundsMode.Stretch;
            chart.Location   = new NPointL(
                new NLength(10, NRelativeUnit.ParentPercentage),
                new NLength(15, NRelativeUnit.ParentPercentage));
            chart.Size = new NSizeL(
                new NLength(70, NRelativeUnit.ParentPercentage),
                new NLength(75, NRelativeUnit.ParentPercentage));

            // configure the legend
            NLegend legend = nChartControl1.Legends[0];

            legend.FillStyle = new NColorFillStyle(Color.FromArgb(125, 255, 255, 255));

            // turn off legend grid lines
            legend.OuterBottomBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel);
            legend.OuterLeftBorderStyle.Width   = new NLength(0, NGraphicsUnit.Pixel);
            legend.OuterRightBorderStyle.Width  = new NLength(0, NGraphicsUnit.Pixel);
            legend.OuterTopBorderStyle.Width    = new NLength(0, NGraphicsUnit.Pixel);
            legend.VerticalBorderStyle.Width    = new NLength(0, NGraphicsUnit.Pixel);
            legend.ContentAlignment             = ContentAlignment.TopCenter;
            legend.Location = new NPointL(
                new NLength(88, NRelativeUnit.ParentPercentage),
                new NLength(70, NRelativeUnit.ParentPercentage));

            UpdateSeriesType();

            NSeries series = (NSeries)chart.Series[0];

            series.MarkerStyle.Visible = ShowMarkersCheckBox.Checked;

            // update EDP value mode
            series.Values.EmptyDataPoints.ValueMode   = (EmptyDataPointsValueMode)EmptyDataPointsValueModeDropDownList.SelectedIndex;
            series.Values.EmptyDataPoints.CustomValue = 0;

            // update EDP appearance mode
            series.EmptyDataPointsAppearance.AppearanceMode = (EmptyDataPointsAppearanceMode)EmptyDataPointsAppearanceDropDownList.SelectedIndex;

            // update EDP marker mode
            series.EmptyDataPointsAppearance.MarkerMode = (EmptyDataPointsMarkerMode)EmptyDataPointsMarkerModeDropDown.SelectedIndex;

            series.EmptyDataPointsAppearance.FillStyle              = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(EmptyDataPointsColorDropDownList));
            series.EmptyDataPointsAppearance.MarkerStyle.Visible    = true;
            series.EmptyDataPointsAppearance.MarkerStyle.PointShape = (PointShape)MarkerShapeDropDownList.SelectedIndex;
            series.EmptyDataPointsAppearance.MarkerStyle.FillStyle  = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(MarkerColorDropDownList));
            series.EmptyDataPointsAppearance.MarkerStyle.Width      = new NLength(2f, NRelativeUnit.ParentPercentage);
            series.EmptyDataPointsAppearance.MarkerStyle.Depth      = new NLength(2f, NRelativeUnit.ParentPercentage);
            series.EmptyDataPointsAppearance.MarkerStyle.Height     = new NLength(2f, NRelativeUnit.ParentPercentage);
            series.EmptyDataPointsAppearance.MarkerStyle.AutoDepth  = true;
        }
Beispiel #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                WebExamplesUtilities.FillComboWithEnumValues(MarkerShapeDropDownList, typeof(PointShape));
                MarkerShapeDropDownList.SelectedIndex = 7;

                WebExamplesUtilities.FillComboWithValues(LineWidthDropDownList, 0, 5, 1);
                LineWidthDropDownList.SelectedIndex = 1;

                WebExamplesUtilities.FillComboWithColorNames(LineColorDropDownList, KnownColor.Orange);

                WebExamplesUtilities.FillComboWithValues(MarkerSizeDropDownList, 0, 10, 1);
                MarkerSizeDropDownList.SelectedIndex = 2;

                ShowMarkersCheckBox.Checked         = true;
                LeftAxisRoundToTickCheckBox.Checked = true;
                InflateMarginsCheckBox.Checked      = true;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Smooth Line Chart");

            title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;

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

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

            chart.BoundsMode = BoundsMode.Stretch;

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

            linearScaleConfigurator.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;
            linearScaleConfigurator.RoundToTickMin = LeftAxisRoundToTickCheckBox.Checked;
            linearScaleConfigurator.RoundToTickMax = LeftAxisRoundToTickCheckBox.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);
            linearScaleConfigurator.StripStyles.Add(stripStyle);

            // add the line
            NSmoothLineSeries line = (NSmoothLineSeries)chart.Series.Add(SeriesType.SmoothLine);

            line.Name                          = "Smooth Line";
            line.UseXValues                    = false;
            line.UseZValues                    = false;
            line.InflateMargins                = InflateMarginsCheckBox.Checked;
            line.DataLabelStyle.Visible        = false;
            line.MarkerStyle.Visible           = ShowMarkersCheckBox.Checked;
            line.MarkerStyle.AutoDepth         = false;
            line.MarkerStyle.PointShape        = (PointShape)MarkerShapeDropDownList.SelectedIndex;
            line.MarkerStyle.Height            = new NLength((float)MarkerSizeDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage);
            line.MarkerStyle.Width             = new NLength((float)MarkerSizeDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage);
            line.MarkerStyle.Depth             = new NLength((float)MarkerSizeDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage);
            line.MarkerStyle.BorderStyle.Color = WebExamplesUtilities.ColorFromDropDownList(LineColorDropDownList);
            line.MarkerStyle.FillStyle         = new NColorFillStyle(Red);
            line.BorderStyle.Width             = new NLength(LineWidthDropDownList.SelectedIndex, NGraphicsUnit.Pixel);
            line.BorderStyle.Color             = WebExamplesUtilities.ColorFromDropDownList(LineColorDropDownList);

            if (ShowMarkersCheckBox.Checked)
            {
                MarkerSizeDropDownList.Enabled  = true;
                MarkerShapeDropDownList.Enabled = true;
            }
            else
            {
                MarkerSizeDropDownList.Enabled  = false;
                MarkerShapeDropDownList.Enabled = false;
            }

            GenreateYValues(nValuesCount);

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, null);
        }
        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("Wireframe Surface");

            title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;

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

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

            chart.Enable3D             = true;
            chart.Width                = 70.0f;
            chart.Depth                = 70.0f;
            chart.Height               = 30.0f;
            chart.Projection.Type      = ProjectionType.Perspective;
            chart.Projection.Elevation = 28;
            chart.Projection.Rotation  = -18;
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.ShinyTopLeft);

            if (!IsPostBack)
            {
                RotationTextBox.Text  = chart.Projection.Rotation.ToString();
                ElevationTextBox.Text = chart.Projection.Elevation.ToString();

                WebExamplesUtilities.FillComboWithColorNames(LineColorDropDownList, KnownColor.Black);
                WebExamplesUtilities.FillComboWithValues(LineWidhtDropDownList, 1, 5, 1);
            }
            else
            {
                chart.Projection.Rotation  = (float)Convert.ToDouble(RotationTextBox.Text);
                chart.Projection.Elevation = (float)Convert.ToDouble(ElevationTextBox.Text);
            }

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

            linearScaleConfigurator.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);
            linearScaleConfigurator.StripStyles.Add(stripStyle);

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

            scaleX.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Back };
            scaleX.RoundToTickMin             = false;
            scaleX.RoundToTickMax             = false;
            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX;

            // setup Z axis
            NLinearScaleConfigurator scaleZ = new NLinearScaleConfigurator();

            scaleZ.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Left };
            scaleZ.RoundToTickMin             = false;
            scaleZ.RoundToTickMax             = false;
            chart.Axis(StandardAxis.Depth).ScaleConfigurator = scaleZ;

            // add the surface series
            NGridSurfaceSeries surface = (NGridSurfaceSeries)chart.Series.Add(SeriesType.GridSurface);

            surface.Name      = "Surface";
            surface.FillMode  = SurfaceFillMode.None;
            surface.FrameMode = SurfaceFrameMode.Mesh;
            surface.Data.SetGridSize(30, 30);
            surface.SyncPaletteWithAxisScale       = false;
            surface.PaletteSteps                   = 8;
            surface.ValueFormatter.FormatSpecifier = "0.0";
            surface.Legend.Mode = SeriesLegendMode.None;

            if (PaletteFrameCheckBox.Checked)
            {
                surface.FrameColorMode = SurfaceFrameColorMode.Zone;
            }
            else
            {
                surface.FrameColorMode = SurfaceFrameColorMode.Uniform;
            }

            SmoothPaletteCheckBox.Enabled = PaletteFrameCheckBox.Checked;

            if (SmoothPaletteCheckBox.Checked)
            {
                surface.SmoothPalette = true;
                surface.Legend.Format = "<zone_value>";
            }
            else
            {
                surface.SmoothPalette = false;
                surface.Legend.Format = "<zone_begin> - <zone_end>";
            }

            surface.FrameStrokeStyle.Color = WebExamplesUtilities.ColorFromDropDownList(LineColorDropDownList);
            surface.FrameStrokeStyle.Width = new NLength(LineWidhtDropDownList.SelectedIndex + 1, NGraphicsUnit.Pixel);

            FillData(surface);

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, null);
        }
Beispiel #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel header = nChartControl1.Labels.AddHeader("Axis Gridlines");

            header.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;
            header.ContentAlignment           = ContentAlignment.BottomRight;
            header.Location = new NPointL(
                new NLength(2, NRelativeUnit.ParentPercentage),
                new NLength(2, NRelativeUnit.ParentPercentage));

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

            chart.Enable3D   = true;
            chart.BoundsMode = BoundsMode.Stretch;
            chart.Location   = new NPointL(
                new NLength(10, NRelativeUnit.ParentPercentage),
                new NLength(15, NRelativeUnit.ParentPercentage));
            chart.Size = new NSizeL(
                new NLength(80, NRelativeUnit.ParentPercentage),
                new NLength(75, NRelativeUnit.ParentPercentage));

            // disable the depth axis
            chart.Axis(StandardAxis.Depth).Visible = false;

            NAxis leftAxis = chart.Axis(StandardAxis.PrimaryY);
            NLinearScaleConfigurator linearScaleConfigurator = (NLinearScaleConfigurator)leftAxis.ScaleConfigurator;

            linearScaleConfigurator.MinorTickCount = 3;

            NPointSeries pnt = (NPointSeries)chart.Series.Add(SeriesType.Point);

            pnt.InflateMargins         = true;
            pnt.DataLabelStyle.Visible = false;
            pnt.Values.FillRandom(Random, 5);
            pnt.Legend.Mode = SeriesLegendMode.None;

            if (!IsPostBack)
            {
                MajorGridLineStyleDropDown.Items.Add("Solid");
                MajorGridLineStyleDropDown.Items.Add("Dot");
                MajorGridLineStyleDropDown.Items.Add("Dash");
                MajorGridLineStyleDropDown.Items.Add("Dash-Dot");
                MajorGridLineStyleDropDown.Items.Add("Dash-Dot-Dot");
                MajorGridLineStyleDropDown.SelectedIndex = 0;

                MinorGridLineStyleDropDown.Items.Add("Solid");
                MinorGridLineStyleDropDown.Items.Add("Dot");
                MinorGridLineStyleDropDown.Items.Add("Dash");
                MinorGridLineStyleDropDown.Items.Add("Dash-Dot");
                MinorGridLineStyleDropDown.Items.Add("Dash-Dot-Dot");
                MinorGridLineStyleDropDown.SelectedIndex = 0;

                WebExamplesUtilities.FillComboWithColorNames(MajorGridLineColorDropDown, KnownColor.Black);
                WebExamplesUtilities.FillComboWithColorNames(MinorGridLineColorDropDown, KnownColor.Blue);

                MajorGridLineAtLeftWallCheckBox.Checked = linearScaleConfigurator.MajorGridStyle.GetShowAtWall(ChartWallType.Left);
                MajorGridLineAtBackWallCheckBox.Checked = linearScaleConfigurator.MajorGridStyle.GetShowAtWall(ChartWallType.Back);
                MinorGridLineAtLeftWallCheckBox.Checked = linearScaleConfigurator.MinorGridStyle.GetShowAtWall(ChartWallType.Left);
                MinorGridLineAtLeftWallCheckBox.Checked = linearScaleConfigurator.MinorGridStyle.GetShowAtWall(ChartWallType.Back);

                MajorGridLineAtLeftWallCheckBox.Checked = true;
                MajorGridLineAtBackWallCheckBox.Checked = true;
                MinorGridLineAtLeftWallCheckBox.Checked = true;
                MinorGridLineAtBackwallCheckBox.Checked = true;
            }

            // apply style sheet
            NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh);

            styleSheet.Apply(nChartControl1.Document);

            // configure Y chart axis
            NAxis axisY = chart.Axis(StandardAxis.PrimaryY);

            linearScaleConfigurator = (NLinearScaleConfigurator)axisY.ScaleConfigurator;

            linearScaleConfigurator.MajorGridStyle.LineStyle.Color   = WebExamplesUtilities.ColorFromDropDownList(MajorGridLineColorDropDown);
            linearScaleConfigurator.MinorGridStyle.LineStyle.Color   = WebExamplesUtilities.ColorFromDropDownList(MinorGridLineColorDropDown);
            linearScaleConfigurator.MajorGridStyle.LineStyle.Pattern = GetPatternFromIndex(MajorGridLineStyleDropDown.SelectedIndex);
            linearScaleConfigurator.MinorGridStyle.LineStyle.Pattern = GetPatternFromIndex(MinorGridLineStyleDropDown.SelectedIndex);

            // set gridlines
            linearScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Left, MajorGridLineAtLeftWallCheckBox.Checked);
            linearScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, MajorGridLineAtBackWallCheckBox.Checked);
            linearScaleConfigurator.MinorGridStyle.SetShowAtWall(ChartWallType.Left, MinorGridLineAtLeftWallCheckBox.Checked);
            linearScaleConfigurator.MinorGridStyle.SetShowAtWall(ChartWallType.Back, MinorGridLineAtBackwallCheckBox.Checked);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataLabelFormatDropDownList.Items.Add("high");
                DataLabelFormatDropDownList.Items.Add("low");
                DataLabelFormatDropDownList.Items.Add("high low");
                DataLabelFormatDropDownList.SelectedIndex = 0;

                WebExamplesUtilities.FillComboWithEnumValues(MarkerShapeDropDownList, typeof(PointShape));
                MarkerShapeDropDownList.SelectedIndex = 0;

                WebExamplesUtilities.FillComboWithColorNames(HighAreaColorDropDownList, KnownColor.LightSlateGray);
                WebExamplesUtilities.FillComboWithColorNames(LowAreaColorDropDownList, KnownColor.DarkOrange);
                WebExamplesUtilities.FillComboWithValues(MarkerSizeDropDownList, 0, 5, 1);
                MarkerSizeDropDownList.SelectedIndex = 2;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("2D High-Low Chart");

            title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;

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

            chart.BoundsMode = BoundsMode.Stretch;

            // setup X axis
            NOrdinalScaleConfigurator scaleX = (NOrdinalScaleConfigurator)chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator;

            scaleX.DisplayDataPointsBetweenTicks = false;

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

            scaleY.MajorGridStyle.LineStyle.Color = Color.LightGray;

            // add interlace stripe
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced  = true;
            stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back };
            scaleY.StripStyles.Add(stripStyle);

            NHighLowSeries highLow = (NHighLowSeries)chart.Series.Add(SeriesType.HighLow);

            highLow.Name                  = "High-Low Series";
            highLow.InflateMargins        = true;
            highLow.Legend.Mode           = SeriesLegendMode.SeriesLogic;
            highLow.MarkerStyle.FillStyle = new NColorFillStyle(Red);
            highLow.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(7);
            highLow.LowValues.ValueFormatter  = new NNumericValueFormatter("0.#");
            highLow.HighValues.ValueFormatter = new NNumericValueFormatter("0.#");

            highLow.HighFillStyle = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(HighAreaColorDropDownList));
            highLow.LowFillStyle  = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(LowAreaColorDropDownList));

            highLow.DropLines = ShowDropLinesCheckBox.Checked;
            highLow.DataLabelStyle.Visible = ShowDataLabelsCheckBox.Checked;

            switch (DataLabelFormatDropDownList.SelectedIndex)
            {
            case 0:
                highLow.DataLabelStyle.Format = "<high_value>";
                break;

            case 1:
                highLow.DataLabelStyle.Format = "<low_value>";
                break;

            case 2:
                highLow.DataLabelStyle.Format = "<high_value> - <low_value>";
                break;
            }

            MarkerShapeDropDownList.Enabled = ShowMarkersCheckBox.Checked;
            MarkerSizeDropDownList.Enabled  = ShowMarkersCheckBox.Checked;

            highLow.MarkerStyle.Visible    = ShowMarkersCheckBox.Checked;
            highLow.MarkerStyle.PointShape = (PointShape)MarkerShapeDropDownList.SelectedIndex;
            highLow.MarkerStyle.Width      = new NLength((float)MarkerSizeDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage);
            highLow.MarkerStyle.Height     = new NLength((float)MarkerSizeDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage);

            GenerateData(highLow);

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]);
        }
Beispiel #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                FillModeDropDownList.Items.Add("Uniform");
                FillModeDropDownList.Items.Add("Individual");
                FillModeDropDownList.SelectedIndex = 1;

                WebExamplesUtilities.FillComboWithColorNames(BarColorDropDownList, KnownColor.DarkOrange);

                WebExamplesUtilities.FillComboWithValues(CycleCountDropDownList, 2, 6, 1);
                CycleCountDropDownList.SelectedIndex = 4;

                WebExamplesUtilities.FillComboWithValues(BarCountDropDownList, 3, 20, 1);
                BarCountDropDownList.SelectedIndex = 3;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Series Appearance");

            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.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);
            chart.Axis(StandardAxis.Depth).Visible = false;

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

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

            NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar.Name = "Bar Series";
            bar.DataLabelStyle.Visible = false;
            bar.Values.FillRandom(Random, BarCountDropDownList.SelectedIndex + 3);

            switch (FillModeDropDownList.SelectedIndex)
            {
            case 0:     // Uniform
                BarColorDropDownList.Enabled   = true;
                CycleCountDropDownList.Enabled = false;

                bar.FillStyle = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(BarColorDropDownList));
                break;

            case 1:                     // Individual
                BarColorDropDownList.Enabled   = false;
                CycleCountDropDownList.Enabled = true;

                bar.FillStyles.Clear();

                NChartPalette palette = new NChartPalette();
                palette.SetPredefinedPalette(ChartPredefinedPalette.Nevron);

                int cycleCount   = CycleCountDropDownList.SelectedIndex + 1;
                int currentColor = 0;

                for (int i = 0; i < bar.Values.Count; i++)
                {
                    bar.FillStyles[i] = new NColorFillStyle(palette.SeriesColors[currentColor]);
                    currentColor++;

                    if (currentColor > cycleCount)
                    {
                        currentColor = 0;
                    }
                }
                break;
            }

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, null);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                // fill the combo
                LineStyleDropDownList.Items.Add("Line");
                LineStyleDropDownList.Items.Add("Tape");
                LineStyleDropDownList.Items.Add("Tube");
                LineStyleDropDownList.Items.Add("Ellipsoid");
                LineStyleDropDownList.SelectedIndex = 0;

                WebExamplesUtilities.FillComboWithEnumValues(MarkerShapeDropDownList, typeof(PointShape));
                MarkerShapeDropDownList.SelectedIndex = 1;

                WebExamplesUtilities.FillComboWithPercents(LineDepthDropDownList, 10);
                LineDepthDropDownList.SelectedIndex = 4;

                WebExamplesUtilities.FillComboWithValues(LineWidthDropDownList, 0, 5, 1);
                LineWidthDropDownList.SelectedIndex = 1;

                WebExamplesUtilities.FillComboWithColorNames(LineColorDropDownList, KnownColor.DarkSalmon);
                WebExamplesUtilities.FillComboWithColorNames(LineFillColorDropDownList, KnownColor.LightSalmon);

                WebExamplesUtilities.FillComboWithValues(MarkerSizeDropDownList, 0, 10, 1);
                MarkerSizeDropDownList.SelectedIndex = 2;

                ShowMarkersCheckBox.Checked         = true;
                LeftAxisRoundToTickCheckBox.Checked = true;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;
            nChartControl1.Settings.JitterMode = JitterMode.Enabled;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("3D Line Chart");

            title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;

            NChart chart = nChartControl1.Charts[0];

            chart.Enable3D = true;
            chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective2);
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);
            chart.Axis(StandardAxis.Depth).Visible = false;

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

            scaleY.RoundToTickMin = LeftAxisRoundToTickCheckBox.Checked;
            scaleY.RoundToTickMax = LeftAxisRoundToTickCheckBox.Checked;

            // add Y axis interlaced stripe
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

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

            // setup X axis
            NOrdinalScaleConfigurator scaleX = chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator;

            scaleX.MajorTickMode = MajorTickMode.AutoMaxCount;
            scaleX.DisplayDataPointsBetweenTicks = false;

            // setup the line series
            NLineSeries nLine = (NLineSeries)chart.Series.Add(SeriesType.Line);

            nLine.Values.FillRandom(Random, 10);
            nLine.DataLabelStyle.Visible = false;
            nLine.Legend.Mode            = SeriesLegendMode.DataPoints;

            nLine.BorderStyle.Width = new NLength(LineWidthDropDownList.SelectedIndex, NGraphicsUnit.Pixel);
            nLine.DepthPercent      = LineDepthDropDownList.SelectedIndex * 10;
            nLine.BorderStyle.Color = WebExamplesUtilities.ColorFromDropDownList(LineColorDropDownList);
            nLine.FillStyle         = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(LineFillColorDropDownList));

            nLine.InflateMargins      = InflateMarginsCheckBox.Checked;
            nLine.MarkerStyle.Visible = ShowMarkersCheckBox.Checked;

            bool bSimpleLine = (LineStyleDropDownList.SelectedIndex == 0);

            switch (LineStyleDropDownList.SelectedIndex)
            {
            case 0:                     // simple line
                nLine.LineSegmentShape = LineSegmentShape.Line;
                break;

            case 1:                     // tape
                nLine.LineSegmentShape = LineSegmentShape.Tape;
                break;

            case 2:                     // tube
                nLine.LineSegmentShape = LineSegmentShape.Tube;
                break;

            case 3:                     // elipsoid
                nLine.LineSegmentShape = LineSegmentShape.Ellipsoid;
                break;
            }

            LineDepthDropDownList.Enabled     = !bSimpleLine;
            LineFillColorDropDownList.Enabled = !bSimpleLine;

            MarkerShapeDropDownList.Enabled = ShowMarkersCheckBox.Checked;
            MarkerSizeDropDownList.Enabled  = ShowMarkersCheckBox.Checked;

            if (nLine.MarkerStyle.Visible)
            {
                nLine.MarkerStyle.PointShape        = (PointShape)MarkerShapeDropDownList.SelectedIndex;
                nLine.MarkerStyle.Height            = new NLength((float)MarkerSizeDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage);
                nLine.MarkerStyle.Width             = new NLength((float)MarkerSizeDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage);
                nLine.MarkerStyle.FillStyle         = new NColorFillStyle(Red);
                nLine.MarkerStyle.BorderStyle.Color = WebExamplesUtilities.ColorFromDropDownList(LineColorDropDownList);
            }

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, null);
        }
Beispiel #20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                WebExamplesUtilities.FillComboWithColorNames(UpColorDropDownList, KnownColor.White);
                WebExamplesUtilities.FillComboWithColorNames(DownColorDropDownList, KnownColor.Black);
                BoxSizeDropDownList.Items.AddRange(new ListItem[]
                {
                    new ListItem("0.5"),
                    new ListItem("1"),
                    new ListItem("2"),
                    new ListItem("2%"),
                    new ListItem("5%"),
                    new ListItem("10%")
                });
                BoxSizeDropDownList.SelectedIndex = 1;
                BoxWidthDropDownList.Items.AddRange(new ListItem[]
                {
                    new ListItem("50%"),
                    new ListItem("75%"),
                    new ListItem("100%")
                });
                BoxWidthDropDownList.SelectedIndex = 2;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Renko Chart");

            title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;

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

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

            chart.BoundsMode = BoundsMode.Stretch;

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

            priceConfigurator.InnerMajorTickStyle.LineStyle.Width = new NLength(0);
            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator   = priceConfigurator;

            // setup Y axis
            NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;
            NScaleStripStyle         stripStyle  = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

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

            NRenkoSeries renko = (NRenkoSeries)chart.Series.Add(SeriesType.Renko);

            renko.UseXValues    = true;
            renko.UpFillStyle   = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(UpColorDropDownList));
            renko.DownFillStyle = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(DownColorDropDownList));

            switch (BoxSizeDropDownList.SelectedIndex)
            {
            case 0:
                renko.BoxSize           = 0.5;
                renko.BoxSizeInPercents = false;
                break;

            case 1:
                renko.BoxSize           = 1;
                renko.BoxSizeInPercents = false;
                break;

            case 2:
                renko.BoxSize           = 2;
                renko.BoxSizeInPercents = false;
                break;

            case 3:
                renko.BoxSize           = 2;
                renko.BoxSizeInPercents = true;
                break;

            case 4:
                renko.BoxSize           = 5;
                renko.BoxSizeInPercents = true;
                break;

            case 5:
                renko.BoxSize           = 10;
                renko.BoxSizeInPercents = true;
                break;
            }

            switch (BoxWidthDropDownList.SelectedIndex)
            {
            case 0:
                renko.BoxWidthPercent = 50;
                break;

            case 1:
                renko.BoxWidthPercent = 75;
                break;

            case 2:
                renko.BoxWidthPercent = 100;
                break;
            }

            GenerateData(renko);

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, null);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LabelTextBox.Text = "Chart Title";

                WebExamplesUtilities.FillComboWithPercents(HorizontalMarginDropDownList, 10);
                HorizontalMarginDropDownList.SelectedIndex = 5;

                WebExamplesUtilities.FillComboWithPercents(VerticalMarginDropDownList, 10);
                VerticalMarginDropDownList.SelectedIndex = 1;

                ContentAlignmentDropDownList.Items.Add("BottomCenter");
                ContentAlignmentDropDownList.Items.Add("BottomLeft");
                ContentAlignmentDropDownList.Items.Add("BottomRight");
                ContentAlignmentDropDownList.Items.Add("MiddleCenter");
                ContentAlignmentDropDownList.Items.Add("MiddleLeft");
                ContentAlignmentDropDownList.Items.Add("MiddleRight");
                ContentAlignmentDropDownList.Items.Add("TopCenter");
                ContentAlignmentDropDownList.Items.Add("TopLeft");
                ContentAlignmentDropDownList.Items.Add("TopRight");
                ContentAlignmentDropDownList.SelectedIndex = 0;

                WebExamplesUtilities.FillComboWithFontNames(FontDropDownList, "Arial");
                WebExamplesUtilities.FillComboWithValues(FontSizeDropDownList, 8, 52, 1);
                FontSizeDropDownList.SelectedIndex = 2;

                WebExamplesUtilities.FillComboWithColorNames(FontColorDropDownList, KnownColor.Black);
                WebExamplesUtilities.FillComboWithValues(FontOrientationDropDownList, 0, 360, 10);

                HasBackplaneCheckBox.Checked = true;

                BackplaneStyleDropDownList.Items.Add("Rectangle");
                BackplaneStyleDropDownList.Items.Add("Ellipse");
                BackplaneStyleDropDownList.Items.Add("Circle");
                BackplaneStyleDropDownList.Items.Add("Cut Edge Rectangle");
                BackplaneStyleDropDownList.Items.Add("Smooth Edge Rectangle");
                BackplaneStyleDropDownList.SelectedIndex = 0;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // setup the label
            NLabel label = new NLabel();

            nChartControl1.Panels.Add(label);
            label.Text = LabelTextBox.Text;
            label.TextStyle.FillStyle              = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(FontColorDropDownList));
            label.TextStyle.Orientation            = FontOrientationDropDownList.SelectedIndex * 10;
            label.TextStyle.BackplaneStyle.Visible = HasBackplaneCheckBox.Checked;
            label.ContentAlignment = (ContentAlignment)Enum.Parse(typeof(ContentAlignment), ContentAlignmentDropDownList.SelectedItem.Text);
            label.Location         = new NPointL(
                new NLength(HorizontalMarginDropDownList.SelectedIndex * 10, NRelativeUnit.ParentPercentage),
                new NLength(VerticalMarginDropDownList.SelectedIndex * 10, NRelativeUnit.ParentPercentage));

            try
            {
                label.TextStyle.FontStyle = new NFontStyle(FontDropDownList.SelectedItem.Text, FontSizeDropDownList.SelectedIndex + 8);;
            }
            catch
            {
            }

            BackplaneStyleDropDownList.Enabled = HasBackplaneCheckBox.Checked;

            if (HasBackplaneCheckBox.Checked)
            {
                label.TextStyle.BackplaneStyle.Shape = (BackplaneShape)BackplaneStyleDropDownList.SelectedIndex;
            }

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

            // setup the chart
            NChart chart = nChartControl1.Charts[0];

            chart.BoundsMode = BoundsMode.Fit;
            chart.Axis(StandardAxis.PrimaryX).Visible = false;
            chart.Axis(StandardAxis.PrimaryY).Visible = false;
            chart.Location = new NPointL(
                new NLength(15, NRelativeUnit.ParentPercentage),
                new NLength(20, NRelativeUnit.ParentPercentage));
            chart.Size = new NSizeL(
                new NLength(70, NRelativeUnit.ParentPercentage),
                new NLength(60, NRelativeUnit.ParentPercentage));

            NBarSeries series = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            series.DataLabelStyle.Visible = false;
            series.Values.AddRange(new double[] { 16, 42, 56, 23, 47, 38 });

            // apply style sheet
            NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor);

            styleSheet.Apply(series);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                WebExamplesUtilities.FillComboWithValues(LABeginValueDropDownList, 0, 100, 10);
                WebExamplesUtilities.FillComboWithValues(LAEndValueDropDownList, 0, 100, 10);
                WebExamplesUtilities.FillComboWithValues(BABeginValueDropDownList, 0, 100, 10);
                WebExamplesUtilities.FillComboWithValues(BAEndValueDropDownList, 0, 100, 10);

                WebExamplesUtilities.FillComboWithColorNames(LAColorDropDownList, KnownColor.LightSteelBlue);
                WebExamplesUtilities.FillComboWithColorNames(BAStripeColorDropDownList, KnownColor.LightSteelBlue);

                // init form controls
                LABeginValueDropDownList.SelectedIndex = 2;
                LAEndValueDropDownList.SelectedIndex   = 6;

                BABeginValueDropDownList.SelectedIndex = 2;
                BAEndValueDropDownList.SelectedIndex   = 6;

                LAShowAtBackWallCheckBox.Checked = true;
                LAShowAtLeftWallCheckBox.Checked = true;
                BAShowAtBackWallCheckBox.Checked = true;
                BAShowAtFloorCheckBox.Checked    = true;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel header = nChartControl1.Labels.AddHeader("Axis Stripes");

            header.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;
            header.ContentAlignment           = ContentAlignment.BottomRight;
            header.Location = new NPointL(
                new NLength(2, NRelativeUnit.ParentPercentage),
                new NLength(2, NRelativeUnit.ParentPercentage));

            NChart chart = nChartControl1.Charts[0];

            chart.Enable3D = true;

            // set projection and lighting
            chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted);
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.MetallicLustre);

            // configure the chart margins
            chart.BoundsMode = BoundsMode.Fit;
            chart.Location   = new NPointL(
                new NLength(10, NRelativeUnit.ParentPercentage),
                new NLength(15, NRelativeUnit.ParentPercentage));
            chart.Size = new NSizeL(
                new NLength(80, NRelativeUnit.ParentPercentage),
                new NLength(78, NRelativeUnit.ParentPercentage));

            // disable the depth axis
            chart.Axis(StandardAxis.Depth).Visible = false;

            NLinearScaleConfigurator linearScale = (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);
            stripStyle.SetShowAtWall(ChartWallType.Left, true);
            linearScale.StripStyles.Add(stripStyle);

            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NLinearScaleConfigurator();

            // Add stripes for the left and the bottom axes
            NAxisStripe stripeY = chart.Axis(StandardAxis.PrimaryY).Stripes.Add(2, 3);
            NAxisStripe stripeX = chart.Axis(StandardAxis.PrimaryX).Stripes.Add(2, 3);

            stripeY.From = LABeginValueDropDownList.SelectedIndex * 10;
            stripeY.To   = LAEndValueDropDownList.SelectedIndex * 10;

            stripeY.FillStyle = new NColorFillStyle(Color.FromArgb(125, WebExamplesUtilities.ColorFromDropDownList(LAColorDropDownList)));
            stripeY.SetShowAtWall(ChartWallType.Back, LAShowAtBackWallCheckBox.Checked);
            stripeY.SetShowAtWall(ChartWallType.Left, LAShowAtLeftWallCheckBox.Checked);

            stripeX.From      = BABeginValueDropDownList.SelectedIndex * 10;
            stripeX.To        = BAEndValueDropDownList.SelectedIndex * 10;
            stripeX.FillStyle = new NColorFillStyle(Color.FromArgb(125, WebExamplesUtilities.ColorFromDropDownList(BAStripeColorDropDownList)));
            stripeX.SetShowAtWall(ChartWallType.Back, BAShowAtBackWallCheckBox.Checked);
            stripeX.SetShowAtWall(ChartWallType.Floor, BAShowAtFloorCheckBox.Checked);

            // Create a point series
            NPointSeries pnt = (NPointSeries)chart.Series.Add(SeriesType.Point);

            pnt.InflateMargins        = true;
            pnt.UseXValues            = true;
            pnt.Name                  = "Series 1";
            pnt.DataLabelStyle.Format = "<value>";

            // Add some data
            pnt.Values.Add(31);
            pnt.Values.Add(67);
            pnt.Values.Add(12);
            pnt.Values.Add(84);
            pnt.Values.Add(90);
            pnt.XValues.Add(10);
            pnt.XValues.Add(36);
            pnt.XValues.Add(52);
            pnt.XValues.Add(62);
            pnt.XValues.Add(88);

            // apply style sheet
            NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh);

            styleSheet.Apply(nChartControl1.Document);
        }
Beispiel #23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                WebExamplesUtilities.FillComboWithColorNames(UpStickColorDropDownList, KnownColor.Black);
                WebExamplesUtilities.FillComboWithColorNames(DownStickColorDropDownList, KnownColor.Crimson);

                // init form controls
                ShowHighLowCheckBox.Checked = true;
                ShowOpenCheckBox.Checked    = true;
                ShowCloseCheckBox.Checked   = true;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Stick Stock Chart");

            title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;

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

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

            chart.BoundsMode = BoundsMode.Stretch;

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

            scaleX.FirstRow.GridStyle.ShowAtWalls   = new ChartWallType[] { ChartWallType.Back };
            scaleX.FirstRow.GridStyle.LineStyle     = new NStrokeStyle(1, Color.FromArgb(225, 225, 225));
            scaleX.FirstRow.UseGridStyle            = true;
            scaleX.FirstRow.InnerTickStyle.Visible  = false;
            scaleX.SecondRow.GridStyle.ShowAtWalls  = new ChartWallType[] { ChartWallType.Back };
            scaleX.SecondRow.GridStyle.LineStyle    = new NStrokeStyle(1, Color.FromArgb(215, 215, 215));
            scaleX.SecondRow.UseGridStyle           = true;
            scaleX.SecondRow.InnerTickStyle.Visible = false;
            scaleX.ThirdRow.GridStyle.ShowAtWalls   = new ChartWallType[] { ChartWallType.Back };
            scaleX.ThirdRow.GridStyle.LineStyle     = new NStrokeStyle(1, Color.FromArgb(205, 205, 205));
            scaleX.ThirdRow.UseGridStyle            = true;
            scaleX.ThirdRow.InnerTickStyle.Visible  = false;
            // calendar
            NWeekDayRule wdr = new NWeekDayRule(WeekDayBit.All);

            wdr.Saturday = false;
            wdr.Sunday   = false;
            scaleX.Calendar.Rules.Add(wdr);
            scaleX.EnableCalendar = true;
            // set configurator
            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX;

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

            scaleY.OuterMajorTickStyle.Length  = new NLength(3, NGraphicsUnit.Point);
            scaleY.InnerMajorTickStyle.Visible = false;

            NFillStyle       stripFill  = new NColorFillStyle(Color.FromArgb(234, 233, 237));
            NScaleStripStyle stripStyle = new NScaleStripStyle(stripFill, null, true, 1, 0, 1, 1);

            stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back };
            stripStyle.Interlaced  = true;
            scaleY.StripStyles.Add(stripStyle);

            // setup stock series
            NStockSeries stock = (NStockSeries)chart.Series.Add(SeriesType.Stock);

            stock.CandleStyle            = CandleStyle.Stick;
            stock.CandleWidth            = new NLength(1.3f, NRelativeUnit.ParentPercentage);
            stock.DataLabelStyle.Visible = false;
            stock.UseXValues             = true;
            stock.InflateMargins         = true;
            stock.UpStrokeStyle.Width    = new NLength(1, NGraphicsUnit.Point);
            stock.DownStrokeStyle.Width  = new NLength(1, NGraphicsUnit.Point);
            stock.ShowClose   = ShowCloseCheckBox.Checked;
            stock.ShowOpen    = ShowOpenCheckBox.Checked;
            stock.ShowHighLow = ShowHighLowCheckBox.Checked;

            stock.UpStrokeStyle.Color   = WebExamplesUtilities.ColorFromDropDownList(UpStickColorDropDownList);
            stock.DownStrokeStyle.Color = WebExamplesUtilities.ColorFromDropDownList(DownStickColorDropDownList);

            // add some stock items
            const int count = 40;

            GenerateOHLCData(stock, count);
            FillStockDates(stock, count);

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, null);
        }
Beispiel #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ImageBorderDropDownList.Items.Add("Common");
                ImageBorderDropDownList.Items.Add("Embed");
                ImageBorderDropDownList.Items.Add("Emboss");
                ImageBorderDropDownList.Items.Add("Rounded");
                ImageBorderDropDownList.Items.Add("RoundedBorder");
                ImageBorderDropDownList.Items.Add("Rectangular");
                ImageBorderDropDownList.Items.Add("Thin");
                ImageBorderDropDownList.Items.Add("Thick");
                ImageBorderDropDownList.Items.Add("OuterRounded");
                ImageBorderDropDownList.Items.Add("OpenLeft");
                ImageBorderDropDownList.Items.Add("OpenRight");

                WebExamplesUtilities.FillComboWithColorNames(BorderColorDropDownList, KnownColor.LightSteelBlue);
                WebExamplesUtilities.FillComboWithColorNames(FillingColorDropDownList, KnownColor.Snow);
                WebExamplesUtilities.FillComboWithColorNames(PageBackgroundColorDropDownList, KnownColor.White);
                HasShadowCheckBox.Checked = true;

                ImageBorderDropDownList.SelectedIndex = 6;
            }

            // set an image frame
            NImageFrameStyle imageFrameStyle = new NImageFrameStyle();

            imageFrameStyle.SetPredefinedFrameStyle((PredefinedImageFrame)(ImageBorderDropDownList.SelectedIndex));
            imageFrameStyle.FillStyle         = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(FillingColorDropDownList));
            imageFrameStyle.BorderStyle.Width = new NLength(1, NGraphicsUnit.Pixel);
            imageFrameStyle.BorderStyle.Color = WebExamplesUtilities.ColorFromDropDownList(BorderColorDropDownList);
            imageFrameStyle.BackgroundColor   = WebExamplesUtilities.ColorFromDropDownList(PageBackgroundColorDropDownList);
            imageFrameStyle.ShadowStyle.Type  = HasShadowCheckBox.Checked ? ShadowType.LinearBlur : ShadowType.None;

            nChartControl1.BackgroundStyle.FrameStyle = imageFrameStyle;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Image Border");

            title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;

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

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

            // add the first bar
            NBarSeries bar1 = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar1.MultiBarMode           = MultiBarMode.Series;
            bar1.DataLabelStyle.Visible = false;
            bar1.Values.FillRandomRange(Random, 5, 10, 40);

            // add the second bar
            NBarSeries bar2 = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar2.MultiBarMode           = MultiBarMode.Stacked;
            bar2.DataLabelStyle.Visible = false;
            bar2.Values.FillRandomRange(Random, 5, 10, 40);

            // add the third bar
            NBarSeries bar3 = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar3.MultiBarMode           = MultiBarMode.Stacked;
            bar3.DataLabelStyle.Visible = false;
            bar3.Values.FillRandomRange(Random, 5, 10, 40);

            // apply style sheet
            NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh);

            styleSheet.Apply(nChartControl1.Document);

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, null);
        }