protected void DecorateGaugeAxis(NRadialGaugePanel panel, NRange1DD range, Color colorLight, Color colorDark)
        {
            NGaugeAxis axis = (NGaugeAxis)panel.Axes[0];
            NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator;

            NRangeIndicator rangeIndicator = new NRangeIndicator();

            rangeIndicator.OriginMode      = OriginMode.Custom;
            rangeIndicator.OffsetFromScale = new NLength(10);
            rangeIndicator.Value           = range.Begin;
            rangeIndicator.Origin          = range.End;

            rangeIndicator.FillStyle         = new NColorFillStyle(Color.FromArgb(30, colorLight));
            rangeIndicator.StrokeStyle.Width = new NLength(0);
            panel.Indicators.Add(rangeIndicator);

            NScaleSectionStyle scaleSection = new NScaleSectionStyle();

            scaleSection.Range = range;
            scaleSection.MajorTickFillStyle = new NColorFillStyle(colorLight);
            scaleSection.MinorTickFillStyle = new NColorFillStyle(colorLight);

            NTextStyle labelStyle = new NTextStyle();

            labelStyle.FillStyle        = new NColorFillStyle(colorDark);
            labelStyle.FontStyle.Style  = FontStyle.Bold;
            labelStyle.FontStyle.EmSize = new NLength(6);
            scaleSection.LabelTextStyle = labelStyle;

            scale.Sections.Add(scaleSection);
        }
Exemple #2
0
        private void DecorateGaugeAxis(NRadialGaugePanel panel, NRange1DD range, Color colorLight, Color colorDark)
        {
            NGaugeAxis axis = (NGaugeAxis)panel.Axes[0];
            NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator;

            // create a range indicator
            NRangeIndicator rangeIndicator = new NRangeIndicator();

            rangeIndicator.OriginMode = OriginMode.Custom;
            rangeIndicator.Value      = range.Begin;
            rangeIndicator.Origin     = range.End;
            rangeIndicator.BeginWidth = new NLength(10);
            rangeIndicator.EndWidth   = new NLength(10);

            rangeIndicator.FillStyle         = new NColorFillStyle(Color.FromArgb(100, colorLight));
            rangeIndicator.StrokeStyle.Color = colorLight;
            panel.Indicators.Add(rangeIndicator);

            // create a scale section
            NScaleSectionStyle scaleSection = new NScaleSectionStyle();

            scaleSection.Range = range;
            scaleSection.MajorTickStrokeStyle = new NStrokeStyle(colorLight);
            scaleSection.MinorTickStrokeStyle = new NStrokeStyle(1, colorLight, LinePattern.Dot, 0, 2);

            NTextStyle labelStyle = new NTextStyle();

            labelStyle.FillStyle        = new NGradientFillStyle(colorLight, colorDark);
            labelStyle.FontStyle        = new NFontStyle("Arial", 10, FontStyle.Bold);
            scaleSection.LabelTextStyle = labelStyle;

            scale.Sections.Add(scaleSection);
        }
        private void ApplyScaleSectionToAxis(NLinearScaleConfigurator scale)
        {
            NScaleSectionStyle scaleSection = new NScaleSectionStyle();

            scaleSection.Range                    = new NRange1DD(70, 100);
            scaleSection.LabelTextStyle           = new NTextStyle();
            scaleSection.LabelTextStyle.FillStyle = new NColorFillStyle(KnownArgbColorValue.DarkRed);
            scaleSection.LabelTextStyle.FontStyle = new NFontStyle("Arial", 12, FontStyle.Bold);
            scaleSection.MajorTickStrokeStyle     = new NStrokeStyle(Color.DarkRed);

            scale.Sections.Add(scaleSection);
        }
Exemple #4
0
        private void InitSections(NGaugePanel gaugePanel)
        {
            NGaugeAxis axis = (NGaugeAxis)gaugePanel.Axes[0];
            NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator;

            // init text style for regular labels
            scale.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.White);
            scale.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 10, FontStyle.Bold);

            // init ticks
            scale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            scale.MinTickDistance = new NLength(20);
            scale.MinorTickCount  = 1;
            scale.SetPredefinedScaleStyle(PredefinedScaleStyle.Scientific);

            // create sections
            NScaleSectionStyle blueSection = new NScaleSectionStyle();

            blueSection.Range = new NRange1DD(0, 20);
            blueSection.SetShowAtWall(ChartWallType.Back, true);
            blueSection.RangeFillStyle       = new NColorFillStyle(Color.FromArgb(50, Color.Blue));
            blueSection.MajorGridStrokeStyle = new NStrokeStyle(Color.Blue);
            blueSection.MajorTickStrokeStyle = new NStrokeStyle(Color.DarkBlue);
            blueSection.MinorTickStrokeStyle = new NStrokeStyle(1, Color.Blue, LinePattern.Dot, 0, 2);

            NTextStyle labelStyle = new NTextStyle();

            labelStyle.FillStyle       = new NColorFillStyle(Color.Blue);
            labelStyle.FontStyle       = new NFontStyle("Arial", 10, FontStyle.Bold);
            blueSection.LabelTextStyle = labelStyle;

            scale.Sections.Add(blueSection);

            NScaleSectionStyle redSection = new NScaleSectionStyle();

            redSection.Range = new NRange1DD(80, 100);

            redSection.SetShowAtWall(ChartWallType.Back, true);
            redSection.RangeFillStyle       = new NColorFillStyle(Color.FromArgb(50, Color.Red));
            redSection.MajorGridStrokeStyle = new NStrokeStyle(Color.Red);
            redSection.MajorTickStrokeStyle = new NStrokeStyle(Color.DarkRed);
            redSection.MinorTickStrokeStyle = new NStrokeStyle(1, Color.Red, LinePattern.Dot, 0, 2);

            labelStyle                = new NTextStyle();
            labelStyle.FillStyle      = new NColorFillStyle(Color.Red);
            labelStyle.FontStyle      = new NFontStyle("Arial", 10, FontStyle.Bold);
            redSection.LabelTextStyle = labelStyle;

            scale.Sections.Add(redSection);
        }
Exemple #5
0
            public MySelectRange(NChart chart, double begin, double end, Color c)
            {
                this._chart     = chart;
                this._end       = Math.Max(begin, end);
                this._begin     = Math.Min(begin, end);
                this._LineColor = c;


                this._line1 = chart.Axis(StandardAxis.PrimaryX).ConstLines.Add();
                this._line1.StrokeStyle.Color = this._LineColor;
                this._line1.StrokeStyle.Width = new NLength(1.5f);
                this._line1.FillStyle         = new NColorFillStyle(new NArgbColor(125, this._LineColor));
                this._line1.Text  = "点击鼠标左键进行拖动";
                this._line1.Value = this._begin;


                this._line2 = chart.Axis(StandardAxis.PrimaryX).ConstLines.Add();
                this._line2.StrokeStyle.Color = this._LineColor;
                this._line2.StrokeStyle.Width = new NLength(1.5f);
                this._line2.FillStyle         = new NColorFillStyle(new NArgbColor(125, this._LineColor));
                this._line2.Text  = "点击鼠标左键进行拖动";
                this._line2.Value = this._end;



                // configure the first vertical section
                _section       = new NScaleSectionStyle();
                _section.Range = new NRange1DD(begin, end);
                _section.SetShowAtWall(ChartWallType.Back, true);
                _section.SetShowAtWall(ChartWallType.Left, true);
                _section.RangeFillStyle       = new NColorFillStyle(_LineColor);
                _section.MajorGridStrokeStyle = new NStrokeStyle(_LineColor);
                _section.MajorTickStrokeStyle = new NStrokeStyle(Color.DarkBlue);
                _section.MinorTickStrokeStyle = new NStrokeStyle(1, _LineColor, LinePattern.Dot, 0, 2);
                _standardScale = (NStandardScaleConfigurator)_chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator;

                _standardScale.Sections.Add(_section);

                //labelStyle = new NTextStyle();
                //labelStyle.FillStyle = new NGradientFillStyle(Color.Blue, Color.DarkBlue);
                //labelStyle.FontStyle.Style = FontStyle.Bold;
                //m_FirstVerticalSection.LabelTextStyle = labelStyle;



                this._line1.ValueChanged += new EventHandler(_line_ValueChanged);
                this._line2.ValueChanged += new EventHandler(_line_ValueChanged);
            }
        private NScaleSectionStyle CreateSection(Color tickColor, Color labelColor, NRange1DD range)
        {
            NScaleSectionStyle scaleSection = new NScaleSectionStyle();

            scaleSection.Range              = range;
            scaleSection.LabelTextStyle     = new NTextStyle(new NFontStyle(), tickColor);
            scaleSection.MajorTickFillStyle = new NColorFillStyle(tickColor);

            NTextStyle labelStyle = new NTextStyle();

            labelStyle.FillStyle        = new NColorFillStyle(labelColor);
            labelStyle.FontStyle        = new NFontStyle("Arial", 10, FontStyle.Bold);
            scaleSection.LabelTextStyle = labelStyle;

            return(scaleSection);
        }
        private void ApplyScaleSectionToAxis(NLinearScaleConfigurator scale, string text, NRange1DD range, Color color)
        {
            NScaleSectionStyle scaleSection = new NScaleSectionStyle();

            scaleSection.Range                    = range;
            scaleSection.LabelTextStyle           = new NTextStyle();
            scaleSection.LabelTextStyle.FillStyle = new NColorFillStyle(color);
            scaleSection.LabelTextStyle.FontStyle = new NFontStyle("Arial", 10, FontStyle.Bold | FontStyle.Italic);
            scaleSection.MajorTickStrokeStyle     = new NStrokeStyle(color);

            scale.Sections.Add(scaleSection);

            NCustomRangeLabel rangeLabel = new NCustomRangeLabel(range, text);

            rangeLabel.Style.WrapText            = false;
            rangeLabel.Style.KeepInsideRuler     = false;
            rangeLabel.Style.StrokeStyle.Color   = color;
            rangeLabel.Style.TextStyle.FillStyle = new NColorFillStyle(Color.White);
            rangeLabel.Style.Angle    = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0);
            rangeLabel.Style.TickMode = RangeLabelTickMode.Center;
            scale.CustomLabels.Add(rangeLabel);
        }
Exemple #8
0
        private void ConfigureScale(NStandardScaleConfigurator scale, NRange1DD redRange)
        {
            scale.SetPredefinedScaleStyle(PredefinedScaleStyle.PresentationNoStroke);
            scale.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 9, FontStyle.Bold);
            scale.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.White);
            scale.LabelStyle.Angle             = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0);
            scale.MinorTickCount               = 1;
            scale.RulerStyle.BorderStyle.Width = new NLength(0);
            scale.RulerStyle.FillStyle         = new NColorFillStyle(Color.FromArgb(125, Color.SlateGray));

            NScaleSectionStyle scaleSection = new NScaleSectionStyle();

            scaleSection.Range = redRange;
            scaleSection.MajorTickFillStyle = new NColorFillStyle(Color.Red);
            scaleSection.MinorTickFillStyle = new NColorFillStyle(Color.Red);

            NTextStyle labelStyle = new NTextStyle();

            labelStyle.FillStyle        = new NGradientFillStyle(Color.Red, Color.DarkRed);
            labelStyle.FontStyle        = new NFontStyle("Arial", 9, FontStyle.Bold);
            scaleSection.LabelTextStyle = labelStyle;

            scale.Sections.Add(scaleSection);
        }
Exemple #9
0
        private void UpdateSections()
        {
            for (int i = 0; i < nChartControl1.Panels.Count; i++)
            {
                NGaugePanel panel = nChartControl1.Panels[i] as NGaugePanel;

                if (panel != null)
                {
                    NGaugeAxis axis = (NGaugeAxis)panel.Axes[0];
                    NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator;

                    if (scale.Sections.Count == 2)
                    {
                        NScaleSectionStyle blueSection = (NScaleSectionStyle)scale.Sections[0];
                        blueSection.Range = new NRange1DD((double)BlueSectionBeginUpDown.Value, (double)BlueSectionEndUpDown.Value);

                        NScaleSectionStyle redSection = (NScaleSectionStyle)scale.Sections[1];
                        redSection.Range = new NRange1DD((double)RedSectionBeginUpDown.Value, (double)RedSectionEndUpDown.Value);
                    }
                }
            }

            nChartControl1.Refresh();
        }
Exemple #10
0
        private void UpdateScale()
        {
            NAxis     primaryY      = nChartControl1.Charts[0].Axis(StandardAxis.PrimaryY);
            NRange1DD hotZoneRange  = new NRange1DD(Convert.ToDouble(HotZoneBeginDropDownList.SelectedValue), 100);
            NRange1DD coldZoneRange = new NRange1DD(0, Convert.ToDouble(ColdZoneEndDropDownList.SelectedValue));

            NScaleSectionStyle hotZoneSection = new NScaleSectionStyle();

            hotZoneSection.Range                = hotZoneRange;
            hotZoneSection.LabelTextStyle       = new NTextStyle(new NFontStyle(), Color.Red);
            hotZoneSection.MajorTickStrokeStyle = new NStrokeStyle(1, Color.Red);
            hotZoneSection.RangeFillStyle       = new NColorFillStyle(Color.FromArgb(50, Color.Red));
            hotZoneSection.SetShowAtWall(ChartWallType.Back, true);

            NScaleSectionStyle coldZoneSection = new NScaleSectionStyle();

            coldZoneSection.Range                = coldZoneRange;
            coldZoneSection.LabelTextStyle       = new NTextStyle(new NFontStyle(), Color.Blue);
            coldZoneSection.MajorTickStrokeStyle = new NStrokeStyle(1, Color.Blue);
            coldZoneSection.RangeFillStyle       = new NColorFillStyle(Color.FromArgb(50, Color.Blue));
            coldZoneSection.SetShowAtWall(ChartWallType.Back, true);

            NStandardScaleConfigurator configurator = (NStandardScaleConfigurator)primaryY.ScaleConfigurator;

            configurator.Sections.Clear();
            configurator.Sections.Add(hotZoneSection);
            configurator.Sections.Add(coldZoneSection);

            // first use the scale configurator to output some definition
            primaryY.SynchronizeScaleWithConfigurator = true;
            primaryY.InvalidateScale();
            primaryY.UpdateScale();
            primaryY.SynchronizeScaleWithConfigurator = false;

            // manually program the scale
            NScaleLevel                    scaleLevel;
            NCustomScaleDecorator          customScaleDecorator;
            NScaleRangeDecorationAnchor    anchor;
            NScaleLevelSeparator           separator;
            NValueScaleLabel               label;
            NNumericDoubleStepRangeSampler rangeSampler;
            NClampedRangeSampler           clampedRangeSampler;
            NScaleTickFactory              tickFactory;
            NSampledScaleDecorator         sampledDecorator;;

            // create the hot zone

            // add a level separator
            scaleLevel           = new NScaleLevel();
            customScaleDecorator = new NCustomScaleDecorator();

            anchor    = new NScaleRangeDecorationAnchor(hotZoneRange);
            separator = new NScaleLevelSeparator(0, anchor, ScaleLevelShape.Line, null, new NStrokeStyle(1, Color.Red), new NLength(0), new NLength(0), new NLength(0), new NLength(0), null, null, null, false);
            customScaleDecorator.Decorations.Add(separator);

            // create a value scale label
            label        = new NValueScaleLabel();
            label.Text   = "Hot Zone";
            label.Anchor = new NRulerValueDecorationAnchor(HorzAlign.Right, new NLength(0));
            label.Offset = new NLength(6, NGraphicsUnit.Point);
            label.Style.TextStyle.FillStyle = new NColorFillStyle(Color.Red);
            label.Style.ContentAlignment    = ContentAlignment.TopRight;
            label.Style.Angle = new NScaleLabelAngle(ScaleLabelAngleMode.View, 90, true);

            customScaleDecorator.Decorations.Add(label);
            scaleLevel.Decorators.Add(customScaleDecorator);

            // add a some ticks
            rangeSampler = new NNumericDoubleStepRangeSampler(new NCustomNumericStepProvider(5));
            rangeSampler.UseCustomOrigin = true;
            rangeSampler.CustomOrigin    = 0;
            clampedRangeSampler          = new NClampedRangeSampler(rangeSampler, hotZoneRange);

            tickFactory = new NScaleTickFactory(0, ScaleTickShape.Line,
                                                new NLength(0),
                                                new NSizeL(new NLength(1), new NLength(5, NGraphicsUnit.Point)),
                                                new NConstValueProvider(new NColorFillStyle(Color.Red)),
                                                new NConstValueProvider(new NStrokeStyle(1, Color.Red)),
                                                HorzAlign.Left);

            sampledDecorator = new NSampledScaleDecorator(clampedRangeSampler, tickFactory);
            scaleLevel.Decorators.Add(sampledDecorator);

            // create the cold zone
            // add a level separator
            customScaleDecorator = new NCustomScaleDecorator();

            anchor    = new NScaleRangeDecorationAnchor(coldZoneRange);
            separator = new NScaleLevelSeparator(0, anchor, ScaleLevelShape.Line, null, new NStrokeStyle(1, Color.Blue));
            customScaleDecorator.Decorations.Add(separator);

            // create a value scale label
            label        = new NValueScaleLabel();
            label.Text   = "Cold Zone";
            label.Anchor = new NRulerValueDecorationAnchor(HorzAlign.Left, new NLength(0));
            label.Offset = new NLength(6, NGraphicsUnit.Point);
            label.Style.TextStyle.FillStyle = new NColorFillStyle(Color.Blue);
            label.Style.ContentAlignment    = ContentAlignment.TopLeft;
            label.Style.Angle = new NScaleLabelAngle(ScaleLabelAngleMode.View, 90, true);

            customScaleDecorator.Decorations.Add(label);
            scaleLevel.Decorators.Add(customScaleDecorator);

            // add a some ticks
            rangeSampler        = new NNumericDoubleStepRangeSampler(new NCustomNumericStepProvider(5));
            clampedRangeSampler = new NClampedRangeSampler(rangeSampler, coldZoneRange);

            tickFactory = new NScaleTickFactory(0, ScaleTickShape.Line,
                                                new NLength(0),
                                                new NSizeL(new NLength(1), new NLength(5, NGraphicsUnit.Point)),
                                                new NConstValueProvider(new NColorFillStyle(Color.Red)),
                                                new NConstValueProvider(new NStrokeStyle(1, Color.Blue)),
                                                HorzAlign.Left);

            sampledDecorator = new NSampledScaleDecorator(clampedRangeSampler, tickFactory);
            scaleLevel.Decorators.Add(sampledDecorator);

            primaryY.Scale.Levels.Add(scaleLevel);

            UpdateData(hotZoneRange, coldZoneRange);
        }
Exemple #11
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

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

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

            m_Chart            = (NCartesianChart)nChartControl1.Charts[0];
            m_Chart.BoundsMode = BoundsMode.Stretch;
            m_Chart.Location   = new NPointL(
                new NLength(2, NRelativeUnit.ParentPercentage),
                new NLength(12, NRelativeUnit.ParentPercentage));
            m_Chart.Size = new NSizeL(
                new NLength(93, NRelativeUnit.ParentPercentage),
                new NLength(85, NRelativeUnit.ParentPercentage));

            // create a point series
            NPointSeries point = (NPointSeries)m_Chart.Series.Add(SeriesType.Point);

            point.Name                   = "Point Series";
            point.Legend.Mode            = SeriesLegendMode.None;
            point.DataLabelStyle.Visible = false;
            point.MarkerStyle.Visible    = false;
            point.Size                   = new NLength(5, NGraphicsUnit.Point);
            point.Values.FillRandom(Random, 30);
            point.ShadowStyle.Type       = ShadowType.GaussianBlur;
            point.ShadowStyle.Offset     = new NPointL(3, 3);
            point.ShadowStyle.FadeLength = new NLength(5);
            point.ShadowStyle.Color      = Color.FromArgb(55, 0, 0, 0);
            point.InflateMargins         = true;

            // tell the x axis to display major and minor grid lines
            NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator();

            m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale;
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true);
            linearScale.MinorGridStyle.LineStyle.Pattern = LinePattern.Dot;
            linearScale.MinorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            linearScale.MinorGridStyle.SetShowAtWall(ChartWallType.Floor, true);
            linearScale.MinorTickCount = 1;

            // tell the y axis to display major and minor grid lines
            linearScale = new NLinearScaleConfigurator();
            m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale;
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true);
            linearScale.MinorGridStyle.LineStyle.Pattern = LinePattern.Dot;
            linearScale.MinorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            linearScale.MinorGridStyle.SetShowAtWall(ChartWallType.Floor, true);
            linearScale.MinorTickCount = 1;

            NTextStyle labelStyle;

            // configure the first horizontal section
            m_FirstHorizontalSection       = new NScaleSectionStyle();
            m_FirstHorizontalSection.Range = new NRange1DD(2, 8);
            m_FirstHorizontalSection.SetShowAtWall(ChartWallType.Back, true);
            m_FirstHorizontalSection.SetShowAtWall(ChartWallType.Floor, true);
            m_FirstHorizontalSection.RangeFillStyle       = new NColorFillStyle(Color.FromArgb(125, Color.Red));
            m_FirstHorizontalSection.MajorGridStrokeStyle = new NStrokeStyle(Color.Red);
            m_FirstHorizontalSection.MajorTickStrokeStyle = new NStrokeStyle(Color.DarkRed);
            m_FirstHorizontalSection.MinorTickStrokeStyle = new NStrokeStyle(1, Color.Red, LinePattern.Dot, 0, 1);

            labelStyle                 = new NTextStyle();
            labelStyle.FillStyle       = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.Red, Color.DarkRed);
            labelStyle.FontStyle.Style = FontStyle.Bold;
            m_FirstHorizontalSection.LabelTextStyle = labelStyle;

            // configure the second horizontal section
            m_SecondHorizontalSection       = new NScaleSectionStyle();
            m_SecondHorizontalSection.Range = new NRange1DD(14, 18);
            m_SecondHorizontalSection.SetShowAtWall(ChartWallType.Back, true);
            m_SecondHorizontalSection.SetShowAtWall(ChartWallType.Floor, true);
            m_SecondHorizontalSection.RangeFillStyle       = new NColorFillStyle(Color.FromArgb(125, Color.Green));
            m_SecondHorizontalSection.MajorGridStrokeStyle = new NStrokeStyle(Color.Green);
            m_SecondHorizontalSection.MajorTickStrokeStyle = new NStrokeStyle(Color.DarkGreen);
            m_SecondHorizontalSection.MinorTickStrokeStyle = new NStrokeStyle(1, Color.Green, LinePattern.Dot, 0, 2);

            labelStyle                 = new NTextStyle();
            labelStyle.FillStyle       = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.Green, Color.DarkGreen);
            labelStyle.FontStyle.Style = FontStyle.Bold;
            m_SecondHorizontalSection.LabelTextStyle = labelStyle;

            // configure the first vertical section
            m_FirstVerticalSection       = new NScaleSectionStyle();
            m_FirstVerticalSection.Range = new NRange1DD(20, 40);
            m_FirstVerticalSection.SetShowAtWall(ChartWallType.Back, true);
            m_FirstVerticalSection.SetShowAtWall(ChartWallType.Left, true);
            m_FirstVerticalSection.RangeFillStyle       = new NColorFillStyle(Color.FromArgb(125, Color.Blue));
            m_FirstVerticalSection.MajorGridStrokeStyle = new NStrokeStyle(Color.Blue);
            m_FirstVerticalSection.MajorTickStrokeStyle = new NStrokeStyle(Color.DarkBlue);
            m_FirstVerticalSection.MinorTickStrokeStyle = new NStrokeStyle(1, Color.Blue, LinePattern.Dot, 0, 2);

            labelStyle                            = new NTextStyle();
            labelStyle.FillStyle                  = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.Blue, Color.DarkBlue);
            labelStyle.FontStyle.Style            = FontStyle.Bold;
            m_FirstVerticalSection.LabelTextStyle = labelStyle;

            // configure the second vertical section
            m_SecondVerticalSection       = new NScaleSectionStyle();
            m_SecondVerticalSection.Range = new NRange1DD(70, 90);
            m_SecondVerticalSection.SetShowAtWall(ChartWallType.Back, true);
            m_SecondVerticalSection.SetShowAtWall(ChartWallType.Left, true);
            m_SecondVerticalSection.RangeFillStyle       = new NColorFillStyle(Color.FromArgb(125, Color.Orange));
            m_SecondVerticalSection.MajorGridStrokeStyle = new NStrokeStyle(Color.Orange);
            m_SecondVerticalSection.MajorTickStrokeStyle = new NStrokeStyle(Color.DarkOrange);
            m_SecondVerticalSection.MinorTickStrokeStyle = new NStrokeStyle(1, Color.Orange, LinePattern.Dot, 0, 2);

            labelStyle                             = new NTextStyle();
            labelStyle.FillStyle                   = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.Orange, Color.DarkOrange);
            labelStyle.FontStyle.Style             = FontStyle.Bold;
            m_SecondVerticalSection.LabelTextStyle = labelStyle;

            if (!Page.IsPostBack)
            {
                ShowFirstHorizontalSectionCheck.Checked  = true;
                ShowSecondHorizontalSectionCheck.Checked = true;
                ShowFirstVerticalSectionCheck.Checked    = true;
                ShowSecondVerticalSectionCheck.Checked   = true;
            }
            UpdateSections();
        }
        private NRadialGaugePanel CreateRadialGauge()
        {
            // create the radial gauge
            NRadialGaugePanel radialGauge = new NRadialGaugePanel();

            radialGauge.PaintEffect      = new NGlassEffectStyle();
            radialGauge.BorderStyle      = new NEdgeBorderStyle(BorderShape.Auto);
            radialGauge.ContentAlignment = ContentAlignment.BottomCenter;

            NGaugeAxis axis = (NGaugeAxis)radialGauge.Axes[0];

            axis.Range = new NRange1DD(0, 250);

            NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator;

            scale.SetPredefinedScaleStyle(PredefinedScaleStyle.Presentation);
            scale.MinorTickCount = 4;
            scale.RulerStyle.BorderStyle.Width = new NLength(0);
            scale.RulerStyle.FillStyle         = new NColorFillStyle(Color.DarkGray);

            NScaleSectionStyle scaleSection = new NScaleSectionStyle();

            scaleSection.Range = new NRange1DD(220, 260);
            scaleSection.MajorTickStrokeStyle = new NStrokeStyle(Color.Red);
            scaleSection.MinorTickStrokeStyle = new NStrokeStyle(1, Color.Red, LinePattern.Dot, 0, 2);

            NTextStyle labelStyle = new NTextStyle();

            labelStyle.FillStyle        = new NGradientFillStyle(Color.Red, Color.DarkRed);
            labelStyle.FontStyle.Style  = FontStyle.Bold;
            scaleSection.LabelTextStyle = labelStyle;

            scale.Sections.Add(scaleSection);

            NRangeIndicator rangeIndicator = new NRangeIndicator();

            rangeIndicator.Value             = 220;
            rangeIndicator.OriginMode        = OriginMode.ScaleMax;
            rangeIndicator.FillStyle         = new NColorFillStyle(Color.Red);
            rangeIndicator.StrokeStyle.Width = new NLength(0);
            rangeIndicator.BeginWidth        = new NLength(-2);
            rangeIndicator.EndWidth          = new NLength(-10);
            radialGauge.Indicators.Add(rangeIndicator);

            NMarkerValueIndicator markerIndicator = new NMarkerValueIndicator();

            markerIndicator.Value = 90;
            radialGauge.Indicators.Add(markerIndicator);

            NNeedleValueIndicator needleIndictor = new NNeedleValueIndicator();

            needleIndictor.Value                   = 0;
            needleIndictor.Shape.FillStyle         = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red);
            needleIndictor.Shape.StrokeStyle.Color = Color.Red;
            radialGauge.Indicators.Add(needleIndictor);

            radialGauge.BeginAngle = -240;
            radialGauge.SweepAngle = 300;

            return(radialGauge);
        }
Exemple #13
0
        private void timer1_Tick(object sender, System.EventArgs e)
        {
            if (nChartControl1.Panels.Count < 3)
            {
                return;
            }

            // update linear gauge
            NGaugePanel panel = nChartControl1.Panels[1] as NGaugePanel;

            if (panel != null)
            {
                NValueIndicator            valueIndicator = (NValueIndicator)panel.Indicators[0];
                NStandardScaleConfigurator scale          = (NStandardScaleConfigurator)((NGaugeAxis)panel.Axes[0]).ScaleConfigurator;
                NScaleSectionStyle         blueSection    = (NScaleSectionStyle)scale.Sections[0];
                NScaleSectionStyle         redSection     = (NScaleSectionStyle)scale.Sections[1];

                m_FirstIndicatorAngle += 0.02f;
                valueIndicator.Value   = 50 - Math.Cos(m_FirstIndicatorAngle) * 50;

                if (blueSection.Range.Contains(valueIndicator.Value))
                {
                    valueIndicator.Shape.FillStyle   = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Blue);
                    valueIndicator.Shape.StrokeStyle = new NStrokeStyle(Color.Blue);
                }
                else if (redSection.Range.Contains(valueIndicator.Value))
                {
                    valueIndicator.Shape.FillStyle   = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red);
                    valueIndicator.Shape.StrokeStyle = new NStrokeStyle(Color.Red);
                }
                else
                {
                    valueIndicator.Shape.FillStyle   = new NColorFillStyle(Color.LightGreen);
                    valueIndicator.Shape.StrokeStyle = new NStrokeStyle(Color.DarkGreen);
                }
            }

            // update radial gauge
            panel = nChartControl1.Panels[2] as NGaugePanel;
            if (panel != null)
            {
                NStandardScaleConfigurator scale          = (NStandardScaleConfigurator)((NGaugeAxis)panel.Axes[0]).ScaleConfigurator;
                NValueIndicator            valueIndicator = (NValueIndicator)panel.Indicators[0];
                NScaleSectionStyle         blueSection    = (NScaleSectionStyle)scale.Sections[0];
                NScaleSectionStyle         redSection     = (NScaleSectionStyle)scale.Sections[1];

                m_SecondIndicatorAngle += 0.02f;
                valueIndicator.Value    = 50 - Math.Cos(m_SecondIndicatorAngle) * 50;

                if (blueSection.Range.Contains(valueIndicator.Value))
                {
                    valueIndicator.Shape.FillStyle   = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Blue);
                    valueIndicator.Shape.StrokeStyle = new NStrokeStyle(Color.DarkBlue);
                }
                else if (redSection.Range.Contains(valueIndicator.Value))
                {
                    valueIndicator.Shape.FillStyle   = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red);
                    valueIndicator.Shape.StrokeStyle = new NStrokeStyle(Color.DarkRed);
                }
                else
                {
                    valueIndicator.Shape.FillStyle   = new NColorFillStyle(Color.LightGreen);
                    valueIndicator.Shape.StrokeStyle = new NStrokeStyle(Color.DarkGreen);
                }

                valueIndicator.Shape.StrokeStyle = new NStrokeStyle(Color.White);
            }

            nChartControl1.Refresh();
        }
        public override void Initialize()
        {
            base.Initialize();

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

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

            m_Chart            = (NCartesianChart)nChartControl1.Charts[0];
            m_Chart.BoundsMode = BoundsMode.Stretch;

            // create a point series
            NPointSeries point = (NPointSeries)m_Chart.Series.Add(SeriesType.Point);

            point.Name = "Point Series";
            point.DataLabelStyle.Visible = false;
            point.MarkerStyle.Visible    = false;
            point.Size = new NLength(5, NGraphicsUnit.Point);
            point.Values.FillRandom(Random, 30);
            point.ShadowStyle.Type       = ShadowType.GaussianBlur;
            point.ShadowStyle.Offset     = new NPointL(3, 3);
            point.ShadowStyle.FadeLength = new NLength(5);
            point.ShadowStyle.Color      = Color.FromArgb(55, 0, 0, 0);
            point.InflateMargins         = true;

            // tell the x axis to display major and minor grid lines
            NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator();

            m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale;
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true);
            linearScale.MinorGridStyle.LineStyle.Pattern = LinePattern.Dot;
            linearScale.MinorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            linearScale.MinorGridStyle.SetShowAtWall(ChartWallType.Floor, true);
            linearScale.MinorTickCount = 1;

            // tell the y axis to display major and minor grid lines
            linearScale = new NLinearScaleConfigurator();
            m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale;
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true);
            linearScale.MinorGridStyle.LineStyle.Pattern = LinePattern.Dot;
            linearScale.MinorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            linearScale.MinorGridStyle.SetShowAtWall(ChartWallType.Floor, true);
            linearScale.MinorTickCount = 1;

            NTextStyle labelStyle;

            // configure the first horizontal section
            m_FirstHorizontalSection       = new NScaleSectionStyle();
            m_FirstHorizontalSection.Range = new NRange1DD(2, 8);
            m_FirstHorizontalSection.SetShowAtWall(ChartWallType.Back, true);
            m_FirstHorizontalSection.SetShowAtWall(ChartWallType.Floor, true);
            m_FirstHorizontalSection.RangeFillStyle       = new NColorFillStyle(Color.FromArgb(60, Color.Red));
            m_FirstHorizontalSection.MajorGridStrokeStyle = new NStrokeStyle(Color.Red);
            m_FirstHorizontalSection.MajorTickStrokeStyle = new NStrokeStyle(Color.DarkRed);
            m_FirstHorizontalSection.MinorTickStrokeStyle = new NStrokeStyle(1, Color.Red, LinePattern.Dot, 0, 2);

            labelStyle                 = new NTextStyle();
            labelStyle.FillStyle       = new NGradientFillStyle(Color.Red, Color.DarkRed);
            labelStyle.FontStyle.Style = FontStyle.Bold;
            m_FirstHorizontalSection.LabelTextStyle = labelStyle;

            // configure the second horizontal section
            m_SecondHorizontalSection       = new NScaleSectionStyle();
            m_SecondHorizontalSection.Range = new NRange1DD(14, 18);
            m_SecondHorizontalSection.SetShowAtWall(ChartWallType.Back, true);
            m_SecondHorizontalSection.SetShowAtWall(ChartWallType.Floor, true);
            m_SecondHorizontalSection.RangeFillStyle       = new NColorFillStyle(Color.FromArgb(60, Color.Green));
            m_SecondHorizontalSection.MajorGridStrokeStyle = new NStrokeStyle(Color.Green);
            m_SecondHorizontalSection.MajorTickStrokeStyle = new NStrokeStyle(Color.DarkGreen);
            m_SecondHorizontalSection.MinorTickStrokeStyle = new NStrokeStyle(1, Color.Green, LinePattern.Dot, 0, 2);

            labelStyle                 = new NTextStyle();
            labelStyle.FillStyle       = new NGradientFillStyle(Color.Green, Color.DarkGreen);
            labelStyle.FontStyle.Style = FontStyle.Bold;
            m_SecondHorizontalSection.LabelTextStyle = labelStyle;

            // configure the first vertical section
            m_FirstVerticalSection       = new NScaleSectionStyle();
            m_FirstVerticalSection.Range = new NRange1DD(20, 40);
            m_FirstVerticalSection.SetShowAtWall(ChartWallType.Back, true);
            m_FirstVerticalSection.SetShowAtWall(ChartWallType.Left, true);
            m_FirstVerticalSection.RangeFillStyle       = new NColorFillStyle(Color.FromArgb(60, Color.Blue));
            m_FirstVerticalSection.MajorGridStrokeStyle = new NStrokeStyle(Color.Blue);
            m_FirstVerticalSection.MajorTickStrokeStyle = new NStrokeStyle(Color.DarkBlue);
            m_FirstVerticalSection.MinorTickStrokeStyle = new NStrokeStyle(1, Color.Blue, LinePattern.Dot, 0, 2);

            labelStyle                            = new NTextStyle();
            labelStyle.FillStyle                  = new NGradientFillStyle(Color.Blue, Color.DarkBlue);
            labelStyle.FontStyle.Style            = FontStyle.Bold;
            m_FirstVerticalSection.LabelTextStyle = labelStyle;

            // configure the second vertical section
            m_SecondVerticalSection       = new NScaleSectionStyle();
            m_SecondVerticalSection.Range = new NRange1DD(70, 90);
            m_SecondVerticalSection.SetShowAtWall(ChartWallType.Back, true);
            m_SecondVerticalSection.SetShowAtWall(ChartWallType.Left, true);
            m_SecondVerticalSection.RangeFillStyle       = new NColorFillStyle(Color.FromArgb(60, Color.Orange));
            m_SecondVerticalSection.MajorGridStrokeStyle = new NStrokeStyle(Color.Orange);
            m_SecondVerticalSection.MajorTickStrokeStyle = new NStrokeStyle(Color.DarkOrange);
            m_SecondVerticalSection.MinorTickStrokeStyle = new NStrokeStyle(1, Color.Orange, LinePattern.Dot, 0, 2);

            labelStyle                             = new NTextStyle();
            labelStyle.FillStyle                   = new NGradientFillStyle(Color.Orange, Color.DarkOrange);
            labelStyle.FontStyle.Style             = FontStyle.Bold;
            m_SecondVerticalSection.LabelTextStyle = labelStyle;

            ShowFirstHorizontalSectionCheck.Checked  = true;
            ShowSecondHorizontalSectionCheck.Checked = true;
            ShowFirstVerticalSectionCheck.Checked    = true;
            ShowSecondVerticalSectionCheck.Checked   = true;
        }