private void DataLabelModeCombo_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (nChartControl1 == null)
            {
                return;
            }

            NBarSeries bar = (NBarSeries)nChartControl1.Charts[0].Series[0];

            switch (DataLabelModeCombo.SelectedIndex)
            {
            case 0:
                m_DataLabelStyle = bar.DataLabelStyle;
                break;

            case 1:
                m_DataLabelStyle = (NDataLabelStyle)bar.DataLabelStyles[3];
                break;
            }

            // init controls from data label
            ArrowLengthScroll.Value      = (int)(m_DataLabelStyle.ArrowLength.Value);
            FormatCombo.Text             = m_DataLabelStyle.Format;
            VertAlignCombo.SelectedIndex = (int)m_DataLabelStyle.VertAlign;
        }
        private NPieChart CreatePieChart()
        {
            NPieChart pieChart = new NPieChart();

            NDockLayout.SetDockArea(pieChart, ENDockArea.Center);
            pieChart.Margins = new NMargins(10, 0, 10, 10);

            NPieSeries pieSeries = new NPieSeries();

            pieChart.Series.Add(pieSeries);
            pieChart.DockSpiderLabelsToSides = false;

            NDataLabelStyle dataLabelStyle = new NDataLabelStyle();

            dataLabelStyle.ArrowLength        = 15;
            dataLabelStyle.ArrowPointerLength = 0;
            pieSeries.DataLabelStyle          = dataLabelStyle;

            pieSeries.LabelMode         = ENPieLabelMode.Spider;
            pieSeries.LegendView.Mode   = ENSeriesLegendMode.DataPoints;
            pieSeries.LegendView.Format = "<label> <percent>";

            pieSeries.DataPoints.Add(new NPieDataPoint(24, "Cars"));
            pieSeries.DataPoints.Add(new NPieDataPoint(18, "Airplanes"));
            pieSeries.DataPoints.Add(new NPieDataPoint(32, "Trains"));
            pieSeries.DataPoints.Add(new NPieDataPoint(23, "Ships"));
            pieSeries.DataPoints.Add(new NPieDataPoint(19, "Buses"));

            return(pieChart);
        }
예제 #3
0
        private NLineSeries CreateLineSeries(NColor lightColor, NColor color, int begin, int end)
        {
            // Add a line series
            NLineSeries line = new NLineSeries();

            for (int i = 0; i < 5; i++)
            {
                line.DataPoints.Add(new NLineDataPoint(m_Random.Next(begin, end)));
            }

            line.Stroke = new NStroke(2, color);

            NDataLabelStyle dataLabelStyle = new NDataLabelStyle();

            dataLabelStyle.Format = "<value>";
            dataLabelStyle.TextStyle.Background.Visible = false;
            dataLabelStyle.ArrowStroke.Width            = 0;
            dataLabelStyle.ArrowLength    = 10;
            dataLabelStyle.TextStyle.Font = new NFont("Arial", 8);
            dataLabelStyle.TextStyle.Background.Visible = true;

            line.DataLabelStyle = dataLabelStyle;

            NMarkerStyle markerStyle = new NMarkerStyle();

            markerStyle.Visible = true;
            markerStyle.Border  = new NStroke(color);
            markerStyle.Fill    = new NColorFill(lightColor);
            markerStyle.Shape   = ENPointShape.Ellipse;
            markerStyle.Size    = new NSize(5, 5);

            line.MarkerStyle = markerStyle;

            return(line);
        }
예제 #4
0
        /// <summary>
        /// Creates a new data label style object
        /// </summary>
        /// <returns></returns>
        private NDataLabelStyle CreateDataLabelStyle()
        {
            NDataLabelStyle dataLabelStyle = new NDataLabelStyle();

            dataLabelStyle.Format = "<value>";

            return(dataLabelStyle);
        }
예제 #5
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreatePieChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Doughnut Pie";

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

            m_PieChart.BeginRadiusPercent = 20;
            m_PieChart.LabelLayout.EnableInitialPositioning = false;
            string[] labels = new string[] { "Ships", "Trains", "Automobiles", "Airplanes" };

            Random random = new Random();

            for (int i = 0; i < 4; i++)
            {
                NPieSeries pieSeries = new NPieSeries();

                // create a small detachment between pie rings
                pieSeries.BeginRadiusPercent = 10;

                m_PieChart.Series.Add(pieSeries);
                m_PieChart.DockSpiderLabelsToSides = true;

                NDataLabelStyle dataLabelStyle = new NDataLabelStyle(false);
                dataLabelStyle.ArrowLength         = 0;
                dataLabelStyle.ArrowPointerLength  = 0;
                dataLabelStyle.Format              = "<percent>";
                dataLabelStyle.TextStyle.HorzAlign = ENTextHorzAlign.Center;
                dataLabelStyle.TextStyle.VertAlign = ENTextVertAlign.Center;

                pieSeries.DataLabelStyle = dataLabelStyle;

                if (i == 0)
                {
                    pieSeries.LegendView.Mode   = ENSeriesLegendMode.DataPoints;
                    pieSeries.LegendView.Format = "<label>";
                }
                else
                {
                    pieSeries.LegendView.Mode = ENSeriesLegendMode.None;
                }

                pieSeries.LabelMode = ENPieLabelMode.Center;

                for (int j = 0; j < labels.Length; j++)
                {
                    pieSeries.DataPoints.Add(new NPieDataPoint(20 + random.Next(100), labels[j]));
                }
            }


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

            return(chartView);
        }
예제 #6
0
        /// <summary>
        /// Creates a new data label style object
        /// </summary>
        /// <returns></returns>
        private NDataLabelStyle CreateDataLabelStyle()
        {
            NDataLabelStyle dataLabelStyle = new NDataLabelStyle();

            dataLabelStyle.VertAlign   = ENVerticalAlignment.Center;
            dataLabelStyle.ArrowLength = 0;

            return(dataLabelStyle);
        }
예제 #7
0
        private void SetupDataLabels(NAreaSeries area)
        {
            NDataLabelStyle dataLabel = area.DataLabelStyle;

            dataLabel.ArrowLength = 0;
            dataLabel.VertAlign   = ENVerticalAlignment.Center;
            dataLabel.TextStyle.Background.Padding = new NMargins(5);
            dataLabel.TextStyle.Font = new NFont("Arial", 8, ENFontStyle.Bold);
        }
예제 #8
0
        private void SetupDataLabels(NAreaSeries area)
        {
            NDataLabelStyle dataLabel = area.DataLabelStyle;

            dataLabel.ArrowLength = new NLength(0);
            dataLabel.VertAlign   = VertAlign.Center;
            dataLabel.TextStyle.BackplaneStyle.Shape   = BackplaneShape.Ellipse;
            dataLabel.TextStyle.BackplaneStyle.Inflate = new NSizeL(5, 5);
            dataLabel.TextStyle.FontStyle = new NFontStyle("Arial", new NLength(8, NGraphicsUnit.Point), FontStyle.Bold);
        }
예제 #9
0
        NDataLabelStyle CreateDataLabelStyle(ENVerticalAlignment vertAlign)
        {
            NDataLabelStyle dataLabelStyle = new NDataLabelStyle();

            dataLabelStyle.Visible     = true;
            dataLabelStyle.VertAlign   = ENVerticalAlignment.Top;
            dataLabelStyle.ArrowLength = 20;
            dataLabelStyle.Format      = "<value>";

            return(dataLabelStyle);
        }
예제 #10
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Standard Area";

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

            chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XOrdinalYLinear);

            // setup X axis
            NOrdinalScale scaleX = (NOrdinalScale)chart.Axes[ENCartesianAxis.PrimaryX].Scale;

            scaleX.InflateContentRange           = false;
            scaleX.MajorTickMode                 = ENMajorTickMode.AutoMaxCount;
            scaleX.DisplayDataPointsBetweenTicks = false;
            scaleX.Labels.Visible                = false;

            for (int i = 0; i < monthLetters.Length; i++)
            {
                scaleX.CustomLabels.Add(new NCustomValueLabel(i, monthLetters[i]));
            }

            // add interlaced stripe for Y axis
            NScaleStrip stripStyle = new NScaleStrip(new NColorFill(NColor.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;

            NLinearScale scaleY = (NLinearScale)chart.Axes[ENCartesianAxis.PrimaryY].Scale;

            scaleY.Strips.Add(stripStyle);

            // setup area series
            m_Area      = new NAreaSeries();
            m_Area.Name = "Area Series";

            NDataLabelStyle dataLabelStyle = new NDataLabelStyle();

            dataLabelStyle.Visible = true;
            dataLabelStyle.Format  = "<value>";

            m_Area.DataLabelStyle = dataLabelStyle;

            for (int i = 0; i < monthValues.Length; i++)
            {
                m_Area.DataPoints.Add(new NAreaDataPoint(monthValues[i]));
            }

            chart.Series.Add(m_Area);

            return(chartView);
        }
예제 #11
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "XY Scatter Area";

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

            chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XYLinear);

            // add interlace stripe
            NLinearScale linearScale = (NLinearScale)chart.Axes[ENCartesianAxis.PrimaryY].Scale;
            NScaleStrip  stripStyle  = new NScaleStrip(new NColorFill(NColor.Beige), null, true, 0, 0, 1, 1);

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

            // show the x axis grid lines
            linearScale = (NLinearScale)chart.Axes[ENCartesianAxis.PrimaryX].Scale;

            NScaleGridLines majorGrid = new NScaleGridLines();

            majorGrid.Visible          = true;
            linearScale.MajorGridLines = majorGrid;

            // add the area series
            m_Area      = new NAreaSeries();
            m_Area.Name = "Area Series";

            NDataLabelStyle dataLabelStyle = new NDataLabelStyle();

            dataLabelStyle.Visible           = true;
            dataLabelStyle.ArrowStroke.Width = 0;
            dataLabelStyle.Format            = "<value>";
            m_Area.DataLabelStyle            = dataLabelStyle;

            m_Area.UseXValues = true;

            // add xy values
            m_Area.DataPoints.Add(new NAreaDataPoint(12, 10));
            m_Area.DataPoints.Add(new NAreaDataPoint(25, 23));
            m_Area.DataPoints.Add(new NAreaDataPoint(45, 12));
            m_Area.DataPoints.Add(new NAreaDataPoint(55, 24));
            m_Area.DataPoints.Add(new NAreaDataPoint(61, 16));
            m_Area.DataPoints.Add(new NAreaDataPoint(69, 19));
            m_Area.DataPoints.Add(new NAreaDataPoint(78, 17));

            chart.Series.Add(m_Area);

            return(chartView);
        }
예제 #12
0
        /// <summary>
        /// Creates a new line series
        /// </summary>
        /// <param name="name"></param>
        /// <param name="multiLineMode"></param>
        /// <returns></returns>
        private NLineSeries CreateLineSeries(string name, ENMultiLineMode multiLineMode)
        {
            NLineSeries line = new NLineSeries();

            line.Name          = name;
            line.MultiLineMode = multiLineMode;

            NDataLabelStyle dataLabelStyle = new NDataLabelStyle();

            dataLabelStyle.ArrowLength = 0;
            line.DataLabelStyle        = dataLabelStyle;

            return(line);
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Chart Orientation";

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

            m_Chart.Orientation = ENCartesianChartOrientation.LeftToRight;
            m_Chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XOrdinalYLinear);

            // add interlace stripe
            NLinearScale linearScale = m_Chart.Axes[ENCartesianAxis.PrimaryY].Scale as NLinearScale;
            NScaleStrip  strip       = new NScaleStrip(new NColorFill(ENNamedColor.Beige), null, true, 0, 0, 1, 1);

            strip.Interlaced = true;
            linearScale.Strips.Add(strip);

            // add a bar series
            m_Bar1 = new NBarSeries();
            m_Bar1.MultiBarMode = ENMultiBarMode.Series;
            m_Bar1.Name         = "Bar 1";

            NDataLabelStyle dataLabelStyle = new NDataLabelStyle();

            dataLabelStyle.Format  = "<value>";
            dataLabelStyle.Visible = true;

            m_Bar1.DataLabelStyle = dataLabelStyle;

            m_Bar1.LegendView.Mode = ENSeriesLegendMode.DataPoints;

            m_Chart.Series.Add(m_Bar1);

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

            OnPositiveDataButtonClick(null);

            return(chartView);
        }
예제 #14
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreatePieChartView();

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

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

            m_PieSeries = new NPieSeries();
            m_PieChart.Series.Add(m_PieSeries);
            m_PieChart.DockSpiderLabelsToSides = true;

            NDataLabelStyle dataLabelStyle = new NDataLabelStyle();

            dataLabelStyle.ArrowLength        = 15;
            dataLabelStyle.ArrowPointerLength = 0;
            m_PieSeries.DataLabelStyle        = dataLabelStyle;

            m_PieSeries.LabelMode         = ENPieLabelMode.Spider;
            m_PieSeries.LegendView.Mode   = ENSeriesLegendMode.DataPoints;
            m_PieSeries.LegendView.Format = "<label> <percent>";

            m_PieSeries.DataPoints.Add(CreateDataPoint(24, "Cars"));
            m_PieSeries.DataPoints.Add(CreateDataPoint(18, "Airplanes"));
            m_PieSeries.DataPoints.Add(CreateDataPoint(32, "Trains"));
            m_PieSeries.DataPoints.Add(CreateDataPoint(23, "Ships"));
            m_PieSeries.DataPoints.Add(CreateDataPoint(19, "Buses"));



            // detach airplanes
            m_PieSeries.DataPoints[1].DetachmentPercent = 10;

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

            return(chartView);
        }
예제 #15
0
        private NSeries CreatePolarPointSeries(string name, ENPointShape shape, Random random)
        {
            NPolarPointSeries series = new NPolarPointSeries();

            series.Name           = name;
            series.InflateMargins = false;

            NDataLabelStyle dataLabelStyle = new NDataLabelStyle();

            dataLabelStyle.Visible = false;
            dataLabelStyle.Format  = "<value> - <angle_in_degrees>";
            series.DataLabelStyle  = dataLabelStyle;
            series.Shape           = shape;
            series.Size            = 3.0;

            // add data
            for (int i = 0; i < 1000; i++)
            {
                series.DataPoints.Add(new NPolarPointDataPoint(random.Next(360), random.Next(100)));
            }

            return(series);
        }
        public override void Initialize()
        {
            base.Initialize();

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

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

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

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

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

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

            bar.FillStyle              = new NGradientFillStyle(Color.LightGray, Color.SlateBlue);
            bar.ShadowStyle.Type       = ShadowType.LinearBlur;
            bar.ShadowStyle.Offset     = new NPointL(3, 3);
            bar.ShadowStyle.Color      = Color.FromArgb(40, 0, 0, 0);
            bar.ShadowStyle.FadeLength = new NLength(2);

            bar.AddDataPoint(new NDataPoint(10, "Item 0"));
            bar.AddDataPoint(new NDataPoint(20, "Item 1"));
            bar.AddDataPoint(new NDataPoint(30, "Item 2"));
            bar.AddDataPoint(new NDataPoint(25, "Item 3"));
            bar.AddDataPoint(new NDataPoint(29, "Item 4"));
            bar.AddDataPoint(new NDataPoint(27, "Item 5"));

            // apply style sheet
            NFillStyleSheetConfigurator fillStyleSheet = new NFillStyleSheetConfigurator();

            fillStyleSheet.SeriesFillTemplate = new NGradientFillStyleTemplate(GradientStyle.Horizontal, GradientVariant.Variant1);
            fillStyleSheet.MultiColorSeries   = true;
            fillStyleSheet.Palette.SetPredefinedPalette(ChartPredefinedPalette.Nature);
            NStrokeStyleSheetConfigurator strokeStyleSheet = new NStrokeStyleSheetConfigurator();

            strokeStyleSheet.MultiColorSeries  = true;
            strokeStyleSheet.ApplyToDataLabels = false;
            strokeStyleSheet.Palette.SetPredefinedPalette(ChartPredefinedPalette.Nature);

            NStyleSheet styleSheet = new NStyleSheet();

            fillStyleSheet.ConfigureSheet(styleSheet);
            strokeStyleSheet.ConfigureSheet(styleSheet);
            styleSheet.Apply(bar);

            // add a different data label for data point 3
            NDataLabelStyle label = new NDataLabelStyle();

            label.Format = "Individual";
            label.TextStyle.FontStyle.Style          = FontStyle.Bold;
            label.TextStyle.FillStyle                = new NColorFillStyle(Color.Crimson);
            label.TextStyle.BackplaneStyle.Inflate   = new NSizeL(3, 3);
            label.TextStyle.BackplaneStyle.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant2, Color.White, Color.Lavender);
            bar.DataLabelStyles[3] = label;

            // init form controls
            FormatCombo.Items.Add("<value> <label>");
            FormatCombo.Items.Add("<index> <cumulative>");
            FormatCombo.Items.Add("<percent> <total>");

            VertAlignCombo.Items.Add("Center");
            VertAlignCombo.Items.Add("Top");
            VertAlignCombo.Items.Add("Bottom");

            DataLabelModeCombo.Items.Add("Edit Default Label");
            DataLabelModeCombo.Items.Add("Edit Data Label #3");
            DataLabelModeCombo.SelectedIndex = 0;

            // apply layout
            ConfigureStandardLayout(chart, title, null);
        }
예제 #17
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Chart Aspect";

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

            chart.FitMode = ENCartesianChartFitMode.Aspect;

            // Add a x linear axis
            NCartesianAxis primaryXAxis = new NCartesianAxis();

            primaryXAxis.Anchor = new NDockCartesianAxisAnchor(ENCartesianAxisDockZone.Bottom);
            NLinearScale primaryXScale = new NLinearScale();

            primaryXScale.Title.Text = "X Scale Title";
            primaryXScale.Labels.Style.AlwaysInsideScale = true;
            primaryXScale.Labels.Style.Angle             = new NScaleLabelAngle(ENScaleLabelAngleMode.View, 90, false);
            primaryXAxis.Scale = primaryXScale;
            chart.Axes.Add(primaryXAxis);

            // Add a y linear axis
            NCartesianAxis primaryYAxis = new NCartesianAxis();

            primaryYAxis.Anchor = new NDockCartesianAxisAnchor(ENCartesianAxisDockZone.Left);
            NLinearScale primaryYScale = new NLinearScale();

            primaryYScale.Title.Text  = "Y Scale Title";
            primaryYScale.Title.Angle = new NScaleLabelAngle(ENScaleLabelAngleMode.Scale, 0);
            primaryYScale.Labels.Style.AlwaysInsideScale = true;

            primaryYAxis.Scale = primaryYScale;
            chart.Axes.Add(primaryYAxis);

            // Create the x / y crossed axes
            NCartesianAxis secondaryXAxis  = new NCartesianAxis();
            NLinearScale   secondaryXScale = new NLinearScale();

            secondaryXScale.Labels.Visible = false;
            secondaryXAxis.Scale           = secondaryXScale;
            chart.Axes.Add(secondaryXAxis);

            NCartesianAxis secondaryYAxis  = new NCartesianAxis();
            NLinearScale   secondaryYScale = new NLinearScale();

            secondaryYScale.Labels.Visible = false;
            secondaryYAxis.Scale           = secondaryYScale;
            chart.Axes.Add(secondaryYAxis);

            // cross them
            secondaryXAxis.Anchor = new NValueCrossCartesianAxisAnchor(0, secondaryYAxis, ENCartesianAxisOrientation.Horizontal, ENScaleOrientation.Right, 0, 100);
            secondaryYAxis.Anchor = new NValueCrossCartesianAxisAnchor(0, secondaryXAxis, ENCartesianAxisOrientation.Vertical, ENScaleOrientation.Right, 0, 100);

            // add some dummy data
            NPointSeries point = new NPointSeries();

            chart.Series.Add(point);

            NDataLabelStyle dataLabelStyle = new NDataLabelStyle();

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

            point.UseXValues = true;
            point.Size       = 2;

            // add some random data in the range [-100, 100]
            Random rand = new Random();

            for (int i = 0; i < 3000; i++)
            {
                double x = rand.Next(190) - 95;
                double y = rand.Next(190) - 95;
                point.DataPoints.Add(new NPointDataPoint(x, y));
            }

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

            return(chartView);
        }
예제 #18
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Linear Scale";

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

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

            // configure the y axis
            NLinearScale linearScale = (NLinearScale)m_Chart.Axes[ENCartesianAxis.PrimaryY].Scale;

            NScaleGridLines majorGrid = new NScaleGridLines();

            majorGrid.Stroke           = new NStroke(1, NColor.DarkGray, ENDashStyle.Dot);
            linearScale.MajorGridLines = majorGrid;

            // add a strip line style
            NScaleStrip strip = new NScaleStrip();

            strip.Fill       = new NColorFill(NColor.Beige);
            strip.Interlaced = true;
            linearScale.Strips.Add(strip);

            NLineSeries line = new NLineSeries();

            m_Chart.Series.Add(line);

            Random random = new Random();

            for (int i = 0; i < 7; i++)
            {
                line.DataPoints.Add(new NLineDataPoint(random.Next(-100, 100)));
            }

            line.LegendView.Mode = ENSeriesLegendMode.None;
            line.InflateMargins  = true;

            // assign marker
            NMarkerStyle markerStyle = new NMarkerStyle();

            markerStyle.Visible = true;
            markerStyle.Shape   = ENPointShape.Ellipse;
            markerStyle.Size    = new NSize(6, 6);

            line.MarkerStyle = markerStyle;

            // assign data label style
            NDataLabelStyle dataLabelStyle = new NDataLabelStyle();

            dataLabelStyle.Format            = "<value>";
            dataLabelStyle.ArrowStroke.Color = NColor.CornflowerBlue;

            line.DataLabelStyle = dataLabelStyle;

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

            return(chartView);
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Logarithmic Scale";

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

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

            NLogarithmicScale logarithmicScale = new NLogarithmicScale();

            logarithmicScale.MinorGridLines.Stroke.DashStyle = ENDashStyle.Dot;
            logarithmicScale.MinorTickCount = 3;
            logarithmicScale.MajorTickMode  = ENMajorTickMode.CustomStep;

            // add interlaced stripe
            NScaleStrip strip = new NScaleStrip();

            strip.Fill       = new NColorFill(NColor.Beige);
            strip.Interlaced = true;
            logarithmicScale.Strips.Add(strip);

            logarithmicScale.CustomStep = 1;

            m_Chart.Axes[ENCartesianAxis.PrimaryY].Scale = logarithmicScale;

            NLineSeries line = new NLineSeries();

            m_Chart.Series.Add(line);

            line.LegendView.Mode = ENSeriesLegendMode.None;
            line.InflateMargins  = false;

            NMarkerStyle markerStyle = new NMarkerStyle();

            line.MarkerStyle = markerStyle;

            markerStyle.Shape = ENPointShape.Ellipse;
            markerStyle.Size  = new NSize(15, 15);

            NDataLabelStyle dataLabelStyle = new NDataLabelStyle();

            dataLabelStyle.Visible = true;
            dataLabelStyle.Format  = "<value>";
            line.DataLabelStyle    = dataLabelStyle;

            line.DataPoints.Add(new NLineDataPoint(12));
            line.DataPoints.Add(new NLineDataPoint(100));
            line.DataPoints.Add(new NLineDataPoint(250));
            line.DataPoints.Add(new NLineDataPoint(500));
            line.DataPoints.Add(new NLineDataPoint(1500));
            line.DataPoints.Add(new NLineDataPoint(5500));
            line.DataPoints.Add(new NLineDataPoint(9090));

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

            return(chartView);
        }
예제 #20
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

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

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

            chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XYLinear);

            // 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_XReferenceLine        = new NAxisReferenceLine();
            m_XReferenceLine.Stroke = new NStroke(1, NColor.SteelBlue);
            m_XReferenceLine.Value  = 40;
            m_XReferenceLine.Text   = "X Reference Line";
            chart.Axes[ENCartesianAxis.PrimaryX].ReferenceLines.Add(m_XReferenceLine);

            // Add a constline for the bottom axis
            m_YReferenceLine        = new NAxisReferenceLine();
            m_YReferenceLine.Stroke = new NStroke(1, NColor.SteelBlue);
            m_YReferenceLine.Value  = 60;
            m_YReferenceLine.Text   = "Y Reference Line";
            chart.Axes[ENCartesianAxis.PrimaryY].ReferenceLines.Add(m_YReferenceLine);

            // apply style sheet
            chartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, false));

            return(chartView);
        }
예제 #21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DefaultFormatDropDown.Items.Add("[value] [label]");
                DefaultFormatDropDown.Items.Add("[index] [cumulative]");
                DefaultFormatDropDown.Items.Add("[percent] [total]");
                DefaultFormatDropDown.SelectedIndex = 0;

                DefaultVerticalAlignDropDown.Items.Add("Center");
                DefaultVerticalAlignDropDown.Items.Add("Top");
                DefaultVerticalAlignDropDown.Items.Add("Bottom");
                DefaultVerticalAlignDropDown.SelectedIndex = 1;

                DefaultLabelVisibleCheck.Checked     = true;
                DefaultBackplaneVisibleCheck.Checked = true;

                Label3FormatDropDown.Items.Add("Individual");
                Label3FormatDropDown.Items.Add("[value] [label]");
                Label3FormatDropDown.Items.Add("[index] [cumulative]");
                Label3FormatDropDown.Items.Add("[percent] [total]");
                Label3FormatDropDown.SelectedIndex = 0;

                Label3VerticalAlignDropDown.Items.Add("Center");
                Label3VerticalAlignDropDown.Items.Add("Top");
                Label3VerticalAlignDropDown.Items.Add("Bottom");
                Label3VerticalAlignDropDown.SelectedIndex = 1;

                Label3VisibleCheck.Checked     = true;
                Backplane3VisibleCheck.Checked = true;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;
            nChartControl1.Legends[0].Visible = false;

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

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

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

            bar.AddDataPoint(new NDataPoint(10, "Item A"));
            bar.AddDataPoint(new NDataPoint(20, "Item B"));
            bar.AddDataPoint(new NDataPoint(30, "Item C"));
            bar.AddDataPoint(new NDataPoint(25, "Item D"));
            bar.AddDataPoint(new NDataPoint(29, "Item E"));

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

            // apply style sheet
            NFillStyleSheetConfigurator fillStyleSheet = new NFillStyleSheetConfigurator();

            fillStyleSheet.SeriesFillTemplate = new NGradientFillStyleTemplate(GradientStyle.Horizontal, GradientVariant.Variant1);
            fillStyleSheet.MultiColorSeries   = true;
            fillStyleSheet.Palette.SetPredefinedPalette(ChartPredefinedPalette.Nature);
            NStrokeStyleSheetConfigurator strokeStyleSheet = new NStrokeStyleSheetConfigurator();

            strokeStyleSheet.MultiColorSeries  = true;
            strokeStyleSheet.ApplyToDataLabels = false;
            strokeStyleSheet.Palette.SetPredefinedPalette(ChartPredefinedPalette.Nature);

            NStyleSheet styleSheet = new NStyleSheet();

            fillStyleSheet.ConfigureSheet(styleSheet);
            strokeStyleSheet.ConfigureSheet(styleSheet);
            styleSheet.Apply(bar);

            // add a different data label for data point 3
            NDataLabelStyle label = new NDataLabelStyle();

            label.TextStyle.FontStyle.Style          = FontStyle.Bold;
            label.TextStyle.FillStyle                = new NColorFillStyle(Color.Crimson);
            label.TextStyle.BackplaneStyle.Inflate   = new NSizeL(3, 3);
            label.TextStyle.BackplaneStyle.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant2, Color.White, Color.Lavender);
            bar.DataLabelStyles[3] = label;

            label.Format    = WebExamplesUtilities.GetXmlFormatString(Label3FormatDropDown.SelectedItem.Text);
            label.VertAlign = (VertAlign)Label3VerticalAlignDropDown.SelectedIndex;
            label.Visible   = Label3VisibleCheck.Checked;
            label.TextStyle.BackplaneStyle.Visible = Backplane3VisibleCheck.Checked;

            bar.DataLabelStyle.Format    = WebExamplesUtilities.GetXmlFormatString(DefaultFormatDropDown.SelectedItem.Text);
            bar.DataLabelStyle.VertAlign = (VertAlign)DefaultVerticalAlignDropDown.SelectedIndex;
            bar.DataLabelStyle.Visible   = DefaultLabelVisibleCheck.Checked;
            bar.DataLabelStyle.TextStyle.BackplaneStyle.Visible = DefaultBackplaneVisibleCheck.Checked;

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, null);
        }
예제 #22
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Bar Labels";

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

            m_Chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XOrdinalYLinear);

            // configure Y axis
            NLinearScale scaleY = new NLinearScale();

            scaleY.MajorGridLines.Stroke.DashStyle       = ENDashStyle.Dash;
            m_Chart.Axes[ENCartesianAxis.PrimaryY].Scale = scaleY;

            // add interlaced stripe for Y axis
            NScaleStrip stripStyle = new NScaleStrip(new NColorFill(NColor.Beige), null, true, 0, 0, 1, 1);

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

            // bar series
            m_Bar = new NBarSeries();
            m_Bar.ValueFormatter = new NNumericValueFormatter("0.000");
            m_Chart.Series.Add(m_Bar);

            m_Bar.Fill = new NColorFill(NColor.DarkOrange);

            NDataLabelStyle dataLabelStyle = new NDataLabelStyle();

            dataLabelStyle.Visible     = true;
            dataLabelStyle.VertAlign   = ENVerticalAlignment.Top;
            dataLabelStyle.ArrowLength = 20;
            dataLabelStyle.Format      = "<value>";

            m_Bar.DataLabelStyle = dataLabelStyle;

            // enable initial labels positioning
            m_Chart.LabelLayout.EnableInitialPositioning = true;

            // enable label adjustment
            m_Chart.LabelLayout.EnableLabelAdjustment = true;

            // use only "top" location for the labels
            m_Bar.LabelLayout.UseLabelLocations        = true;
            m_Bar.LabelLayout.LabelLocations           = new NDomArray <ENLabelLocation>(new ENLabelLocation[] { ENLabelLocation.Top });
            m_Bar.LabelLayout.OutOfBoundsLocationMode  = ENOutOfBoundsLocationMode.PushWithinBounds;
            m_Bar.LabelLayout.InvertLocationsIfIgnored = true;

            // protect data points from being overlapped
            m_Bar.LabelLayout.EnableDataPointSafeguard = true;
            m_Bar.LabelLayout.DataPointSafeguardSize   = new NSize(2, 2);

            // fill with random data
            OnGenerateDataButtonClick(null);

            return(chartView);
        }
예제 #23
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Area Labels";

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

            m_Chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XYLinear);

            // add interlaced stripe for Y axis
            NScaleStrip stripStyle = new NScaleStrip(new NColorFill(NColor.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;

            NLinearScale scaleY = (NLinearScale)m_Chart.Axes[ENCartesianAxis.PrimaryY].Scale;

            scaleY.Strips.Add(stripStyle);

            scaleY.MajorGridLines.Visible = true;

            m_Area = new NAreaSeries();
            m_Chart.Series.Add(m_Area);

            // setup area series
            m_Area.InflateMargins = true;
            m_Area.UseXValues     = true;
            m_Area.ValueFormatter = new NNumericValueFormatter("0.000");

            m_Area.Fill   = new NColorFill(NColor.DarkOrange);
            m_Area.Stroke = new NStroke(NColor.Black);

            NDataLabelStyle dataLabelStyle = new NDataLabelStyle();

            dataLabelStyle.Visible     = true;
            dataLabelStyle.VertAlign   = ENVerticalAlignment.Top;
            dataLabelStyle.ArrowLength = 20;
            dataLabelStyle.ArrowStroke = new NStroke(NColor.Black);
            dataLabelStyle.Format      = "<value>";
            dataLabelStyle.TextStyle.Background.Visible = true;
            dataLabelStyle.TextStyle.Background.Padding = new NMargins(0);

            m_Area.DataLabelStyle = dataLabelStyle;

            // disable initial label positioning
            m_Chart.LabelLayout.EnableInitialPositioning = false;

            // enable label adjustment
            m_Chart.LabelLayout.EnableLabelAdjustment = true;

            // enable the data point safesuard and set its size
            m_Area.LabelLayout.EnableDataPointSafeguard = true;
            m_Area.LabelLayout.DataPointSafeguardSize   = new NSize(2, 2);

            // fill with random data
            OnGenerateDataButtonClick(null);

            return(chartView);
        }
예제 #24
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Line Labels";

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

            m_Chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XOrdinalYLinear);

            // configure Y axis
            NLinearScale scaleY = (NLinearScale)m_Chart.Axes[ENCartesianAxis.PrimaryY].Scale;

            scaleY.MajorGridLines.Stroke.DashStyle = ENDashStyle.Dot;

            // add interlaced stripe for Y axis
            NScaleStrip strip = new NScaleStrip(new NColorFill(NColor.Beige), null, true, 0, 0, 1, 1);

            strip.Interlaced = true;
            scaleY.Strips.Add(strip);

            // line series
            m_Line = new NLineSeries();
            m_Chart.Series.Add(m_Line);

            m_Line.InflateMargins = true;

            NMarkerStyle markerStyle = new NMarkerStyle();

            markerStyle.Visible   = true;
            markerStyle.Fill      = new NColorFill(NColor.DarkOrange);
            markerStyle.Shape     = ENPointShape.Ellipse;
            markerStyle.Size      = new NSize(2, 2);
            m_Line.MarkerStyle    = markerStyle;
            m_Line.ValueFormatter = new NNumericValueFormatter("0.000");

            NDataLabelStyle dataLabelStyle = new NDataLabelStyle();

            dataLabelStyle.Visible     = true;
            dataLabelStyle.VertAlign   = ENVerticalAlignment.Top;
            dataLabelStyle.ArrowLength = 10;
            dataLabelStyle.ArrowStroke = new NStroke(NColor.DarkOrange);
            dataLabelStyle.TextStyle.Background.Border = new NStroke(NColor.DarkOrange);
            dataLabelStyle.Format = "<value>";

            m_Chart.LabelLayout.EnableInitialPositioning = true;
            m_Chart.LabelLayout.EnableLabelAdjustment    = true;

            m_Line.LabelLayout.EnableDataPointSafeguard = true;
            m_Line.LabelLayout.DataPointSafeguardSize   = new NSize(2, 2);
            m_Line.LabelLayout.UseLabelLocations        = true;
            m_Line.LabelLayout.OutOfBoundsLocationMode  = ENOutOfBoundsLocationMode.PushWithinBounds;
            m_Line.LabelLayout.InvertLocationsIfIgnored = true;

            // fill with random data
            OnGenerateDataButtonClick(null);

            return(chartView);
        }
예제 #25
0
        // Draw Flaws on Map
        public void DrawPieceFlaw(int pieceNum, bool drawFlag)
        {
            List<FlawInfoAddPriority> flawPiece = MapWindowVariable.FlawPieces[pieceNum];

            nChartMap.Series.Clear();
            SubPieceMarkup(pieceNum);

            if (flawPiece.Count > 0)
            {
                bool skipFlag = false;
                foreach (FlawInfoAddPriority f in flawPiece)
                {
                    skipFlag = false;
                    NPointSeries point = (NPointSeries)nChartMap.Series.Add(SeriesType.Point);
                    point.Name = f.FlawID.ToString();
                    point.Labels.Add(f.FlawID);
                    point.Size = new NLength(3, NRelativeUnit.ParentPercentage);
                    point.BorderStyle.Width = new NLength(0, NGraphicsUnit.Millimeter);
                    NDataLabelStyle dataLabel = new NDataLabelStyle();
                    dataLabel.Format = f.FlawID.ToString();
                    dataLabel.TextStyle.StringFormatStyle.HorzAlign = Nevron.HorzAlign.Center;
                    point.DataLabelStyle = dataLabel;
                    point.DataLabelStyle.Visible = false;

                    foreach (DataGridViewRow row in gvFlawClass.Rows)
                    {
                        DataGridViewCheckBoxCell col = (DataGridViewCheckBoxCell)row.Cells[2];
                        if (f.FlawType == Convert.ToInt32(row.Cells["FlawType"].Value))
                        {
                            if (!Convert.ToBoolean(row.Cells["Display"].EditedFormattedValue))
                            {
                                skipFlag = true;
                                break;
                            }

                            point.FillStyle = new NColorFillStyle(System.Drawing.ColorTranslator.FromHtml(row.Cells["Color"].Value.ToString()));
                            switch (row.Cells["Shape"].Value.ToString())
                            {
                                case "▲":
                                    point.PointShape = PointShape.DiagonalCross;
                                    break;
                                case "▼":
                                    point.PointShape = PointShape.InvertedCone;
                                    break;
                                case "■":
                                    point.PointShape = PointShape.Bar;
                                    break;
                                case "●":
                                    point.PointShape = PointShape.Sphere;
                                    break;
                                case "+":
                                    point.PointShape = PointShape.Cross;
                                    break;
                                case "╳":
                                    point.PointShape = PointShape.DiagonalCross;
                                    break;
                                case "★":
                                    point.PointShape = PointShape.Star;
                                    break;
                                default:
                                    break;
                            }
                        }
                    }

                    if (skipFlag) continue;

                    point.Tag = f.FlawType;
                    point.UseXValues = true;

                    // When BottomAxe equals zero, bottom axis is CD otherwise is RMD
                    if (MapWindowVariable.BottomAxe == 0)
                        point.AddDataPoint(new NDataPoint(f.CD, f.RMD));
                    else
                        point.AddDataPoint(new NDataPoint(f.RMD, f.CD));
                }
            }

            if (drawFlag)
            {
                MapWindowVariable.CurrentPiece = MapWindowVariable.FlawPieces.Count;
                lbPageCurrent.Text = MapWindowVariable.FlawPieces.Count.ToString();
                lbPageTotal.Text = lbPageCurrent.Text;

                if (MapWindowVariable.FlawPieces.Count > 1)
                {
                    btnPrevPiece.Enabled = true;
                }
                btnNextPiece.Enabled = false;
            }

            Color red = Color.FromArgb(255, 150, 150);
            NGradientFillStyle WallFail = new NGradientFillStyle(red, red);
            NGradientFillStyle WallPass = new NGradientFillStyle(Color.White, Color.White);

            if (MapWindowVariable.PieceResult[MapWindowVariable.CurrentPiece - 1])
                nChartMap.Wall(ChartWallType.Back).FillStyle = WallPass;
            else
                nChartMap.Wall(ChartWallType.Back).FillStyle = WallFail;

            nChart.Refresh();
        }