Exemple #1
0
        private NRadialGaugePanel CreateRadialGauge(NKnobIndicator knobIndicator)
        {
            // create the radial gauge
            NRadialGaugePanel radialGauge = new NRadialGaugePanel();

            radialGauge.Size             = new NSizeL(new NLength(0), new NLength(50, NRelativeUnit.ParentPercentage));
            radialGauge.ContentAlignment = ContentAlignment.MiddleCenter;
            radialGauge.DockMode         = PanelDockMode.Fill;
            radialGauge.SweepAngle       = 270;
            radialGauge.BeginAngle       = -225;
            radialGauge.CapStyle.Visible = false;

            radialGauge.Indicators.Add(knobIndicator);

            // configure scale
            NGaugeAxis axis = (NGaugeAxis)radialGauge.Axes[0];
            NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator;

            scale.SetPredefinedScaleStyle(PredefinedScaleStyle.PresentationNoStroke);
            scale.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 12, System.Drawing.FontStyle.Italic);
            scale.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.Black);
            scale.LabelStyle.Angle             = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0);
            scale.MinorTickCount               = 4;
            scale.RulerStyle.BorderStyle.Width = new NLength(0);
            scale.RulerStyle.FillStyle         = new NColorFillStyle(Color.DarkGray);

            return(radialGauge);
        }
        protected NRadialGaugePanel CreateGaugePanel()
        {
            // create the radial gauge
            NRadialGaugePanel radialGauge = new NRadialGaugePanel();

            radialGauge.ContentAlignment    = ContentAlignment.BottomRight;
            radialGauge.BackgroundFillStyle = new NAdvancedGradientFillStyle(AdvancedGradientScheme.WhiteOnBlack, 0);
            radialGauge.BorderStyle         = new NEdgeBorderStyle(BorderShape.Auto);
            radialGauge.PaintEffect         = new NGlassEffectStyle();

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

            axis.Anchor = new NDockGaugeAxisAnchor(GaugeAxisDockZone.Top, true, RulerOrientation.Right, 0, 100);
            axis.Range  = new NRange1DD(0, 400);

            NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator;

            scale.SetPredefinedScaleStyle(PredefinedScaleStyle.PresentationNoStroke);
            scale.LabelFitModes        = new LabelFitMode[0];
            scale.MinorTickCount       = 4;
            scale.RulerStyle.FillStyle = new NColorFillStyle(Color.FromArgb(40, Color.WhiteSmoke));
            scale.LabelStyle.TextStyle.FontStyle.EmSize = new NLength(6);
            scale.MinTickDistance = new NLength(15);

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

            return(radialGauge);
        }
Exemple #3
0
        private NRadialGaugePanel CreateGauge()
        {
            NRadialGaugePanel radialGauge = new NRadialGaugePanel();

            // create gauge panel
            radialGauge.AutoBorder = RadialGaugeAutoBorder.Circle;
            radialGauge.BeginAngle = 130;
            radialGauge.SweepAngle = 280;
            radialGauge.DockMode   = PanelDockMode.Fill;

            // apply paint effects
            radialGauge.PaintEffect = new NGlassEffectStyle();
            radialGauge.BorderStyle = new NEdgeBorderStyle(BorderShape.Auto);

            // Configure the axis
            NGaugeAxis axis = (NGaugeAxis)radialGauge.Axes[0];
            NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator;

            scale.SetPredefinedScaleStyle(PredefinedScaleStyle.Presentation);
            scale.LabelFitModes                  = new LabelFitMode[0];
            scale.LabelStyle.Angle               = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0, false);
            scale.MinorTickCount                 = 2;
            scale.RulerStyle.BorderStyle.Width   = new NLength(0);
            scale.RulerStyle.FillStyle           = new NColorFillStyle(Color.FromArgb(125, Color.LightGray));
            scale.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 10, FontStyle.Bold);

            // add needle value indicator
            radialGauge.Indicators.Add(new NNeedleValueIndicator());

            return(radialGauge);
        }
        private void PredefinedScaleStyleComboBox_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            NStandardScaleConfigurator scale = (NStandardScaleConfigurator)m_Axis.ScaleConfigurator;

            scale.SetPredefinedScaleStyle((PredefinedScaleStyle)PredefinedScaleStyleComboBox.SelectedIndex);
            InitFormControls();

            nChartControl1.Refresh();
        }
        private void ConfigureAxis(NGaugeAxis axis)
        {
            NStandardScaleConfigurator configurator = (NStandardScaleConfigurator)axis.ScaleConfigurator;

            configurator.SetPredefinedScaleStyle(PredefinedScaleStyle.Scientific);
            configurator.LabelStyle.TextStyle.FillStyle      = new NColorFillStyle(Color.White);
            configurator.LabelStyle.TextStyle.FontStyle      = new NFontStyle("Times New Roman", 10, System.Drawing.FontStyle.Italic | System.Drawing.FontStyle.Bold);
            configurator.OuterMajorTickStyle.LineStyle.Color = Color.White;
            configurator.OuterMinorTickStyle.LineStyle.Color = Color.White;
            configurator.RulerStyle.BorderStyle.Color        = Color.White;
            configurator.MinorTickCount = 4;
        }
Exemple #6
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);
        }
        private NRadialGaugePanel CreateGaugePanel(string labelText)
        {
            // create the radial gauge
            NRadialGaugePanel radialGauge = new NRadialGaugePanel();

            radialGauge.Size                = new NSizeL(new NLength(32, NRelativeUnit.ParentPercentage), new NLength(100, NRelativeUnit.ParentPercentage));
            radialGauge.BoundsMode          = BoundsMode.Fit;
            radialGauge.BeginAngle          = -180;
            radialGauge.SweepAngle          = 180;
            radialGauge.ContentAlignment    = ContentAlignment.BottomRight;
            radialGauge.BorderStyle         = new NEdgeBorderStyle(BorderShape.Auto);
            radialGauge.AutoBorder          = RadialGaugeAutoBorder.CutCircle;
            radialGauge.BackgroundFillStyle = new NColorFillStyle(Color.FromArgb(125, Color.White));

            // apply effects
            NGelEffectStyle gelEffect = new NGelEffectStyle(PaintEffectShape.RoundedRect);

            gelEffect.CornerRounding = new NLength(10);
            gelEffect.Margins        = new NMarginsL(new NLength(0), new NLength(0), new NLength(0), new NLength(60, NRelativeUnit.ParentPercentage));
            radialGauge.PaintEffect  = gelEffect;

            // apply margins in order to leave room for the label
            radialGauge.Margins = new NMarginsL(2, 2, 2, 20);

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

            // apply anchor
            NDockGaugeAxisAnchor anchor = new NDockGaugeAxisAnchor(GaugeAxisDockZone.Top, false);

            anchor.RulerOrientation            = RulerOrientation.Right;
            anchor.SynchronizeRulerOrientation = false;
            axis.Anchor = anchor;

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

            NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator;

            scale.SetPredefinedScaleStyle(PredefinedScaleStyle.Presentation);
            scale.LabelFitModes  = new LabelFitMode[0];
            scale.MinorTickCount = 2;
            scale.RulerStyle.BorderStyle.Width   = new NLength(0);
            scale.RulerStyle.FillStyle           = new NColorFillStyle(Color.FromArgb(125, Color.LightGray));
            scale.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 6, FontStyle.Bold);

            radialGauge.ChildPanels.Add(CreateGaugeLabel(labelText));

            return(radialGauge);
        }
        private NBackgroundDecoratorPanel CreateStatusMeterPanel(string labelText, NPointL location, NRangeIndicator rangeIndicator)
        {
            NBackgroundDecoratorPanel backgroundPanel = new NBackgroundDecoratorPanel();

            backgroundPanel.Location = location;
            backgroundPanel.Size     = new NSizeL(new NLength(80, NRelativeUnit.ParentPercentage),
                                                  new NLength(20, NRelativeUnit.ParentPercentage));

            NImageFrameStyle imageFrameStyle = new NImageFrameStyle(PredefinedImageFrame.Embed);

            imageFrameStyle.BackgroundColor            = Color.Transparent;
            imageFrameStyle.ShadowStyle.Type           = ShadowType.None;
            imageFrameStyle.FillStyle                  = new NColorFillStyle(Color.Transparent);
            backgroundPanel.BackgroundStyle.FillStyle  = new NColorFillStyle(Color.White);
            backgroundPanel.BackgroundStyle.FrameStyle = imageFrameStyle;

            NDockPanel contentPanel = new NDockPanel();

            contentPanel.DockMargins = new NMarginsL(new NLength(15), new NLength(3), new NLength(15), new NLength(3));
            contentPanel.DockMode    = PanelDockMode.Fill;
            backgroundPanel.ChildPanels.Add(contentPanel);

            NLabel label = new NLabel();

            label.DockMode         = PanelDockMode.Bottom;
            label.Text             = labelText;
            label.ContentAlignment = ContentAlignment.MiddleLeft;
            label.DockMargins      = new NMarginsL(new NLength(0), new NLength(0), new NLength(0), new NLength(0));
            label.BoundsMode       = BoundsMode.Fit;
            contentPanel.ChildPanels.Add(label);

            NLinearGaugePanel linearGauge = new NLinearGaugePanel();

            linearGauge.Indicators.Add(rangeIndicator);
            linearGauge.DockMode    = PanelDockMode.Fill;
            linearGauge.DockMargins = new NMarginsL(new NLength(15), new NLength(0), new NLength(15), new NLength(0));

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

            axis.Anchor = new NModelGaugeAxisAnchor();
            NStandardScaleConfigurator configurator = (NStandardScaleConfigurator)axis.ScaleConfigurator;

            configurator.SetPredefinedScaleStyle(PredefinedScaleStyle.Scientific);
            contentPanel.ChildPanels.Add(linearGauge);

            return(backgroundPanel);
        }
Exemple #9
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);
        }
        public override void Create()
        {
            nChartControl1.Panels.Clear();

            // set a chart title
            NLabel header = new NLabel("Gauge Axis Ruler Size");

            header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic);
            header.ContentAlignment    = ContentAlignment.BottomRight;
            header.Location            = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage));

            nChartControl1.Panels.Add(header);

            // create the radial gauge
            m_RadialGauge                     = new NRadialGaugePanel();
            m_RadialGauge.BorderStyle         = new NEdgeBorderStyle(BorderShape.Auto);
            m_RadialGauge.ContentAlignment    = ContentAlignment.MiddleCenter;
            m_RadialGauge.Location            = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(50, NRelativeUnit.ParentPercentage));
            m_RadialGauge.Size                = new NSizeL(new NLength(70, NRelativeUnit.ParentPercentage), new NLength(70, NRelativeUnit.ParentPercentage));
            m_RadialGauge.BackgroundFillStyle = new NGradientFillStyle(Color.DarkGray, Color.Black);
            NGelEffectStyle gelEffect = new NGelEffectStyle(PaintEffectShape.Ellipse);

            gelEffect.Margins = new NMarginsL(new NLength(0), new NLength(0), new NLength(0), new NLength(50, NRelativeUnit.ParentPercentage));

            m_RadialGauge.PaintEffect = gelEffect;
            nChartControl1.Panels.Add(m_RadialGauge);

            m_RadialGauge.Axes.Clear();

            // create the first axis
            NGaugeAxis axis1 = new NGaugeAxis();

            axis1.Anchor = new NDockGaugeAxisAnchor(GaugeAxisDockZone.Top, true, 0, 70);
            NStandardScaleConfigurator scale1 = (NStandardScaleConfigurator)axis1.ScaleConfigurator;

            scale1.SetPredefinedScaleStyle(PredefinedScaleStyle.PresentationNoStroke);
            scale1.MinorTickCount                 = 3;
            scale1.RulerStyle.FillStyle           = new NColorFillStyle(Color.FromArgb(40, Color.White));
            scale1.OuterMajorTickStyle.FillStyle  = new NColorFillStyle(Color.Orange);
            scale1.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 12, System.Drawing.FontStyle.Bold);
            scale1.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.White);
            scale1.LabelStyle.Angle               = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0);

            m_RadialGauge.Axes.Add(axis1);

            // create the second axis
            NGaugeAxis axis2 = new NGaugeAxis();

            axis2.Anchor = new NDockGaugeAxisAnchor(GaugeAxisDockZone.Top, false, 75, 95);
            NStandardScaleConfigurator scale2 = (NStandardScaleConfigurator)axis2.ScaleConfigurator;

            scale2.SetPredefinedScaleStyle(PredefinedScaleStyle.PresentationNoStroke);
            scale2.MinorTickCount                 = 3;
            scale2.RulerStyle.FillStyle           = new NColorFillStyle(Color.FromArgb(40, Color.White));
            scale2.OuterMajorTickStyle.FillStyle  = new NColorFillStyle(Color.Blue);
            scale2.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 12, System.Drawing.FontStyle.Bold);
            scale2.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.White);
            scale2.LabelStyle.Angle               = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0);

            m_RadialGauge.Axes.Add(axis2);

            // add indicators
            NRangeIndicator rangeIndicator = new NRangeIndicator();

            rangeIndicator.Value             = 50;
            rangeIndicator.FillStyle         = new NGradientFillStyle(Color.Orange, Color.Red);
            rangeIndicator.StrokeStyle.Width = new NLength(0);
            rangeIndicator.OffsetFromScale   = new NLength(3);
            rangeIndicator.BeginWidth        = new NLength(6);
            rangeIndicator.EndWidth          = new NLength(12);
            m_RadialGauge.Indicators.Add(rangeIndicator);

            NNeedleValueIndicator needleValueIndicator1 = new NNeedleValueIndicator();

            needleValueIndicator1.Value                   = 79;
            needleValueIndicator1.Shape.FillStyle         = new NGradientFillStyle(GradientStyle.Vertical, GradientVariant.Variant2, Color.White, Color.Red);
            needleValueIndicator1.Shape.StrokeStyle.Color = Color.Red;
            needleValueIndicator1.Axis            = axis1;
            needleValueIndicator1.OffsetFromScale = new NLength(2);
            m_RadialGauge.Indicators.Add(needleValueIndicator1);
            m_RadialGauge.SweepAngle = 360;

            NNeedleValueIndicator needleValueIndicator2 = new NNeedleValueIndicator();

            needleValueIndicator2.Value                   = 79;
            needleValueIndicator2.Shape.FillStyle         = new NGradientFillStyle(GradientStyle.Vertical, GradientVariant.Variant2, Color.White, Color.Blue);
            needleValueIndicator2.Shape.StrokeStyle.Color = Color.Blue;
            needleValueIndicator2.Axis            = axis2;
            needleValueIndicator2.OffsetFromScale = new NLength(2);
            m_RadialGauge.Indicators.Add(needleValueIndicator2);

            RedAxisPercentScrollBar.Value = 70;
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                WebExamplesUtilities.FillComboWithValues(RedAxisPercentDropDownList, 10, 70, 10);
                RedAxisPercentDropDownList.SelectedIndex = 6;
            }

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

            // set a chart title
            NLabel header = new NLabel("Gauge Axis Ruler Size");

            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(3, NRelativeUnit.ParentPercentage),
                                          new NLength(2, NRelativeUnit.ParentPercentage));
            nChartControl1.Panels.Add(header);

            // create the radial gauge
            m_RadialGauge                     = new NRadialGaugePanel();
            m_RadialGauge.BorderStyle         = new NEdgeBorderStyle(BorderShape.Auto);
            m_RadialGauge.ContentAlignment    = ContentAlignment.MiddleCenter;
            m_RadialGauge.Location            = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(52, NRelativeUnit.ParentPercentage));
            m_RadialGauge.Size                = new NSizeL(new NLength(90, NRelativeUnit.ParentPercentage), new NLength(85, NRelativeUnit.ParentPercentage));
            m_RadialGauge.BackgroundFillStyle = new NGradientFillStyle(Color.DarkGray, Color.Black);
            NGelEffectStyle gelEffect = new NGelEffectStyle(PaintEffectShape.Ellipse);

            gelEffect.Margins = new NMarginsL(new NLength(0), new NLength(0), new NLength(0), new NLength(50, NRelativeUnit.ParentPercentage));

            m_RadialGauge.PaintEffect = gelEffect;
            nChartControl1.Panels.Add(m_RadialGauge);

            m_RadialGauge.Axes.Clear();

            // create the first axis
            NGaugeAxis axis1 = new NGaugeAxis();

            axis1.Anchor = new NDockGaugeAxisAnchor(GaugeAxisDockZone.Top, true, 0, 70);
            NStandardScaleConfigurator scale1 = (NStandardScaleConfigurator)axis1.ScaleConfigurator;

            scale1.SetPredefinedScaleStyle(PredefinedScaleStyle.PresentationNoStroke);
            scale1.MinorTickCount                 = 3;
            scale1.RulerStyle.FillStyle           = new NColorFillStyle(Color.FromArgb(40, Color.White));
            scale1.OuterMajorTickStyle.FillStyle  = new NColorFillStyle(Color.Orange);
            scale1.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 10, FontStyle.Bold);
            scale1.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.White);
            scale1.LabelStyle.Angle               = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0);

            m_RadialGauge.Axes.Add(axis1);

            // create the second axis
            NGaugeAxis axis2 = new NGaugeAxis();

            axis2.Anchor = new NDockGaugeAxisAnchor(GaugeAxisDockZone.Top, false, 75, 95);
            NStandardScaleConfigurator scale2 = (NStandardScaleConfigurator)axis2.ScaleConfigurator;

            scale2.SetPredefinedScaleStyle(PredefinedScaleStyle.PresentationNoStroke);
            scale2.MinorTickCount                 = 3;
            scale2.RulerStyle.FillStyle           = new NColorFillStyle(Color.FromArgb(40, Color.White));
            scale2.OuterMajorTickStyle.FillStyle  = new NColorFillStyle(Color.Blue);
            scale2.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 10, FontStyle.Bold);
            scale2.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.White);
            scale2.LabelStyle.Angle               = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0);

            m_RadialGauge.Axes.Add(axis2);

            // add indicators
            NRangeIndicator rangeIndicator = new NRangeIndicator();

            rangeIndicator.Value             = 50;
            rangeIndicator.FillStyle         = new NGradientFillStyle(Color.Orange, Color.Red);
            rangeIndicator.StrokeStyle.Width = new NLength(0);
            rangeIndicator.OffsetFromScale   = new NLength(3);
            rangeIndicator.BeginWidth        = new NLength(6);
            rangeIndicator.EndWidth          = new NLength(12);
            m_RadialGauge.Indicators.Add(rangeIndicator);

            NNeedleValueIndicator needleValueIndicator1 = new NNeedleValueIndicator();

            needleValueIndicator1.Value                   = 79;
            needleValueIndicator1.Shape.FillStyle         = new NGradientFillStyle(GradientStyle.Vertical, GradientVariant.Variant2, Color.White, Color.Red);
            needleValueIndicator1.Shape.StrokeStyle.Color = Color.Red;
            needleValueIndicator1.Axis            = axis1;
            needleValueIndicator1.OffsetFromScale = new NLength(2);
            m_RadialGauge.Indicators.Add(needleValueIndicator1);
            m_RadialGauge.SweepAngle = 360;

            NNeedleValueIndicator needleValueIndicator2 = new NNeedleValueIndicator();

            needleValueIndicator2.Value                   = 79;
            needleValueIndicator2.Shape.FillStyle         = new NGradientFillStyle(GradientStyle.Vertical, GradientVariant.Variant2, Color.White, Color.Blue);
            needleValueIndicator2.Shape.StrokeStyle.Color = Color.Blue;
            needleValueIndicator2.Axis            = axis2;
            needleValueIndicator2.OffsetFromScale = new NLength(-2);
            m_RadialGauge.Indicators.Add(needleValueIndicator2);

            axis1.Anchor = new NDockGaugeAxisAnchor(GaugeAxisDockZone.Top, true, 0, (float)Convert.ToDecimal(RedAxisPercentDropDownList.SelectedValue) - 5);
            axis2.Anchor = new NDockGaugeAxisAnchor(GaugeAxisDockZone.Top, false, (float)Convert.ToDecimal(RedAxisPercentDropDownList.SelectedValue), 95);
        }
        public override void Create()
        {
            nChartControl1.Panels.Clear();

            // set a chart title
            NLabel header = new NLabel("Radial Gauge Indicators");

            header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic);
            header.ContentAlignment    = ContentAlignment.BottomRight;
            header.Location            = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage));

            nChartControl1.Panels.Add(header);

            // create the radial gauge
            m_RadialGauge                     = new NRadialGaugePanel();
            m_RadialGauge.PaintEffect         = new NGlassEffectStyle();
            m_RadialGauge.BorderStyle         = new NEdgeBorderStyle(BorderShape.Auto);
            m_RadialGauge.ContentAlignment    = ContentAlignment.MiddleCenter;
            m_RadialGauge.Location            = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(55, NRelativeUnit.ParentPercentage));
            m_RadialGauge.Size                = new NSizeL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage));
            m_RadialGauge.BackgroundFillStyle = new NGradientFillStyle(Color.DarkGray, Color.Black);

            // configure scale
            NGaugeAxis axis = (NGaugeAxis)m_RadialGauge.Axes[0];
            NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator;

            scale.SetPredefinedScaleStyle(PredefinedScaleStyle.Presentation);
            scale.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 12, System.Drawing.FontStyle.Bold);
            scale.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.White);
            scale.LabelStyle.Angle             = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 90);
            scale.MinorTickCount               = 4;
            scale.RulerStyle.BorderStyle.Width = new NLength(0);
            scale.RulerStyle.FillStyle         = new NColorFillStyle(Color.DarkGray);

            // add radial gauge indicators
            m_Indicator1                   = new NRangeIndicator();
            m_Indicator1.Value             = 20;
            m_Indicator1.FillStyle         = new NGradientFillStyle(GradientStyle.StartToEnd, GradientVariant.Variant1, Color.Yellow, Color.Red);
            m_Indicator1.StrokeStyle.Color = Color.DarkBlue;
            m_Indicator1.EndWidth          = new NLength(20);
            m_RadialGauge.Indicators.Add(m_Indicator1);

            m_Indicator2                         = new NNeedleValueIndicator();
            m_Indicator2.Value                   = 79;
            m_Indicator2.Shape.FillStyle         = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red);
            m_Indicator2.Shape.StrokeStyle.Color = Color.Red;
            m_RadialGauge.Indicators.Add(m_Indicator2);
            m_RadialGauge.SweepAngle = 270;

            // add radial gauge
            nChartControl1.Panels.Add(m_RadialGauge);

            // create and configure a numeric display attached to the radial gauge
            m_NumericDisplay                      = new NNumericDisplayPanel();
            m_NumericDisplay.Location             = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(70, NRelativeUnit.ParentPercentage));
            m_NumericDisplay.ContentAlignment     = ContentAlignment.TopCenter;
            m_NumericDisplay.SegmentWidth         = new NLength(2, NGraphicsUnit.Point);
            m_NumericDisplay.SegmentGap           = new NLength(1, NGraphicsUnit.Point);
            m_NumericDisplay.CellSize             = new NSizeL(new NLength(15, NGraphicsUnit.Point), new NLength(30, NGraphicsUnit.Point));
            m_NumericDisplay.DecimalCellSize      = new NSizeL(new NLength(10, NGraphicsUnit.Point), new NLength(20, NGraphicsUnit.Point));
            m_NumericDisplay.ShowDecimalSeparator = false;
            m_NumericDisplay.CellAlignment        = VertAlign.Top;
            m_NumericDisplay.BackgroundFillStyle  = new NColorFillStyle(Color.DimGray);
            m_NumericDisplay.LitFillStyle         = new NGradientFillStyle(Color.Lime, Color.Green);
            m_NumericDisplay.CellCountMode        = DisplayCellCountMode.Fixed;
            m_NumericDisplay.CellCount            = 6;
            m_NumericDisplay.Padding              = new NMarginsL(6, 3, 6, 3);
            m_RadialGauge.ChildPanels.Add(m_NumericDisplay);

            // create a sunken border around the display
            NEdgeBorderStyle borderStyle = new NEdgeBorderStyle(BorderShape.RoundedRect);

            borderStyle.OuterBevelWidth  = new NLength(0);
            borderStyle.MiddleBevelWidth = new NLength(0);
            m_NumericDisplay.BorderStyle = borderStyle;

            // init form controls

            NExampleHelpers.BindComboToItemSource(SweepAngleComboBox, -360, 360, 10);
            SweepAngleComboBox.SelectedItem = (int)m_RadialGauge.SweepAngle;

            NExampleHelpers.BindComboToItemSource(BeginAngleComboBox, -360, 360, 10);
            BeginAngleComboBox.SelectedItem = (int)m_RadialGauge.BeginAngle;

            NExampleHelpers.FillComboWithEnumValues(ValueIndicatorShapeComboBox, typeof(SmartShape1D));
            ValueIndicatorShapeComboBox.SelectedIndex = (int)SmartShape1D.Arrow2;

            NExampleHelpers.BindComboToItemSource(ValueIndicatorComboBox, 0, 100, 1);
            ValueIndicatorComboBox.SelectedItem = (int)m_Indicator2.Value;

            NExampleHelpers.BindComboToItemSource(RangeIndicatorValueComboBox, 0, 100, 5);
            RangeIndicatorValueComboBox.SelectedItem = (int)m_Indicator1.Value;

            NExampleHelpers.FillComboWithEnumValues(RangeIndicatorOriginModeComboBox, typeof(OriginMode));
            RangeIndicatorOriginModeComboBox.SelectedIndex = 0;

            NExampleHelpers.BindComboToItemSource(NeedleWidthComboBox, -20, 60, 5);
            NeedleWidthComboBox.SelectedItem = (int)m_Indicator2.Width.Value;

            NExampleHelpers.BindComboToItemSource(RangeIndicatorOriginComboBox, 0, 100, 5);
            RangeIndicatorOriginComboBox.SelectedItem = (int)m_Indicator1.Origin;
        }
Exemple #13
0
        public override void Initialize()
        {
            nChartControl1.Panels.Clear();

            // set a chart title
            NLabel header = new NLabel("Gauge Indicator Value Dampening");

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

            nChartControl1.Panels.Add(header);

            // create the radial gauge
            m_RadialGauge                     = new NRadialGaugePanel();
            m_RadialGauge.PaintEffect         = new NGlassEffectStyle();
            m_RadialGauge.BorderStyle         = new NEdgeBorderStyle(BorderShape.Auto);
            m_RadialGauge.ContentAlignment    = ContentAlignment.MiddleCenter;
            m_RadialGauge.Location            = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(55, NRelativeUnit.ParentPercentage));
            m_RadialGauge.Size                = new NSizeL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage));
            m_RadialGauge.BackgroundFillStyle = new NGradientFillStyle(Color.DarkGray, Color.Black);

            // configure scale
            NGaugeAxis axis = (NGaugeAxis)m_RadialGauge.Axes[0];
            NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator;

            scale.SetPredefinedScaleStyle(PredefinedScaleStyle.Presentation);
            scale.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 12, FontStyle.Bold);
            scale.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.White);
            scale.LabelStyle.Angle             = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0);
            scale.MinorTickCount               = 4;
            scale.RulerStyle.BorderStyle.Width = new NLength(0);
            scale.RulerStyle.FillStyle         = new NColorFillStyle(Color.DarkGray);

            // add radial gauge indicators
            m_Indicator1                   = new NRangeIndicator();
            m_Indicator1.Value             = 20;
            m_Indicator1.FillStyle         = new NGradientFillStyle(Color.Yellow, Color.Red);
            m_Indicator1.StrokeStyle.Color = Color.DarkBlue;
            m_Indicator1.EndWidth          = new NLength(20);
            m_RadialGauge.Indicators.Add(m_Indicator1);

            m_Indicator2                         = new NNeedleValueIndicator();
            m_Indicator2.Value                   = 79;
            m_Indicator2.Shape.FillStyle         = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red);
            m_Indicator2.Shape.StrokeStyle.Color = Color.Red;
            m_RadialGauge.Indicators.Add(m_Indicator2);
            m_RadialGauge.SweepAngle = 270;

            // add radial gauge
            nChartControl1.Panels.Add(m_RadialGauge);

            // create and configure a numeric display attached to the radial gauge
            m_NumericDisplay                      = new NNumericDisplayPanel();
            m_NumericDisplay.Location             = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(70, NRelativeUnit.ParentPercentage));
            m_NumericDisplay.ContentAlignment     = ContentAlignment.TopCenter;
            m_NumericDisplay.SegmentWidth         = new NLength(2, NGraphicsUnit.Point);
            m_NumericDisplay.SegmentGap           = new NLength(1, NGraphicsUnit.Point);
            m_NumericDisplay.CellSize             = new NSizeL(new NLength(15, NGraphicsUnit.Point), new NLength(30, NGraphicsUnit.Point));
            m_NumericDisplay.DecimalCellSize      = new NSizeL(new NLength(10, NGraphicsUnit.Point), new NLength(20, NGraphicsUnit.Point));
            m_NumericDisplay.ShowDecimalSeparator = false;
            m_NumericDisplay.CellAlignment        = VertAlign.Top;
            m_NumericDisplay.BackgroundFillStyle  = new NColorFillStyle(Color.DimGray);
            m_NumericDisplay.LitFillStyle         = new NGradientFillStyle(Color.Lime, Color.Green);
            m_NumericDisplay.CellCountMode        = DisplayCellCountMode.Fixed;
            m_NumericDisplay.CellCount            = 6;
            m_NumericDisplay.Padding              = new NMarginsL(6, 3, 6, 3);
            m_RadialGauge.ChildPanels.Add(m_NumericDisplay);

            // create a sunken border around the display
            NEdgeBorderStyle borderStyle = new NEdgeBorderStyle(BorderShape.RoundedRect);

            borderStyle.OuterBevelWidth  = new NLength(0);
            borderStyle.MiddleBevelWidth = new NLength(0);
            m_NumericDisplay.BorderStyle = borderStyle;

            // init form controls
            EnableValueDampeningCheckBox.Checked = true;
            DampeningIntervalUpDown.Value        = 50;
            DampeningStepsUpDown.Value           = 10;


            m_Timer.Interval = 200;
            m_Timer.Start();
        }
        public override void Initialize(NThinChartControl control)
        {
            control.BackgroundStyle.FrameStyle.Visible = false;
            control.Panels.Clear();

            // set a chart title
            NLabel header = new NLabel("Indicator Drag Tool");

            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(3, NRelativeUnit.ParentPercentage),
                                          new NLength(2, NRelativeUnit.ParentPercentage));
            control.Panels.Add(header);

            // create the radial gauge
            NRadialGaugePanel m_RadialGauge = new NRadialGaugePanel();

            m_RadialGauge.BorderStyle         = new NEdgeBorderStyle(BorderShape.Auto);
            m_RadialGauge.PaintEffect         = new NGlassEffectStyle();
            m_RadialGauge.ContentAlignment    = ContentAlignment.MiddleCenter;
            m_RadialGauge.Location            = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(52, NRelativeUnit.ParentPercentage));
            m_RadialGauge.Size                = new NSizeL(new NLength(90, NRelativeUnit.ParentPercentage), new NLength(85, NRelativeUnit.ParentPercentage));
            m_RadialGauge.BackgroundFillStyle = new NGradientFillStyle(Color.DarkGray, Color.Black);

            // configure scale
            NGaugeAxis axis = (NGaugeAxis)m_RadialGauge.Axes[0];
            NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator;

            scale.SetPredefinedScaleStyle(PredefinedScaleStyle.Presentation);
            scale.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 10, FontStyle.Bold);
            scale.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.White);
            scale.LabelStyle.Angle             = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0);
            scale.MinorTickCount               = 4;
            scale.RulerStyle.BorderStyle.Width = new NLength(0);
            scale.RulerStyle.FillStyle         = new NColorFillStyle(Color.DarkGray);

            // add radial gauge indicators
            NRangeIndicator rangeIndicator = new NRangeIndicator();

            rangeIndicator.Value             = 20;
            rangeIndicator.FillStyle         = new NGradientFillStyle(Color.Yellow, Color.Red);
            rangeIndicator.StrokeStyle.Color = Color.DarkBlue;
            rangeIndicator.EndWidth          = new NLength(20);

            NInteractivityStyle interactivityStyle1 = new NInteractivityStyle();

            interactivityStyle1.Tooltip.Text = "Drag Me";
//              interactivityStyle1.ClientMouseEventAttribute.Tag = "Indicator[" + m_Indicator1.UniqueId.ToString() + "]";

            rangeIndicator.InteractivityStyle = interactivityStyle1;

            m_RadialGauge.Indicators.Add(rangeIndicator);

            NNeedleValueIndicator needleIndicator = new NNeedleValueIndicator();

            needleIndicator.Shape.FillStyle         = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red);
            needleIndicator.Shape.StrokeStyle.Color = Color.Red;
            m_RadialGauge.Indicators.Add(needleIndicator);
            m_RadialGauge.SweepAngle = 270;

            // add radial gauge
            control.Panels.Add(m_RadialGauge);

            // create and config ure a numeric display attached to the radial gauge
            NNumericDisplayPanel numericDisplay = new NNumericDisplayPanel();

            numericDisplay.Location                = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(70, NRelativeUnit.ParentPercentage));
            numericDisplay.ContentAlignment        = ContentAlignment.TopCenter;
            numericDisplay.DisplayStyle            = DisplayStyle.SevenSegmentRounded;
            numericDisplay.SegmentWidth            = new NLength(2, NGraphicsUnit.Point);
            numericDisplay.SegmentGap              = new NLength(1, NGraphicsUnit.Point);
            numericDisplay.CellSize                = new NSizeL(new NLength(9, NGraphicsUnit.Point), new NLength(19, NGraphicsUnit.Point));
            numericDisplay.ShowDecimalSeparator    = true;
            numericDisplay.ShowLeadingZeros        = true;
            numericDisplay.EnableDecimalFormatting = false;
            numericDisplay.CellCountMode           = DisplayCellCountMode.Auto;
            numericDisplay.CellCount               = 6;
            numericDisplay.ValueFormatter          = new NNumericValueFormatter("00.00");

            numericDisplay.CellAlignment       = VertAlign.Top;
            numericDisplay.BackgroundFillStyle = new NColorFillStyle(Color.DimGray);
            numericDisplay.LitFillStyle        = new NGradientFillStyle(Color.Lime, Color.Green);
            numericDisplay.CellCountMode       = DisplayCellCountMode.Fixed;
            numericDisplay.CellCount           = 6;
            numericDisplay.Padding             = new NMarginsL(3, 2, 3, 2);
            m_RadialGauge.ChildPanels.Add(numericDisplay);

            // create a sunken border around the display
            NEdgeBorderStyle borderStyle = new NEdgeBorderStyle(BorderShape.RoundedRect);

            borderStyle.OuterBevelWidth  = new NLength(0);
            borderStyle.MiddleBevelWidth = new NLength(0);
            numericDisplay.BorderStyle   = borderStyle;

            NIndicatorDragTool indicatorDragTool = new NIndicatorDragTool();

            indicatorDragTool.IndicatorDragCallback = new IndicatorDragCallback();
            control.Controller.Tools.Add(indicatorDragTool);
            control.Controller.Tools.Add(new NTooltipTool());

            NRangeIndicator range = (NRangeIndicator)control.Gauges[0].Indicators[0];

            range.AllowDragging = true;

            if (range.AllowDragging)
            {
                range.InteractivityStyle.Tooltip.Text = "Drag Me";
            }
            else
            {
                range.InteractivityStyle.Tooltip.Text = range.Range.End.ToString();
            }

            NNeedleValueIndicator needle = (NNeedleValueIndicator)control.Gauges[0].Indicators[1];

            needle.AllowDragging = true;

            if (needle.AllowDragging)
            {
                needle.InteractivityStyle.Tooltip.Text = "Drag Me";
            }
            else
            {
                needle.InteractivityStyle.Tooltip.Text = needle.Value.ToString();
            }
        }
        public override void Create()
        {
            nChartControl1.Panels.Clear();

            // set a chart title
            NLabel header = new NLabel("Gauge Indicator Palette");

            header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic);
            header.ContentAlignment    = ContentAlignment.BottomRight;
            header.Location            = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage));

            nChartControl1.Panels.Add(header);

            // create the radial gauge
            NRadialGaugePanel m_RadialGauge = new NRadialGaugePanel();

            m_RadialGauge.PaintEffect         = new NGlassEffectStyle();
            m_RadialGauge.BorderStyle         = new NEdgeBorderStyle(BorderShape.Auto);
            m_RadialGauge.ContentAlignment    = ContentAlignment.MiddleCenter;
            m_RadialGauge.Location            = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(55, NRelativeUnit.ParentPercentage));
            m_RadialGauge.Size                = new NSizeL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage));
            m_RadialGauge.BackgroundFillStyle = new NGradientFillStyle(Color.DarkGray, Color.Black);

            // configure scale
            NGaugeAxis axis = (NGaugeAxis)m_RadialGauge.Axes[0];
            NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator;

            scale.SetPredefinedScaleStyle(PredefinedScaleStyle.Presentation);
            scale.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 12, System.Drawing.FontStyle.Bold);
            scale.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.White);
            scale.LabelStyle.Angle             = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0);
            scale.MinorTickCount               = 4;
            scale.RulerStyle.BorderStyle.Width = new NLength(0);
            scale.RulerStyle.FillStyle         = new NColorFillStyle(Color.DarkGray);

            // add radial gauge indicators
            m_RangeIndicator                   = new NRangeIndicator();
            m_RangeIndicator.Value             = 20;
            m_RangeIndicator.FillStyle         = new NGradientFillStyle(Color.Yellow, Color.Red);
            m_RangeIndicator.StrokeStyle.Color = Color.DarkBlue;
            m_RangeIndicator.EndWidth          = new NLength(20);
            m_RadialGauge.Indicators.Add(m_RangeIndicator);

            m_NeedleIndicator                         = new NNeedleValueIndicator();
            m_NeedleIndicator.Value                   = 79;
            m_NeedleIndicator.Shape.FillStyle         = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red);
            m_NeedleIndicator.Shape.StrokeStyle.Color = Color.Red;
            m_RadialGauge.Indicators.Add(m_NeedleIndicator);
            m_RadialGauge.SweepAngle = 270;

            // add radial gauge
            nChartControl1.Panels.Add(m_RadialGauge);

            m_Palette = new NPalette();
            m_Palette.SmoothPalette = true;
            m_Palette.PositiveColor = Color.Green;
            m_Palette.NegativeColor = Color.Red;

            m_NeedleIndicator.Palette         = (NPalette)m_Palette.Clone();
            m_RangeIndicator.Palette          = (NPalette)m_Palette.Clone();
            m_RangeIndicator.PaletteColorMode = PaletteColorMode.Spread;

            NExampleHelpers.FillComboWithEnumValues(PaletteSpreadModeComboBox, typeof(PaletteColorMode));
            PaletteSpreadModeComboBox.SelectedIndex = (int)PaletteColorMode.Spread;

            EnableIndicatorPaletteCheckBox.IsChecked = true;
            IndicatorsValueScrollBar.Value           = m_NeedleIndicator.Value;
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;
            nChartControl1.Panels.Clear();

            // set a chart title
            NLabel header = new NLabel("Gauge Axis Scale Appearance");

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

            // create the radial gauge
            NRadialGaugePanel radialGauge = new NRadialGaugePanel();

            radialGauge.ContentAlignment    = ContentAlignment.MiddleCenter;
            radialGauge.Location            = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(52, NRelativeUnit.ParentPercentage));
            radialGauge.Size                = new NSizeL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(85, NRelativeUnit.ParentPercentage));
            radialGauge.BackgroundFillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Gray);
            radialGauge.BorderStyle         = new NEdgeBorderStyle(BorderShape.Auto);
            radialGauge.PaintEffect         = new NGlassEffectStyle();

            nChartControl1.Panels.Add(radialGauge);

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

            scale.MinorTickCount = 3;

            NRangeIndicator indicator1 = new NRangeIndicator();

            indicator1.Value             = 80;
            indicator1.OriginMode        = OriginMode.ScaleMax;
            indicator1.FillStyle         = new NColorFillStyle(Color.Red);
            indicator1.StrokeStyle.Color = Color.DarkRed;
            radialGauge.Indicators.Add(indicator1);

            NNeedleValueIndicator indicator2 = new NNeedleValueIndicator();

            indicator2.Value                   = 79;
            indicator2.Shape.FillStyle         = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red);
            indicator2.Shape.StrokeStyle.Color = Color.Red;
            radialGauge.Indicators.Add(indicator2);
            radialGauge.SweepAngle = 270;

            if (!IsPostBack)
            {
                WebExamplesUtilities.FillComboWithEnumValues(ScaleStyleDropDownList, typeof(PredefinedScaleStyle));
                ScaleStyleDropDownList.SelectedIndex = 0;
            }

            PredefinedScaleStyle scaleStyle = (PredefinedScaleStyle)ScaleStyleDropDownList.SelectedIndex;

            scale.SetPredefinedScaleStyle(scaleStyle);
            switch (scaleStyle)
            {
            case PredefinedScaleStyle.Standard:
            case PredefinedScaleStyle.Scientific:
                break;

            case PredefinedScaleStyle.Presentation:
                scale.RulerStyle.FillStyle                = new NGradientFillStyle(Color.White, Color.CadetBlue);
                scale.OuterMajorTickStyle.FillStyle       = new NGradientFillStyle(Color.White, Color.Green);
                scale.OuterMajorTickStyle.LineStyle.Color = Color.DarkGreen;
                break;

            case PredefinedScaleStyle.PresentationNoStroke:
                scale.RulerStyle.FillStyle          = new NGradientFillStyle(Color.White, Color.CadetBlue);
                scale.OuterMajorTickStyle.FillStyle = new NGradientFillStyle(Color.White, Color.Green);
                break;

            case PredefinedScaleStyle.Watch:
                scale.OuterMajorTickStyle.FillStyle       = new NGradientFillStyle(Color.White, Color.Green);
                scale.OuterMajorTickStyle.LineStyle.Color = Color.DarkGreen;
                break;

            case PredefinedScaleStyle.Ruler:
                break;
            }
        }
        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);
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;
            nChartControl1.Panels.Clear();

            // set a chart title
            NLabel header = new NLabel("Radial Gauge Indicators");

            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(3, NRelativeUnit.ParentPercentage),
                                          new NLength(2, NRelativeUnit.ParentPercentage));
            nChartControl1.Panels.Add(header);

            // create the radial gauge
            m_RadialGauge                     = new NRadialGaugePanel();
            m_RadialGauge.BorderStyle         = new NEdgeBorderStyle(BorderShape.Auto);
            m_RadialGauge.PaintEffect         = new NGlassEffectStyle();
            m_RadialGauge.ContentAlignment    = ContentAlignment.MiddleCenter;
            m_RadialGauge.Location            = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(52, NRelativeUnit.ParentPercentage));
            m_RadialGauge.Size                = new NSizeL(new NLength(90, NRelativeUnit.ParentPercentage), new NLength(85, NRelativeUnit.ParentPercentage));
            m_RadialGauge.BackgroundFillStyle = new NGradientFillStyle(Color.DarkGray, Color.Black);

            // configure scale
            NGaugeAxis axis = (NGaugeAxis)m_RadialGauge.Axes[0];
            NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator;

            scale.SetPredefinedScaleStyle(PredefinedScaleStyle.Presentation);
            scale.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 10, FontStyle.Bold);
            scale.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.White);
            scale.LabelStyle.Angle             = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0);
            scale.MinorTickCount               = 4;
            scale.RulerStyle.BorderStyle.Width = new NLength(0);
            scale.RulerStyle.FillStyle         = new NColorFillStyle(Color.DarkGray);

            // add radial gauge indicators
            m_Indicator1                   = new NRangeIndicator();
            m_Indicator1.Value             = 20;
            m_Indicator1.FillStyle         = new NGradientFillStyle(Color.Yellow, Color.Red);
            m_Indicator1.StrokeStyle.Color = Color.DarkBlue;
            m_Indicator1.EndWidth          = new NLength(20);
            m_RadialGauge.Indicators.Add(m_Indicator1);

            m_Indicator2 = new NNeedleValueIndicator();
            m_Indicator2.Shape.FillStyle         = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red);
            m_Indicator2.Shape.StrokeStyle.Color = Color.Red;
            m_RadialGauge.Indicators.Add(m_Indicator2);
            m_RadialGauge.SweepAngle = 270;

            // add radial gauge
            nChartControl1.Panels.Add(m_RadialGauge);

            // create and configure a numeric display attached to the radial gauge
            m_NumericDisplay                      = new NNumericDisplayPanel();
            m_NumericDisplay.Location             = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(70, NRelativeUnit.ParentPercentage));
            m_NumericDisplay.ContentAlignment     = ContentAlignment.TopCenter;
            m_NumericDisplay.DisplayStyle         = DisplayStyle.SevenSegmentRounded;
            m_NumericDisplay.SegmentWidth         = new NLength(2, NGraphicsUnit.Point);
            m_NumericDisplay.SegmentGap           = new NLength(1, NGraphicsUnit.Point);
            m_NumericDisplay.CellSize             = new NSizeL(new NLength(10, NGraphicsUnit.Point), new NLength(20, NGraphicsUnit.Point));
            m_NumericDisplay.DecimalCellSize      = new NSizeL(new NLength(7, NGraphicsUnit.Point), new NLength(15, NGraphicsUnit.Point));
            m_NumericDisplay.ShowDecimalSeparator = false;
            m_NumericDisplay.CellAlignment        = VertAlign.Top;
            m_NumericDisplay.BackgroundFillStyle  = new NColorFillStyle(Color.DimGray);
            m_NumericDisplay.LitFillStyle         = new NGradientFillStyle(Color.Lime, Color.Green);
            m_NumericDisplay.CellCountMode        = DisplayCellCountMode.Fixed;
            m_NumericDisplay.CellCount            = 6;
            m_NumericDisplay.Padding              = new NMarginsL(3, 2, 3, 2);
            m_RadialGauge.ChildPanels.Add(m_NumericDisplay);

            // create a sunken border around the display
            NEdgeBorderStyle borderStyle = new NEdgeBorderStyle(BorderShape.RoundedRect);

            borderStyle.OuterBevelWidth  = new NLength(0);
            borderStyle.MiddleBevelWidth = new NLength(0);
            m_NumericDisplay.BorderStyle = borderStyle;

            // init form controls
            if (!Page.IsPostBack)
            {
                WebExamplesUtilities.FillComboWithValues(ValueIndicatorDropDownList, 0, 100, 10);
                WebExamplesUtilities.FillComboWithValues(RangeIndicatorValueDropDownList, 0, 100, 10);
                WebExamplesUtilities.FillComboWithValues(RangeIndicatorOriginDropDownList, 0, 100, 10);

                WebExamplesUtilities.FillComboWithValues(SweepAngleDropDownList, -360, 360, 45);
                WebExamplesUtilities.FillComboWithValues(BeginAngleDropDownList, -360, 360, 45);

                SweepAngleDropDownList.SelectedValue = m_RadialGauge.SweepAngle.ToString();
                BeginAngleDropDownList.SelectedValue = m_RadialGauge.BeginAngle.ToString();

                WebExamplesUtilities.FillComboWithEnumValues(ValueIndicatorShapeDropDownList, typeof(SmartShape1D));
                ValueIndicatorShapeDropDownList.SelectedIndex = (int)SmartShape1D.Triangle;

                ValueIndicatorDropDownList.SelectedValue      = "20";
                RangeIndicatorValueDropDownList.SelectedValue = m_Indicator1.Value.ToString();

                WebExamplesUtilities.FillComboWithEnumValues(RangeIndicatorOriginModeDropDownList, typeof(OriginMode));
                RangeIndicatorOriginModeDropDownList.SelectedIndex = 0;
                RangeIndicatorOriginDropDownList.SelectedIndex     = 0;
            }

            m_Indicator1.Value       = Convert.ToDouble(RangeIndicatorValueDropDownList.SelectedValue);
            m_Indicator1.Origin      = Convert.ToDouble(RangeIndicatorOriginDropDownList.SelectedValue);
            m_Indicator1.OriginMode  = (OriginMode)RangeIndicatorOriginModeDropDownList.SelectedIndex;
            m_RadialGauge.BeginAngle = (float)Convert.ToDecimal(BeginAngleDropDownList.SelectedValue);
            m_RadialGauge.SweepAngle = (float)Convert.ToDecimal(SweepAngleDropDownList.SelectedValue);

            N1DSmartShapeFactory factory = new N1DSmartShapeFactory(m_Indicator2.Shape.FillStyle, m_Indicator2.Shape.StrokeStyle, m_Indicator2.Shape.ShadowStyle);

            m_Indicator2.Shape     = factory.CreateShape((SmartShape1D)ValueIndicatorShapeDropDownList.SelectedIndex);
            m_Indicator2.Value     = Convert.ToDouble(ValueIndicatorDropDownList.SelectedValue);
            m_NumericDisplay.Value = m_Indicator2.Value;

            if (m_Indicator1.OriginMode != OriginMode.Custom)
            {
                RangeIndicatorOriginDropDownList.Enabled = false;
            }
            else
            {
                RangeIndicatorOriginDropDownList.Enabled = true;
            }
        }
Exemple #19
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!nChartControl1.Initialized)
            {
                nChartControl1.BackgroundStyle.FrameStyle.Visible = false;
                nChartControl1.Panels.Clear();
                nChartControl1.StateId = "Gauge1";

                // set a chart title
                NLabel header = new NLabel("Custom Commands");
                header.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
                header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;
                header.ContentAlignment           = ContentAlignment.BottomRight;
                header.DockMode = PanelDockMode.Top;
                header.Location = new NPointL(new NLength(3, NRelativeUnit.ParentPercentage),
                                              new NLength(2, NRelativeUnit.ParentPercentage));
                nChartControl1.Panels.Add(header);

                // create the radial gauge
                NRadialGaugePanel radialGauge = new NRadialGaugePanel();
                nChartControl1.Panels.Add(radialGauge);
                radialGauge.DockMode         = PanelDockMode.Fill;
                radialGauge.ContentAlignment = ContentAlignment.MiddleCenter;
                radialGauge.SweepAngle       = 270;
                radialGauge.BeginAngle       = -225;
                radialGauge.CapStyle.Visible = false;

                // configure the gauge scale
                NGaugeAxis axis = (NGaugeAxis)radialGauge.Axes[0];
                NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator;

                scale.SetPredefinedScaleStyle(PredefinedScaleStyle.PresentationNoStroke);
                scale.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 12, FontStyle.Italic);
                scale.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.Black);
                scale.LabelStyle.Angle             = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0);
                scale.MinorTickCount               = 4;
                scale.RulerStyle.BorderStyle.Width = new NLength(0);
                scale.RulerStyle.FillStyle         = new NColorFillStyle(Color.DarkGray);

                // create the knob indicator
                NKnobIndicator knobIndicator = new NKnobIndicator();
                knobIndicator.OffsetFromScale = new NLength(-3);

                // apply fill style to the marker
                NAdvancedGradientFillStyle advancedGradientFill = new NAdvancedGradientFillStyle();
                advancedGradientFill.BackgroundColor = Color.Red;
                advancedGradientFill.Points.Add(new NAdvancedGradientPoint(Color.White, 20, 20, 0, 100, AGPointShape.Circle));
                knobIndicator.MarkerShape.FillStyle = advancedGradientFill;

                // add the knob indicator to the indicators collection of the gauge
                radialGauge.Indicators.Add(knobIndicator);

                // update the knob marker shape
                N2DSmartShapeFactory factory = new N2DSmartShapeFactory(knobIndicator.MarkerShape.FillStyle, knobIndicator.MarkerShape.StrokeStyle, knobIndicator.MarkerShape.ShadowStyle);
                knobIndicator.MarkerShape = factory.CreateShape(SmartShape2D.Ellipse);
                // update the outer rim style
                knobIndicator.OuterRimStyle.Pattern = CircularRimPattern.RoundHandleSmall;
                // update the inner rim style
                knobIndicator.InnerRimStyle.Pattern = CircularRimPattern.Circle;

                NIndicatorDragTool indicatorDragTool = new NIndicatorDragTool();
                indicatorDragTool.IndicatorDragCallback = new IndicatorDragCallback();
                nChartControl1.Controller.Tools.Add(indicatorDragTool);
            }
        }