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);
        }
 private void SetupTapeMarkers(NMarkerStyle marker)
 {
     marker.PointShape = PointShape.Cylinder;
     marker.AutoDepth  = true;
     marker.Width      = new NLength(1.2f, NRelativeUnit.ParentPercentage);
     marker.Height     = new NLength(1.2f, NRelativeUnit.ParentPercentage);
 }
        private void GenerateData(NStockSeries stock)
        {
            GenerateOHLCData(stock, 200);

            DateTime dt = new DateTime(2006, 5, 15);

            for (int i = 0; i < 200; i++)
            {
                stock.XValues.Add(dt.ToOADate());

                dt += new TimeSpan(1, 0, 0, 0);
            }

            NMarkerStyle ms1 = new NMarkerStyle();

            ms1.Visible            = true;
            ms1.PointShape         = PointShape.Ellipse;
            ms1.FillStyle          = new NColorFillStyle(Color.Red);
            ms1.Width              = new NLength(0.4f, NRelativeUnit.ParentPercentage);;
            ms1.Height             = new NLength(0.4f, NRelativeUnit.ParentPercentage);;
            ms1.VertAlign          = VertAlign.Bottom;
            stock.MarkerStyles[20] = ms1;

            NMarkerStyle ms2 = new NMarkerStyle();

            ms2.Visible            = true;
            ms2.PointShape         = PointShape.Ellipse;
            ms2.FillStyle          = new NColorFillStyle(Color.Red);
            ms2.Width              = new NLength(0.4f, NRelativeUnit.ParentPercentage);;
            ms2.Height             = new NLength(0.4f, NRelativeUnit.ParentPercentage);;
            ms2.VertAlign          = VertAlign.Top;
            stock.MarkerStyles[80] = ms2;
        }
Exemple #4
0
        public override void Initialize()
        {
            base.Initialize();

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

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

            chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1);
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);
            chart.Enable3D = true;

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

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

            m_Line = (NLineSeries)chart.Series.Add(SeriesType.Line);
            m_Line.LineSegmentShape = LineSegmentShape.Tape;
            m_Line.InflateMargins   = true;
            m_Line.DepthPercent     = 50;
            m_Line.Legend.Mode      = SeriesLegendMode.DataPoints;
            m_Line.Name             = "Line Series";
            m_Line.Values.FillRandom(Random, 6);
            m_Line.DataLabelStyle.Visible = false;
            m_Line.ShadowStyle.Type       = ShadowType.GaussianBlur;
            m_Line.ShadowStyle.Offset     = new NPointL(2, 2);
            m_Line.ShadowStyle.Color      = Color.FromArgb(88, 0, 0, 0);
            m_Line.ShadowStyle.FadeLength = new NLength(5);
            m_Line.MarkerStyle.Visible    = true;

            NMarkerStyle marker = new NMarkerStyle();

            marker.FillStyle       = new NColorFillStyle(Color.Red);
            marker.PointShape      = PointShape.Cylinder;
            marker.Visible         = true;
            m_Line.MarkerStyles[3] = marker;

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

            StyleCombo.FillFromEnum(typeof(PointShape));

            SelectMarkerCombo.Items.Add("Edit Default Marker");
            SelectMarkerCombo.Items.Add("Edit Marker #3");
            SelectMarkerCombo.SelectedIndex = 0;

            VisibleCheck.Checked = true;
        }
 private void SetupTubeMarkers(NMarkerStyle marker)
 {
     marker.PointShape = PointShape.Sphere;
     marker.AutoDepth  = false;
     marker.Width      = new NLength(3.5f, NRelativeUnit.ParentPercentage);
     marker.Height     = new NLength(3.5f, NRelativeUnit.ParentPercentage);
     marker.Depth      = new NLength(3.5f, NRelativeUnit.ParentPercentage);
 }
        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("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.BoundsMode = BoundsMode.Stretch;

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

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

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

            line.LineSegmentShape = LineSegmentShape.Tape;
            line.InflateMargins   = true;
            line.DepthPercent     = 50;
            line.Legend.Mode      = SeriesLegendMode.DataPoints;
            line.Name             = "Line Series";
            line.Values.FillRandom(Random, 6);
            line.DataLabelStyle.Visible = false;
            line.ShadowStyle.Type       = ShadowType.GaussianBlur;
            line.ShadowStyle.Offset     = new NPointL(2, 2);
            line.ShadowStyle.Color      = Color.FromArgb(88, 0, 0, 0);
            line.ShadowStyle.FadeLength = new NLength(5);
            line.MarkerStyle.Visible    = true;

            NMarkerStyle marker = new NMarkerStyle();

            marker.FillStyle  = new NColorFillStyle(Color.Red);
            marker.PointShape = PointShape.Custom;

            // Create a custom shape for this marker
            N2DSmartShapeFactory factory = new N2DSmartShapeFactory(new NColorFillStyle(Color.Red), new NStrokeStyle(1.0f, Color.Black), null);

            marker.CustomShape   = factory.CreateShape(SmartShape2D.Trapezoid);
            marker.Visible       = true;
            line.MarkerStyles[3] = marker;

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

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

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

            chart.BoundsMode = BoundsMode.Stretch;

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

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

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

            line.LineSegmentShape = LineSegmentShape.Tape;
            line.InflateMargins   = true;
            line.DepthPercent     = 50;
            line.Legend.Mode      = SeriesLegendMode.DataPoints;
            line.Name             = "Line Series";
            line.Values.FillRandom(Random, 6);
            line.DataLabelStyle.Visible = false;
            line.ShadowStyle.Type       = ShadowType.GaussianBlur;
            line.ShadowStyle.Offset     = new NPointL(2, 2);
            line.ShadowStyle.Color      = Color.FromArgb(88, 0, 0, 0);
            line.ShadowStyle.FadeLength = new NLength(5);
            line.MarkerStyle.Visible    = true;

            NMarkerStyle marker = new NMarkerStyle();

            marker.FillStyle  = new NColorFillStyle(Color.Red);
            marker.PointShape = PointShape.Custom;

            // Create a custom shape for this marker
            N2DSmartShapeFactory factory = new N2DSmartShapeFactory(new NColorFillStyle(Color.Red), new NStrokeStyle(1.0f, Color.Black), null);

            marker.CustomShape   = factory.CreateShape(SmartShape2D.Trapezoid);
            marker.Visible       = true;
            line.MarkerStyles[3] = marker;

            // apply layout
            ConfigureStandardLayout(chart, title, nChartControl1.Legends[0]);
        }
        private NLineSeries NewPointSeries(NChart chart, Color color)
        {
            NLineSeries line = (NLineSeries)chart.Series.Add(SeriesType.Line);

            line.Name                   = "Line Series";
            line.BorderStyle            = new NStrokeStyle(color);
            line.DataLabelStyle.Visible = false;
            NMarkerStyle marker = new NMarkerStyle();

            marker.PointShape = PointShape.Ellipse;
            marker.Visible    = true;
            marker.FillStyle  = new NColorFillStyle(color);
            line.MarkerStyle  = marker;

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

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

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

            chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XYLinear);

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

            stripStyle.Interlaced = true;
            chart.Axes[ENCartesianAxis.PrimaryY].Scale.Strips.Add(stripStyle);

            m_Line = new NLineSeries();
            chart.Series.Add(m_Line);

            m_Line.DataLabelStyle = new NDataLabelStyle(false);
            m_Line.InflateMargins = true;

            NMarkerStyle markerStyle = new NMarkerStyle();

            m_Line.MarkerStyle = markerStyle;

            markerStyle.Visible = true;
            markerStyle.Shape   = ENPointShape.Ellipse;
            markerStyle.Size    = new NSize(10, 10);
            markerStyle.Fill    = new NColorFill(ENNamedColor.Red);

            m_Line.Name       = "Line Series";
            m_Line.UseXValues = true;

            // add xy values
            m_Line.DataPoints.Add(new NLineDataPoint(15, 10));
            m_Line.DataPoints.Add(new NLineDataPoint(25, 23));
            m_Line.DataPoints.Add(new NLineDataPoint(45, 12));
            m_Line.DataPoints.Add(new NLineDataPoint(55, 21));
            m_Line.DataPoints.Add(new NLineDataPoint(61, 16));
            m_Line.DataPoints.Add(new NLineDataPoint(67, 19));
            m_Line.DataPoints.Add(new NLineDataPoint(72, 11));

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

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

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

            // add interlaced stripe to the Y axis
            NLinearScale yScale     = (NLinearScale)m_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);

            // Add a line series (data will be generated with example controls)
            NLineSeries line = new NLineSeries();

            m_Chart.Series.Add(line);

            line.UseXValues = true;

            line.DataLabelStyle = new NDataLabelStyle(false);
            line.InflateMargins = true;

            NMarkerStyle markerStyle = new NMarkerStyle();

            markerStyle.Visible = true;
            line.MarkerStyle    = markerStyle;

            // create a date time scale
            m_DateTimeScale = (NDateTimeScale)m_Chart.Axes[ENCartesianAxis.PrimaryX].Scale;

            m_DateTimeScale.Labels.Style.Angle            = new NScaleLabelAngle(ENScaleLabelAngleMode.Scale, 90);
            m_DateTimeScale.Labels.Style.ContentAlignment = ENContentAlignment.TopCenter;

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

            return(chartView);
        }
Exemple #11
0
        private void SelectMarkerCombo_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            switch (SelectMarkerCombo.SelectedIndex)
            {
            case 0:
                m_MarkerStyle = m_Line.MarkerStyle;
                break;

            case 1:
                m_MarkerStyle = (NMarkerStyle)m_Line.MarkerStyles[3];
                break;
            }

            VisibleCheck.Checked     = m_MarkerStyle.Visible;
            WidthScroll.Value        = (int)(m_MarkerStyle.Width.Value * 20);
            HeightScroll.Value       = (int)(m_MarkerStyle.Height.Value * 20);
            DepthScroll.Value        = (int)(m_MarkerStyle.Depth.Value * 10);
            AutoDepth.Checked        = m_MarkerStyle.AutoDepth;
            StyleCombo.SelectedIndex = (int)m_MarkerStyle.PointShape;
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

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

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

            m_Chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XOrdinalYLinear);

            // Setup the primary Y axis
            m_Chart.Axes[ENCartesianAxis.PrimaryY].Scale.Title.Text = "Number of Occurences";

            // add interlace stripe
            NScaleStrip strip = new NScaleStrip(new NColorFill(NColor.Beige), null, true, 0, 0, 1, 1);

            strip.Interlaced = true;
            m_Chart.Axes[ENCartesianAxis.PrimaryY].Scale.Strips.Add(strip);

            // Setup the secondary Y axis
            NLinearScale scaleY2 = new NLinearScale();

            scaleY2.Labels.TextProvider = new NFormattedScaleLabelTextProvider(new NNumericValueFormatter("0%"));
            scaleY2.Title.Text          = "Cumulative Percent";

            NCartesianAxis axisY2 = new NCartesianAxis();

            m_Chart.Axes.Add(axisY2);

            axisY2.Anchor            = new NDockCartesianAxisAnchor(ENCartesianAxisDockZone.Right);
            axisY2.Visible           = true;
            axisY2.Scale             = scaleY2;
            axisY2.ViewRangeMode     = ENAxisViewRangeMode.FixedRange;
            axisY2.MinViewRangeValue = 0;
            axisY2.MaxViewRangeValue = 1;

            // add the bar series
            NBarSeries bar = new NBarSeries();

            m_Chart.Series.Add(bar);
            bar.Name           = "Bar Series";
            bar.DataLabelStyle = new NDataLabelStyle(false);

            // add the line series
            NLineSeries line = new NLineSeries();

            m_Chart.Series.Add(line);
            line.Name           = "Cumulative %";
            line.DataLabelStyle = new NDataLabelStyle(false);

            NMarkerStyle markerStyle = new NMarkerStyle();

            markerStyle.Visible = true;
            markerStyle.Shape   = ENPointShape.Ellipse;
            markerStyle.Size    = new NSize(10, 10);
            markerStyle.Fill    = new NColorFill(NColor.Orange);

            line.MarkerStyle = markerStyle;

            line.VerticalAxis = axisY2;

            // fill with random data and sort in descending order
            int            count        = 10;
            NList <double> randomValues = new NList <double>();
            Random         random       = new Random();

            for (int i = 0; i < count; i++)
            {
                randomValues.Add(random.Next(100, 700));
            }

            randomValues.Sort();

            for (int i = 0; i < randomValues.Count; i++)
            {
                bar.DataPoints.Add(new NBarDataPoint(randomValues[i]));
            }

            // calculate cumulative sum of the bar values
            double cs = 0;

            double[] arrCumulative = new double[count];

            for (int i = 0; i < count; i++)
            {
                cs += randomValues[i];
                arrCumulative[i] = cs;
            }

            if (cs > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    arrCumulative[i] /= cs;
                    line.DataPoints.Add(new NLineDataPoint(arrCumulative[i]));
                }
            }

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

            return(chartView);
        }
        /// <summary>
        /// Builds the attribute chart
        /// </summary>
        /// <param name="attributes">statistics for an attribute chart</param>
        private void BuildChart(IAttributeChartStats stats)
        {
            int nppoints = stats.Statistic.Length;
            double xstart = stats.TimeStart;
            double xincrement = stats.TimeSampleInterval;

            this.nControlChart.Panels.Clear();

            //
            // Set up chart title.
            //
            NLabel title = new NLabel();
            this.nControlChart.Panels.Add(title);
            title.Dock = DockStyle.Top;
            title.Padding = new NMarginsL(5, 8, 5, 4);
            title.Text = stats.ChartTitle;
            title.TextStyle.FontStyle = new NFontStyle("Verdana", 12, FontStyle.Bold | FontStyle.Italic);
            title.TextStyle.FillStyle = new NColorFillStyle(Color.FromArgb(68, 90, 108));

            //
            // Set up the chart
            //
            NChart chart = new NCartesianChart();
            this.nControlChart.Charts.Add(chart);
            chart.BoundsMode = BoundsMode.Stretch;
            chart.Dock = DockStyle.Fill;
            chart.Wall(ChartWallType.Back).FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant2, Color.White, Color.FromArgb(233, 233, 255));
            chart.Padding = new NMarginsL(
                    new NLength(6, NRelativeUnit.ParentPercentage),
                    new NLength(6, NRelativeUnit.ParentPercentage),
                    new NLength(6, NRelativeUnit.ParentPercentage),
                    new NLength(6, NRelativeUnit.ParentPercentage));

            SetupChartAxes(chart, stats);

            //
            // First set up a point series for the outliers so it's on-top in z-order.
            //
            NPointSeries outlierPoints = new NPointSeries();
            chart.Series.Add(outlierPoints);

            // Name the series
            outlierPoints.Name = "Control Limit Violations";

            // Tell the series to regard the X values
            outlierPoints.UseXValues = true;

            // Points must fit in the chart area
            outlierPoints.InflateMargins = true;

            // No data labels
            outlierPoints.DataLabelStyle.Visible = false;

            // Set the point appearance properties
            outlierPoints.FillStyle = new NColorFillStyle(Color.Red);
            outlierPoints.BorderStyle = new NStrokeStyle(1.0f, Color.Black);
            outlierPoints.PointShape = PointShape.Cross;
            outlierPoints.Size = new NLength(6.0f);

            // Add the statistic
            for (int i = 0; i < nppoints; i++)
            {
                double statValue = stats.Statistic[i];

                // Do not display a marker if the point is an outlier
                if ((statValue > stats.UCL[i]) || (statValue < stats.LCL[i]))
                {
                    outlierPoints.XValues.Add(xstart + xincrement * i);
                    outlierPoints.Values.Add(statValue);
                }
            }

            //
            // Set up the statistic line series
            //
            NLineSeries line = new NLineSeries();
            chart.Series.Add(line);
            line.Name = "Statistic";
            line.UseXValues = true;
            line.InflateMargins = true;
            line.DataLabelStyle.Visible = false;
            line.BorderStyle = new NStrokeStyle(1.6f, Color.Tomato);

            // Set up the marker style for the regular points
            line.MarkerStyle.Visible = true;
            line.MarkerStyle.FillStyle = new NColorFillStyle(Color.SkyBlue);
            line.MarkerStyle.BorderStyle = new NStrokeStyle(1.0f, Color.Tomato);
            line.MarkerStyle.PointShape = PointShape.Sphere;
            line.MarkerStyle.Width = new NLength(4.0f);
            line.MarkerStyle.Height = new NLength(4.0f);

            // Add the statistic
            for (int i = 0; i < nppoints; i++)
            {
                line.XValues.Add(xstart + xincrement * i);

                double statValue = stats.Statistic[i];

                // Do not display a marker if the point is an outlier
                if ((statValue > stats.UCL[i]) || (statValue < stats.LCL[i]))
                {
                    NMarkerStyle outlierMarker = new NMarkerStyle();
                    outlierMarker.Visible = false;
                    line.MarkerStyles[i] = outlierMarker;
                }
            }

            line.Values.AddRange(stats.Statistic.DataBlock.Data);

            //
            // Set up the UCL and LCL lines
            //
            if (stats.ConstControlLimits)
            {
                bool showLCL = (stats.LCL.Length > 0);
                bool showUCL = (stats.UCL.Length > 0);

                if (showLCL)
                {
                    double lclValue = stats.LCL[0];

                    // Set up the LCL const line
                    NAxisConstLine lcl = new NAxisConstLine();
                    lcl.StrokeStyle = new NStrokeStyle(1.0f, Color.Gray, LinePattern.Dash);
                    lcl.Value = lclValue;
                    lcl.ShowAtWalls = new ChartWallType[] { ChartWallType.Back };
                    chart.Axis(StandardAxis.PrimaryY).ConstLines.Add(lcl);

                    // Show LCL label
                    SetValueLabel(chart, lclValue, "LCL", true);
                }

                if (showUCL)
                {
                    double uclValue = stats.UCL[0];

                    // Set up the UCL const line
                    NAxisConstLine ucl = new NAxisConstLine();
                    ucl.Value = uclValue;
                    ucl.StrokeStyle = new NStrokeStyle(1.0f, Color.Gray, LinePattern.Dash);
                    ucl.ShowAtWalls = new ChartWallType[] { ChartWallType.Back };
                    chart.Axis(StandardAxis.PrimaryY).ConstLines.Add(ucl);

                    // Show UCL label
                    SetValueLabel(chart, uclValue, "UCL", true);
                }

                // Ensure that the UCL and LCL values are visible
                NRange1DD clRange = new NRange1DD();

                if (showLCL && showUCL)
                {
                    clRange.Begin = stats.LCL[0];
                    clRange.End = stats.UCL[0];
                }
                else if (showLCL)
                {
                    clRange.End = clRange.Begin = stats.LCL[0];
                }
                else if (showUCL)
                {
                    clRange.End = clRange.Begin = stats.UCL[0];
                }

                clRange.Inflate(0.5);

                chart.Axis(StandardAxis.PrimaryY).UpdateScale();
                chart.Axis(StandardAxis.PrimaryY).SynchronizeScaleWithConfigurator = false;

                // custom tick inflator
                NCustomRangeInflator inflator = new NCustomRangeInflator(new NRange1DD[] { clRange });
                inflator.InflateBegin = true;
                inflator.InflateEnd = true;
                chart.Axis(StandardAxis.PrimaryY).Scale.ContentRangeInflators.Add(inflator);
            }
            else
            {
                // Set up the UCL line series
                AddStepLineSeries(chart, "UCL", stats.UCL, xstart, xincrement);

                // Set up the LCL line series
                AddStepLineSeries(chart, "LCL", stats.LCL, xstart, xincrement);

                // Show UCL label
                if (stats.UCL.Length > 0)
                {
                    int lastIndexUCL = stats.UCL.Length - 1;
                    SetValueLabel(chart, stats.UCL[lastIndexUCL], "UCL", false);
                }

                // Show LCL label
                if (stats.LCL.Length > 0)
                {
                    int lastIndexLCL = stats.LCL.Length - 1;
                    SetValueLabel(chart, stats.LCL[lastIndexLCL], "LCL", false);
                }
            }

            //
            // Set up the center line
            //
            NAxisConstLine cl1 = new NAxisConstLine();
            cl1.StrokeStyle = new NStrokeStyle(1.0f, Color.DodgerBlue, LinePattern.Dot);
            cl1.Value = stats.CenterLine;
            cl1.ShowAtWalls = new ChartWallType[] { ChartWallType.Back };
            chart.Axis(StandardAxis.PrimaryY).ConstLines.Add(cl1);

            // Show CL label
            SetValueLabel(chart, stats.CenterLine, "CL", true);
        }
        /// <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);
        }
Exemple #15
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]);
        }
Exemple #16
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateRadarChartView();

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

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

            m_Chart.RadarMode   = ENRadarMode.MultiMeasure;
            m_Chart.InnerRadius = 60;

            // set some axis labels
            AddAxis(m_Chart, "Population", true);
            AddAxis(m_Chart, "Housing Units", true);
            AddAxis(m_Chart, "Water", false);
            AddAxis(m_Chart, "Land", true);
            AddAxis(m_Chart, "Population\r\nDensity", false);
            AddAxis(m_Chart, "Housing\r\nDensity", false);

            // sample data
            object[] data = new object[] {
                "Cascade County", 80357, 35225, 13.75, 2697.90, 29.8, 13.1,
                "Custer County", 11696, 5360, 10.09, 3783.13, 3.1, 1.4,
                "Dawson County", 9059, 4168, 9.99, 2373.14, 3.8, 1.8,
                "Jefferson County", 10049, 4199, 2.19, 1656.64, 6.1, 2.5,
                "Missoula County", 95802, 41319, 20.37, 2597.97, 36.9, 15.9,
                "Powell County", 7180, 2930, 6.74, 2325.94, 3.1, 1.3
            };

            for (int i = 0; i < 6; i++)
            {
                NRadarLineSeries radarLine = new NRadarLineSeries();
                m_Chart.Series.Add(radarLine);

                int baseIndex = i * 7;
                radarLine.Name = data[baseIndex].ToString();
                baseIndex      = baseIndex + 1;

                for (int j = 0; j < 6; j++)
                {
                    radarLine.DataPoints.Add(new NRadarLineDataPoint(System.Convert.ToDouble(data[baseIndex])));
                    baseIndex = baseIndex + 1;
                }

                radarLine.DataLabelStyle = new NDataLabelStyle(false);

                NMarkerStyle markerStyle = new NMarkerStyle();
                markerStyle.Size      = new NSize(4, 4);
                markerStyle.Visible   = true;
                markerStyle.Fill      = new NColorFill(NChartTheme.BrightPalette[i]);
                radarLine.MarkerStyle = markerStyle;

                radarLine.Stroke = new NStroke(2, NChartTheme.BrightPalette[i]);
            }

            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);
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateRadarChartView();

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

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

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

            NLinearScale radarScale = (NLinearScale)m_Chart.Axes[0].Scale;

            radarScale.MajorGridLines.Visible = true;

            NScaleStrip strip = new NScaleStrip(new NColorFill(ENNamedColor.Beige), null, true, 0, 0, 1, 1);

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

            m_RadarLine1 = new NRadarLineSeries();
            m_Chart.Series.Add(m_RadarLine1);
            m_RadarLine1.Stroke         = new NStroke(2, NChartTheme.BrightPalette[0]);
            m_RadarLine1.Name           = "Series 1";
            m_RadarLine1.DataLabelStyle = new NDataLabelStyle(false);
            NMarkerStyle markerStyle1 = new NMarkerStyle();

            markerStyle1.Visible     = true;
            markerStyle1.Shape       = ENPointShape.Ellipse;
            markerStyle1.Size        = new NSize(10, 10);
            m_RadarLine1.MarkerStyle = markerStyle1;

            m_RadarLine2 = new NRadarLineSeries();
            m_Chart.Series.Add(m_RadarLine2);
            m_RadarLine2.Stroke         = new NStroke(2, NChartTheme.BrightPalette[1]);
            m_RadarLine2.Name           = "Series 2";
            m_RadarLine2.DataLabelStyle = new NDataLabelStyle(false);
            NMarkerStyle markerStyle2 = new NMarkerStyle();

            markerStyle2.Visible     = true;
            markerStyle2.Shape       = ENPointShape.Ellipse;
            markerStyle2.Size        = new NSize(10, 10);
            m_RadarLine2.MarkerStyle = markerStyle2;

            // fill random data
            Random random = new Random();

            for (int i = 0; i < 8; i++)
            {
                m_RadarLine1.DataPoints.Add(new NRadarLineDataPoint(random.Next(50, 90)));
                m_RadarLine2.DataPoints.Add(new NRadarLineDataPoint(random.Next(0, 100)));
            }

            return(chartView);
        }
Exemple #19
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);
        }
Exemple #20
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreatePolarChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Polar Value Axis Position";

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

            m_Chart.SetPredefinedPolarAxes(ENPredefinedPolarAxes.AngleValue);

            // setup chart
            m_Chart.InnerRadius = 20;

            // setup polar axis
            NLinearScale linearScale = (NLinearScale)m_Chart.Axes[ENPolarAxis.PrimaryValue].Scale;

            linearScale.ViewRangeInflateMode         = ENScaleViewRangeInflateMode.MajorTick;
            linearScale.InflateViewRangeBegin        = true;
            linearScale.InflateViewRangeEnd          = true;
            linearScale.Labels.OverlapResolveLayouts = new NDomArray <ENLevelLabelsLayout>(new ENLevelLabelsLayout[] { ENLevelLabelsLayout.AutoScale });

            linearScale.MajorGridLines.Visible          = true;
            linearScale.MajorGridLines.Stroke.DashStyle = ENDashStyle.Dash;

            // setup polar angle axis
            NAngularScale angularScale = (NAngularScale)m_Chart.Axes[ENPolarAxis.PrimaryAngle].Scale;

            angularScale.MajorGridLines.Visible = true;
            angularScale.Labels.Style.Angle     = new NScaleLabelAngle(ENScaleLabelAngleMode.Scale, 0);
            NScaleStrip strip = new NScaleStrip();

            strip.Fill       = new NColorFill(new NColor(192, 192, 192, 125));
            strip.Interlaced = true;
            angularScale.Strips.Add(strip);

            // add a const line
            NAxisReferenceLine referenceLine = new NAxisReferenceLine();

            referenceLine.Value  = 1.0;
            referenceLine.Stroke = new NStroke(1, NColor.SlateBlue);
            m_Chart.Axes[ENPolarAxis.PrimaryValue].ReferenceLines.Add(referenceLine);

            // create a polar line series
            NPolarLineSeries series1 = new NPolarLineSeries();

            m_Chart.Series.Add(series1);
            series1.Name           = "Series 1";
            series1.CloseContour   = true;
            series1.UseXValues     = true;
            series1.DataLabelStyle = new NDataLabelStyle(false);

            NMarkerStyle markerStyle = new NMarkerStyle();

            markerStyle.Visible = false;
            markerStyle.Size    = new NSize(2, 2);
            series1.MarkerStyle = markerStyle;
            Curve1(series1, 50);

            // create a polar line series
            NPolarLineSeries series2 = new NPolarLineSeries();

            m_Chart.Series.Add(series2);
            series2.Name           = "Series 2";
            series2.CloseContour   = true;
            series2.UseXValues     = true;
            series2.DataLabelStyle = new NDataLabelStyle(false);

            markerStyle         = new NMarkerStyle();
            markerStyle.Visible = false;
            series2.MarkerStyle = markerStyle;
            Curve2(series2, 100);

            // add a second value axes
            m_RedAxis   = m_Chart.Axes[ENPolarAxis.PrimaryValue];
            m_GreenAxis = m_Chart.AddCustomAxis(ENPolarAxisOrientation.Value);

            m_RedAxis.Anchor   = new NValueCrossPolarAxisAnchor(0.0, m_Chart.Axes[ENPolarAxis.PrimaryAngle], ENPolarAxisOrientation.Value, ENScaleOrientation.Auto);
            m_GreenAxis.Anchor = new NValueCrossPolarAxisAnchor(90, m_Chart.Axes[ENPolarAxis.PrimaryAngle], ENPolarAxisOrientation.Value, ENScaleOrientation.Auto);

            // color code the axes and series after the stylesheet is applied
            m_RedAxis.Scale.SetColor(NColor.Red);
            m_GreenAxis.Scale.SetColor(NColor.Green);

            series1.Stroke = new NStroke(2, NColor.DarkRed);
            series2.Stroke = new NStroke(2, NColor.DarkGreen);

            series2.ValueAxis = m_GreenAxis;

            return(chartView);
        }