Ejemplo n.º 1
0
        private void LeftShowAtBackCheck_CheckedChanged(object sender, System.EventArgs e)
        {
            NAxisStripe stripe = (NAxisStripe)m_Chart.Axis(StandardAxis.PrimaryY).Stripes[0];

            stripe.SetShowAtWall(ChartWallType.Back, LeftShowAtBackCheck.Checked);

            nChartControl1.Refresh();
        }
Ejemplo n.º 2
0
        private void BottomShowAtFloorCheck_CheckedChanged(object sender, System.EventArgs e)
        {
            NAxisStripe stripe = (NAxisStripe)m_Chart.Axis(StandardAxis.PrimaryX).Stripes[0];

            stripe.SetShowAtWall(ChartWallType.Floor, BottomShowAtFloorCheck.Checked);

            nChartControl1.Refresh();
        }
Ejemplo n.º 3
0
        private void BottomEndScroll_Scroll(object sender, Nevron.UI.WinForm.Controls.ScrollBarEventArgs e)
        {
            NAxisStripe stripe = (NAxisStripe)m_Chart.Axis(StandardAxis.PrimaryX).Stripes[0];

            stripe.To = BottomEndScroll.Value / 20.0;

            nChartControl1.Refresh();
        }
Ejemplo n.º 4
0
        private void BottomTitleAlignmentCombo_SelectedIndexChanged(object sender, EventArgs e)
        {
            NAxisStripe stripe = (NAxisStripe)m_Chart.Axis(StandardAxis.PrimaryX).Stripes[0];

            stripe.TextAlignment = (ContentAlignment)Enum.Parse(typeof(ContentAlignment), BottomTitleAlignmentCombo.SelectedItem.ToString());

            nChartControl1.Refresh();
        }
Ejemplo n.º 5
0
        private void BottomTitleTextBox_TextChanged(object sender, EventArgs e)
        {
            NAxisStripe stripe = (NAxisStripe)m_Chart.Axis(StandardAxis.PrimaryX).Stripes[0];

            stripe.Text = BottomTitleTextBox.Text;

            nChartControl1.Refresh();
        }
Ejemplo n.º 6
0
        private void LeftBeginScroll_Scroll(object sender, Nevron.UI.WinForm.Controls.ScrollBarEventArgs e)
        {
            NAxisStripe stripe = (NAxisStripe)m_Chart.Axis(StandardAxis.PrimaryY).Stripes[0];

            stripe.From = LeftBeginScroll.Value / 10.0;

            nChartControl1.Refresh();
        }
Ejemplo n.º 7
0
        private void LeftIncludeInAxisRangeCheckBox_CheckedChanged(object sender, EventArgs e)
        {
            NAxisStripe stripe = (NAxisStripe)m_Chart.Axis(StandardAxis.PrimaryY).Stripes[0];

            stripe.IncludeFromValueInAxisRange = LeftIncludeInAxisRangeCheckBox.Checked;
            stripe.IncludeToValueInAxisRange   = LeftIncludeInAxisRangeCheckBox.Checked;

            nChartControl1.Refresh();
        }
Ejemplo n.º 8
0
        private void BottomTitleTextStyleButton_Click(object sender, EventArgs e)
        {
            NAxisStripe stripe = (NAxisStripe)m_Chart.Axis(StandardAxis.PrimaryX).Stripes[0];
            NTextStyle  textStyle;

            if (NTextStyleTypeEditor.Edit(stripe.TextStyle, out textStyle))
            {
                stripe.TextStyle = textStyle;
                nChartControl1.Refresh();
            }
        }
Ejemplo n.º 9
0
        private void BottomFillStyleButton_Click(object sender, System.EventArgs e)
        {
            NAxisStripe stripe = (NAxisStripe)m_Chart.Axis(StandardAxis.PrimaryX).Stripes[0];
            NFillStyle  fillStyleResult;

            if (NFillStyleTypeEditor.Edit(stripe.FillStyle, out fillStyleResult))
            {
                stripe.FillStyle = fillStyleResult;
                nChartControl1.Refresh();
            }
        }
        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);

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

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

                // init the form controls
                WebExamplesUtilities.FillComboWithEnumNames(LAContentAlignmentDropDownList, typeof(ContentAlignment));
                LAContentAlignmentDropDownList.SelectedIndex = 0;
                LATextTextBox.Text = "Left Axis Line Text";

                WebExamplesUtilities.FillComboWithEnumNames(BAContentAlignmentDropDownList, typeof(ContentAlignment));
                BAContentAlignmentDropDownList.SelectedIndex = 0;
                BATextTextBox.Text = "Bottom Axis Line Text";
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

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

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

            NChart chart = nChartControl1.Charts[0];

            // 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.FillStyle = new NColorFillStyle(Color.FromArgb(50, Color.Blue));
            stripeY.From      = LABeginValueDropDownList.SelectedIndex * 10;
            stripeY.To        = LAEndValueDropDownList.SelectedIndex * 10;
            stripeY.SetShowAtWall(ChartWallType.Back, true);
            stripeY.TextAlignment = (ContentAlignment)Enum.Parse(typeof(ContentAlignment), LAContentAlignmentDropDownList.SelectedItem.Text);
            stripeY.Text          = LATextTextBox.Text;

            stripeX.FillStyle = new NColorFillStyle(Color.FromArgb(50, Color.Blue));
            stripeX.From      = BABeginValueDropDownList.SelectedIndex * 10;
            stripeX.To        = BAEndValueDropDownList.SelectedIndex * 10;
            stripeX.SetShowAtWall(ChartWallType.Back, true);
            stripeX.TextAlignment = (ContentAlignment)Enum.Parse(typeof(ContentAlignment), BAContentAlignmentDropDownList.SelectedItem.Text);
            stripeX.Text          = BATextTextBox.Text;

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

            pnt.InflateMargins         = true;
            pnt.UseXValues             = true;
            pnt.Name                   = "Series 1";
            pnt.DataLabelStyle.Visible = false;

            // 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);

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, null);
        }
        public override void Initialize()
        {
            base.Initialize();

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

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic);
            title.ContentAlignment    = ContentAlignment.BottomCenter;
            title.Location            = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage));

            // init the values for the tooltip properties
            NTooltipTool tooltip = new NTooltipTool();

            AutoPopDelayUpDown.Value = tooltip.AutoPopDelay;
            InitialDelayUpDown.Value = tooltip.InitialDelay;
            ReshowDelayUpDown.Value  = tooltip.ReshowDelay;

            m_Chart = nChartControl1.Charts[0];
            m_Chart.Axis(StandardAxis.Depth).Visible = false;

            // Add stripes for the left and the bottom axes
            NAxisStripe s1 = m_Chart.Axis(StandardAxis.PrimaryY).Stripes.Add(50, 60);
            NAxisStripe s2 = m_Chart.Axis(StandardAxis.PrimaryX).Stripes.Add(2, 3);

            s1.FillStyle = new NColorFillStyle(Color.CornflowerBlue);
            s1.SetShowAtWall(ChartWallType.Left, true);
            s2.FillStyle = new NColorFillStyle(Color.DarkOrange);

            // Create a bar series
            m_Bar = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar);

            m_Bar.BarShape    = BarShape.Bar;
            m_Bar.Legend.Mode = SeriesLegendMode.DataPoints;
            m_Bar.Values.Add(20.0);
            m_Bar.Values.Add(60.0);
            m_Bar.Values.Add(50.0);
            m_Bar.Values.Add(80.0);
            m_Bar.Values.Add(60.0);

            m_Bar.InteractivityStyles.Add(0, new NInteractivityStyle("Data item 0", CursorType.Default));
            m_Bar.InteractivityStyles.Add(1, new NInteractivityStyle("Data item 1", CursorType.Default));
            m_Bar.InteractivityStyles.Add(2, new NInteractivityStyle("Data item 2", CursorType.Default));
            m_Bar.InteractivityStyles.Add(3, new NInteractivityStyle("Data item 3", CursorType.Default));
            m_Bar.InteractivityStyles.Add(4, new NInteractivityStyle("Data item 4", CursorType.Default));

            // set some fill styles in the collection.
            NFillStyle fillStyle;

            fillStyle = new NGradientFillStyle(GradientStyle.DiagonalUp, GradientVariant.Variant3, Color.Chocolate, Color.WhiteSmoke);
            m_Bar.FillStyles.Add(0, fillStyle);

            fillStyle = new NGradientFillStyle(GradientStyle.DiagonalUp, GradientVariant.Variant3, Color.Goldenrod, Color.WhiteSmoke);
            m_Bar.FillStyles.Add(1, fillStyle);

            fillStyle = new NGradientFillStyle(GradientStyle.DiagonalUp, GradientVariant.Variant3, Color.OliveDrab, Color.WhiteSmoke);
            m_Bar.FillStyles.Add(2, fillStyle);

            fillStyle = new NGradientFillStyle(GradientStyle.DiagonalUp, GradientVariant.Variant3, Color.SteelBlue, Color.WhiteSmoke);
            m_Bar.FillStyles.Add(3, fillStyle);

            fillStyle = new NGradientFillStyle(GradientStyle.DiagonalUp, GradientVariant.Variant3, Color.BlueViolet, Color.WhiteSmoke);
            m_Bar.FillStyles.Add(4, fillStyle);

            // init form controls
            EnableTooltipChangeCheckBox.Checked = true;
            CursorChangeCheckBox.Checked        = true;

            ChartObjectComboBox.Items.Add("Background");
            ChartObjectComboBox.Items.Add("Back chart wall");
            ChartObjectComboBox.Items.Add("Left chart wall");
            ChartObjectComboBox.Items.Add("Floor chart wall");
            ChartObjectComboBox.Items.Add("Primary Y axis");
            ChartObjectComboBox.Items.Add("Primary X axis");
            ChartObjectComboBox.Items.Add("Horizontal stripe");
            ChartObjectComboBox.Items.Add("Vertical stripe");
            ChartObjectComboBox.Items.Add("Legend");
            ChartObjectComboBox.Items.Add("Data item 0");
            ChartObjectComboBox.Items.Add("Data item 1");
            ChartObjectComboBox.Items.Add("Data item 2");
            ChartObjectComboBox.Items.Add("Data item 3");
            ChartObjectComboBox.Items.Add("Data item 4");
            ChartObjectComboBox.SelectedIndex = 0;

            CursorComboBox.FillFromEnum(typeof(CursorType));
            CursorComboBox.SelectedIndex = 0;
        }
Ejemplo n.º 12
0
        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);
        }
Ejemplo n.º 13
0
        public override void Initialize()
        {
            base.Initialize();

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

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic);
            title.ContentAlignment    = ContentAlignment.BottomCenter;
            title.Location            = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage));

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

            // setup chart
            m_Chart          = nChartControl1.Charts[0];
            m_Chart.Enable3D = true;

            // apply predefined lighting and projection
            m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1);
            m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);

            m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = new NLinearScaleConfigurator();

            // configure the x and y scales
            NLinearScaleConfigurator yScale = new NLinearScaleConfigurator();

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

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

            // display major grid lines at back and left walls
            yScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true);
            yScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);

            m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = yScale;

            NLinearScaleConfigurator xScale = new NLinearScaleConfigurator();

            xScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true);
            xScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = xScale;

            // Create a point series
            NPointSeries pnt = (NPointSeries)m_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(3.1);
            pnt.Values.Add(6.7);
            pnt.Values.Add(1.2);
            pnt.Values.Add(8.4);
            pnt.Values.Add(9.0);
            pnt.XValues.Add(0.5);
            pnt.XValues.Add(1.8);
            pnt.XValues.Add(2.6);
            pnt.XValues.Add(3.1);
            pnt.XValues.Add(4.4);

            // Add stripes for the left and the bottom axes
            NAxisStripe s1 = m_Chart.Axis(StandardAxis.PrimaryY).Stripes.Add(2, 3);

            s1.FillStyle = new NColorFillStyle(Color.FromArgb(125, Color.SteelBlue));
            NAxisStripe s2 = m_Chart.Axis(StandardAxis.PrimaryX).Stripes.Add(2, 3);

            s2.FillStyle = new NColorFillStyle(Color.FromArgb(125, Color.SteelBlue));

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

            styleSheet.Apply(nChartControl1.Document);

            // init form controls
            LeftBeginScroll.Value   = (int)(s1.From * 10);
            LeftEndScroll.Value     = (int)(s1.To * 10);
            BottomBeginScroll.Value = (int)(s2.From * 20);
            BottomEndScroll.Value   = (int)(s2.To * 20);

            LeftShowAtBackCheck.Checked    = true;
            LeftShowAtLeftCheck.Checked    = true;
            BottomShowAtBackCheck.Checked  = true;
            BottomShowAtFloorCheck.Checked = true;

            nChartControl1.Refresh();
        }
Ejemplo n.º 14
0
        private void SetupCharts(NChart pointChart, NChart boxChart)
        {
            // data
            double[] arrValues = { 204.5, 190.6, 199.7, 131.8, 143.4,
                                   215.1, 228.0, 209.2, 183.8, 169.5,
                                   212.0, 254.9, 222.3, 201.0, 215.4,
                                   191.3, 181.5, 207.0, 199.0, 210.0 };

            // setup point chart
            NStandardScaleConfigurator scaleY1 = (NStandardScaleConfigurator)pointChart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;

            scaleY1.InnerMajorTickStyle.Visible = false;
            scaleY1.MajorGridStyle.ShowAtWalls  = new ChartWallType[0];

            NOrdinalScaleConfigurator scaleX1 = (NOrdinalScaleConfigurator)pointChart.Axis(StandardAxis.PrimaryX).ScaleConfigurator;

            scaleX1.InnerMajorTickStyle.Visible   = false;
            scaleX1.DisplayDataPointsBetweenTicks = false;

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

            point.InflateMargins         = true;
            point.DataLabelStyle.Visible = false;
            point.Size        = new NLength(1.5f, NRelativeUnit.RootPercentage);
            point.PointShape  = PointShape.Ellipse;
            point.FillStyle   = new NColorFillStyle(DarkOrange);
            point.BorderStyle = new NStrokeStyle(DarkOrange);
            point.Values.AddRange(arrValues);

            // setup box and whiskers chart
            boxChart.Width = 10;
            boxChart.Axis(StandardAxis.PrimaryY).Anchor = new NDockAxisAnchor(AxisDockZone.FrontRight, false);
            NStandardScaleConfigurator scaleY2 = (NStandardScaleConfigurator)boxChart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;

            scaleY2.InnerMajorTickStyle.Visible = false;
            scaleY2.MajorGridStyle.ShowAtWalls  = new ChartWallType[0];

            boxChart.Axis(StandardAxis.PrimaryX).Visible = false;

            // setup box and whiskers series
            NBoxAndWhiskersSeries boxSeries = (NBoxAndWhiskersSeries)boxChart.Series.Add(SeriesType.BoxAndWhiskers);

            boxSeries.InflateMargins         = true;
            boxSeries.DataLabelStyle.Visible = false;
            boxSeries.FillStyle           = new NColorFillStyle(Red);
            boxSeries.OutliersFillStyle   = new NColorFillStyle(DarkOrange);
            boxSeries.OutliersBorderStyle = new NStrokeStyle(DarkOrange);
            boxSeries.OutliersSize        = new NLength(1.5f, NRelativeUnit.RootPercentage);
            boxSeries.MedianStrokeStyle   = new NStrokeStyle(Color.Indigo);
            boxSeries.AverageStrokeStyle  = new NStrokeStyle(1, Color.DarkRed, LinePattern.Dot);

            // create a box and whiskers data point and initialize it from the point series
            NBoxAndWhiskersDataPoint bwdp = new NBoxAndWhiskersDataPoint(point.Values, true, true);

            boxSeries.AddDataPoint(bwdp);

            // synchronize axes
            NAxis axis1 = pointChart.Axis(StandardAxis.PrimaryY);
            NAxis axis2 = boxChart.Axis(StandardAxis.PrimaryY);

            axis1.Slaves.Add(axis2);
            axis2.Slaves.Add(axis1);

            // set an axis stripe for the interquartile range
            double      dQ1       = (double)bwdp[DataPointValue.LowerBoxValue];
            double      dQ3       = (double)bwdp[DataPointValue.UpperBoxValue];
            NAxisStripe boxStripe = axis1.Stripes.Add(dQ1, dQ3);

            boxStripe.FillStyle = new NColorFillStyle(Color.FromArgb(50, GreyBlue));

            // set an axis stripe for the min / max range
            double      dMin           = (double)bwdp[DataPointValue.LowerWhiskerValue];
            double      dMax           = (double)bwdp[DataPointValue.UpperWhiskerValue];
            NAxisStripe whiskersStripe = axis1.Stripes.Add(dMin, dMax);

            whiskersStripe.FillStyle = new NColorFillStyle(Color.FromArgb(30, GreyBlue));
        }
Ejemplo n.º 15
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Axis Stripes";

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

            // configure axes
            chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XOrdinalYLinear);

            // configure the y scale
            NLinearScale yScale = (NLinearScale)chart.Axes[ENCartesianAxis.PrimaryY].Scale;

            NScaleStrip stripStyle = new NScaleStrip(new NColorFill(NColor.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;
            yScale.Strips.Add(stripStyle);

            yScale.MajorGridLines.Visible = true;

            // Create a point series
            NPointSeries point = new NPointSeries();

            point.InflateMargins = true;
            point.UseXValues     = true;
            point.Name           = "Series 1";
            chart.Series.Add(point);

            NDataLabelStyle dataLabelStyle = new NDataLabelStyle();

            dataLabelStyle.Visible = false;
            point.DataLabelStyle   = dataLabelStyle;

            // Add some data
            double[] yValues = new double[] { 31, 67, 12, 84, 90 };
            double[] xValues = new double[] { 5, 36, 51, 76, 93 };

            for (int i = 0; i < yValues.Length; i++)
            {
                point.DataPoints.Add(new NPointDataPoint(xValues[i], yValues[i]));
            }

            // Add a constline for the left axis
            m_XStripe       = new NAxisStripe();
            m_XStripe.Fill  = new NColorFill(NColor.FromColor(NColor.SteelBlue, 0.5f));
            m_XStripe.Range = new NRange(40, 60);
            m_XStripe.Text  = "X Axis Stripe";
            chart.Axes[ENCartesianAxis.PrimaryX].Stripes.Add(m_XStripe);

            // Add a constline for the bottom axis
            m_YStripe       = new NAxisStripe();
            m_YStripe.Fill  = new NColorFill(NColor.FromColor(NColor.SteelBlue, 0.5f));
            m_YStripe.Range = new NRange(40, 60);
            m_YStripe.Text  = "Y Axis Stripe";
            chart.Axes[ENCartesianAxis.PrimaryY].Stripes.Add(m_YStripe);

            chartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, false));

            return(chartView);
        }
Ejemplo n.º 16
0
        private void SetupCharts(NChart pointChart, NChart boxChart)
        {
            // data
            double[] arrValues = { 204.5, 190.6, 199.7, 131.8, 143.4,
                                   215.1, 228.0, 209.2, 183.8, 169.5,
                                   212.0, 254.9, 222.3, 201.0, 215.4,
                                   191.3, 181.5, 207.0, 199.0, 210.0 };

            // setup point chart
            NStandardScaleConfigurator scaleConfigurator;

            scaleConfigurator = pointChart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NStandardScaleConfigurator;
            scaleConfigurator.InnerMajorTickStyle.LineStyle.Width = new NLength(0);

            scaleConfigurator = pointChart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NStandardScaleConfigurator;
            scaleConfigurator.InnerMajorTickStyle.LineStyle.Width = new NLength(0);

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

            point.InflateMargins         = true;
            point.DataLabelStyle.Visible = false;
            point.Size        = new NLength(10, NGraphicsUnit.Point);
            point.PointShape  = PointShape.Ellipse;
            point.FillStyle   = new NColorFillStyle(Color.Yellow);
            point.BorderStyle = new NStrokeStyle(GreyBlue);
            point.Values.AddRange(arrValues);

            // setup box and whiskers chart
            boxChart.Width = 10;
            boxChart.Axis(StandardAxis.PrimaryY).Anchor  = new NDockAxisAnchor(AxisDockZone.FrontRight, false);
            boxChart.Axis(StandardAxis.PrimaryX).Visible = false;

            // setup box and whiskers series
            NBoxAndWhiskersSeries boxSeries = (NBoxAndWhiskersSeries)boxChart.Series.Add(SeriesType.BoxAndWhiskers);

            boxSeries.InflateMargins         = true;
            boxSeries.DataLabelStyle.Visible = false;
            boxSeries.FillStyle    = new NColorFillStyle(DarkOrange);
            boxSeries.OutliersSize = new NLength(3, NGraphicsUnit.Point);

            // create a box and whiskers data point and initialize it from the point series
            NBoxAndWhiskersDataPoint bwdp = new NBoxAndWhiskersDataPoint(point.Values, true, true);

            boxSeries.AddDataPoint(bwdp);

            // synchronize axes
            NAxis axis1 = pointChart.Axis(StandardAxis.PrimaryY);
            NAxis axis2 = boxChart.Axis(StandardAxis.PrimaryY);

            axis1.Slaves.Add(axis2);
            axis2.Slaves.Add(axis1);

            // set an axis stripe for the interquartile range
            double dQ1 = (double)bwdp[DataPointValue.LowerBoxValue];
            double dQ3 = (double)bwdp[DataPointValue.UpperBoxValue];

            NAxisStripe boxStripe = axis1.Stripes.Add(dQ1, dQ3);

            boxStripe.FillStyle = new NColorFillStyle(Color.FromArgb(150, LightGreen));

            // set an axis stripe for the min / max range
            double      dMin           = (double)bwdp[DataPointValue.LowerWhiskerValue];
            double      dMax           = (double)bwdp[DataPointValue.UpperWhiskerValue];
            NAxisStripe whiskersStripe = axis1.Stripes.Add(dMin, dMax);

            whiskersStripe.FillStyle = new NColorFillStyle(Color.FromArgb(70, LightGreen));
        }
Ejemplo n.º 17
0
        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("HTML Image Map with Postback (Server Events) 2");

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

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

            legend.SetPredefinedLegendStyle(PredefinedLegendStyle.Bottom);
            legend.InteractivityStyle.GeneratePostback = true;
            legend.Header.Text = "Company Score";

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

            chart.Height   = 40;
            chart.Enable3D = true;
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);
            chart.Projection.SetPredefinedProjection(PredefinedProjection.OrthogonalHalf);
            chart.BoundsMode = BoundsMode.Fit;
            chart.Location   = new NPointL(
                new NLength(8, NRelativeUnit.ParentPercentage),
                new NLength(15, NRelativeUnit.ParentPercentage));
            chart.Size = new NSizeL(
                new NLength(84, NRelativeUnit.ParentPercentage),
                new NLength(60, NRelativeUnit.ParentPercentage));

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

            chart.Axis(StandardAxis.Depth).InteractivityStyle.GeneratePostback    = true;
            chart.Axis(StandardAxis.PrimaryX).InteractivityStyle.GeneratePostback = true;
            chart.Axis(StandardAxis.PrimaryY).InteractivityStyle.GeneratePostback = true;

            chart.Wall(ChartWallType.Back).InteractivityStyle.GeneratePostback  = true;
            chart.Wall(ChartWallType.Left).InteractivityStyle.GeneratePostback  = true;
            chart.Wall(ChartWallType.Floor).InteractivityStyle.GeneratePostback = true;

            // add an axis stripe
            NAxisStripe stripe = chart.Axis(StandardAxis.PrimaryY).Stripes.Add(20, 33);

            stripe.FillStyle   = new NColorFillStyle(Color.PaleGoldenrod);
            stripe.ShowAtWalls = new ChartWallType[] { ChartWallType.Left, ChartWallType.Back };
            stripe.InteractivityStyle.GeneratePostback = true;

            // setup X axis
            NOrdinalScaleConfigurator ordinalScale = new NOrdinalScaleConfigurator();

            ordinalScale.AutoLabels = false;
            ordinalScale.Labels.Add("Ford");
            ordinalScale.Labels.Add("VW");
            ordinalScale.Labels.Add("Toyota");
            ordinalScale.Labels.Add("BMW");
            ordinalScale.Labels.Add("Peugeot");
            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = ordinalScale;

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

            bar.Name                       = "Fictive Car sales";
            bar.BarShape                   = BarShape.SmoothEdgeBar;
            bar.Legend.Mode                = SeriesLegendMode.DataPoints;
            bar.DataLabelStyle.Visible     = true;
            bar.DataLabelStyle.Format      = "<value>";
            bar.InteractivityStyle.Tooltip = new NTooltipAttribute("<value> <label>");
            bar.AddDataPoint(new NDataPoint(22, "Ford", new NColorFillStyle(Color.DarkKhaki)));
            bar.AddDataPoint(new NDataPoint(32, "VW", new NColorFillStyle(Color.OliveDrab)));
            bar.AddDataPoint(new NDataPoint(45, "Toyota", new NColorFillStyle(Color.DarkSeaGreen)));
            bar.AddDataPoint(new NDataPoint(27, "BMW", new NColorFillStyle(Color.CadetBlue)));
            bar.AddDataPoint(new NDataPoint(40, "Peugeot", new NColorFillStyle(Color.LightSlateGray)));

            for (int i = 0; i < bar.Values.Count; i++)
            {
                NInteractivityStyle interactivityStyle = new NInteractivityStyle();
                interactivityStyle.GeneratePostback = true;
                bar.InteractivityStyles[i]          = interactivityStyle;
            }

            // configure the control to generate image map with postback
            NHtmlImageMapResponse imageMapResponse = new NHtmlImageMapResponse();

            imageMapResponse.GridCellSize = 2;
            nChartControl1.ServerSettings.BrowserResponseSettings.DefaultResponse = imageMapResponse;

            this.nChartControl1.Click += new EventHandler(this.NChartControl1_Click);
        }