private NLinearGaugePanel CreateVerticalLinearGauge()
        {
            NLinearGaugePanel linearGauge = new NLinearGaugePanel();

            linearGauge.Orientation = LinearGaugeOrientation.Vertical;

            linearGauge.Location            = new NPointL(new NLength(10, NRelativeUnit.ParentPercentage), new NLength(40, NRelativeUnit.ParentPercentage));
            linearGauge.Size                = new NSizeL(new NLength(60, NGraphicsUnit.Point), new NLength(50, NRelativeUnit.ParentPercentage));
            linearGauge.BorderStyle         = new NEdgeBorderStyle(BorderShape.RoundedRect);
            linearGauge.BackgroundFillStyle = new NGradientFillStyle(Color.DarkGray, Color.Black);

            // add indicators
            m_VertLinearIndicator1                   = new NRangeIndicator();
            m_VertLinearIndicator1.Value             = 10;
            m_VertLinearIndicator1.FillStyle         = new NGradientFillStyle(Color.LightBlue, Color.DarkBlue);
            m_VertLinearIndicator1.StrokeStyle.Color = Color.DarkBlue;
            linearGauge.Indicators.Add(m_VertLinearIndicator1);

            m_VertLinearIndicator2       = new NMarkerValueIndicator();
            m_VertLinearIndicator2.Value = 50;
            linearGauge.Indicators.Add(m_VertLinearIndicator2);

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

            axis.Anchor = new NModelGaugeAxisAnchor();

            ConfigureAxis(axis);

            return(linearGauge);
        }
Exemplo n.º 2
0
        public override void Initialize()
        {
            nChartControl1.Panels.Clear();

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

            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
            NRadialGaugePanel radialGauge = new NRadialGaugePanel();

            radialGauge.Location            = new NPointL(new NLength(10, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage));
            radialGauge.Size                = new NSizeL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage));
            radialGauge.PaintEffect         = new NGlassEffectStyle();
            radialGauge.BorderStyle         = new NEdgeBorderStyle(BorderShape.Auto);
            radialGauge.BackgroundFillStyle = new NAdvancedGradientFillStyle(AdvancedGradientScheme.WhiteOnBlack, 0);

            // configure scale
            NLinearScaleConfigurator scale = ((NGaugeAxis)radialGauge.Axes[0]).ScaleConfigurator as NLinearScaleConfigurator;

            scale.SetPredefinedScaleStyle(PredefinedScaleStyle.PresentationNoStroke);
            scale.LabelFitModes                  = new LabelFitMode[0];
            scale.MinorTickCount                 = 3;
            scale.RulerStyle.FillStyle           = new NColorFillStyle(Color.FromArgb(40, Color.White));
            scale.OuterMajorTickStyle.FillStyle  = new NColorFillStyle(Color.Orange);
            scale.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 12, FontStyle.Bold | FontStyle.Italic);
            scale.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.White);

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

            nChartControl1.Panels.Add(radialGauge);

            m_Indicator1                   = new NRangeIndicator();
            m_Indicator1.Value             = 50;
            m_Indicator1.FillStyle         = new NColorFillStyle(Color.LightBlue);
            m_Indicator1.StrokeStyle.Color = Color.DarkBlue;
            m_Indicator1.EndWidth          = new NLength(20);
            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;
            radialGauge.Indicators.Add(m_Indicator2);
            radialGauge.SweepAngle = 270;

            m_Indicator3       = new NMarkerValueIndicator();
            m_Indicator3.Value = 90;
            radialGauge.Indicators.Add(m_Indicator3);

            nChartControl1.Controller.Tools.Add(new NTooltipTool());

            // init form controls
            UpdateTooltips();
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        void nChartControl1_PreviewMouseMove(object sender, MouseEventArgs e)
        {
            System.Windows.Point p             = e.GetPosition(nChartControl1);
            NHitTestResult       hitTestResult = (NHitTestResult)nChartControl1.HitTest((int)p.X, (int)p.Y);

            switch (hitTestResult.ChartElement)
            {
            case ChartElement.GaugeAxis:
                NGaugeAxis gaugeAxis = hitTestResult.GaugeAxis;
                CurrentElementTextBox.Text = "Gauge Axis Range: [" + gaugeAxis.Range.Begin.ToString() + ", " + gaugeAxis.Range.End.ToString() + "]";
                break;

            case ChartElement.GaugeMarker:
                NMarkerValueIndicator markerValueIndicator = hitTestResult.MarkerValueIndicator;
                CurrentElementTextBox.Text = "Gauge Marker Value: " + markerValueIndicator.Value.ToString();
                break;

            case ChartElement.GaugeNeedle:
                NNeedleValueIndicator needleIndicator = hitTestResult.NeedleValueIndicator;
                CurrentElementTextBox.Text = "Gauge Needle Value: " + needleIndicator.Value.ToString();
                break;

            case ChartElement.GaugeRange:
                NRangeIndicator rangeIndicator = hitTestResult.RangeIndicator;
                CurrentElementTextBox.Text = "Gauge range: [" + rangeIndicator.Range.Begin.ToString() + ", " + rangeIndicator.Range.End.ToString() + "]";
                break;

            default:
                CurrentElementTextBox.Text = "";
                break;
            }
        }
Exemplo n.º 5
0
        private void ChartControl_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            NHitTestResult hitTestResult = nChartControl1.HitTest(e.X, e.Y);

            switch (hitTestResult.ChartElement)
            {
            case ChartElement.GaugeAxis:
                NGaugeAxis gaugeAxis = hitTestResult.GaugeAxis;
                CurrentElementTextBox.Text = "Gauge Axis Range: [" + gaugeAxis.Range.Begin.ToString() + ", " + gaugeAxis.Range.End.ToString() + "]";
                break;

            case ChartElement.GaugeMarker:
                NMarkerValueIndicator markerValueIndicator = hitTestResult.MarkerValueIndicator;
                CurrentElementTextBox.Text = "Gauge Marker Value: " + markerValueIndicator.Value.ToString();
                break;

            case ChartElement.GaugeNeedle:
                NNeedleValueIndicator needleIndicator = hitTestResult.NeedleValueIndicator;
                CurrentElementTextBox.Text = "Gauge Needle Value: " + needleIndicator.Value.ToString();
                break;

            case ChartElement.GaugeRange:
                NRangeIndicator rangeIndicator = hitTestResult.RangeIndicator;
                CurrentElementTextBox.Text = "Gauge range: [" + rangeIndicator.Range.Begin.ToString() + ", " + rangeIndicator.Range.End.ToString() + "]";
                break;

            default:
                CurrentElementTextBox.Text = "";
                break;
            }
        }
        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);
        }
Exemplo n.º 7
0
        protected override NWidget CreateExampleContent()
        {
            NStackPanel stack = new NStackPanel();

            NStackPanel controlStack = new NStackPanel();

            stack.Add(controlStack);

            NRadialGauge radialGauge = new NRadialGauge();

            radialGauge.PreferredSize       = defaultRadialGaugeSize;
            radialGauge.CapEffect           = new NGlassCapEffect();
            radialGauge.Dial                = new NDial(ENDialShape.Circle, new NEdgeDialRim());
            radialGauge.Dial.BackgroundFill = NAdvancedGradientFill.Create(ENAdvancedGradientColorScheme.Ocean2, 0);

            // configure scale
            NGaugeAxis axis = new NGaugeAxis();

            radialGauge.Axes.Add(axis);
            NLinearScale scale = axis.Scale as NLinearScale;

            scale.SetPredefinedScale(ENPredefinedScaleStyle.PresentationNoStroke);
            scale.Labels.OverlapResolveLayouts = new NDomArray <ENLevelLabelsLayout>();
            scale.MinorTickCount              = 3;
            scale.Ruler.Fill                  = new NColorFill(NColor.FromColor(NColor.White, 0.4f));
            scale.OuterMajorTicks.Fill        = new NColorFill(NColor.Orange);
            scale.Labels.Style.TextStyle.Font = new NFont("Arimo", 12.0, ENFontStyle.Bold | ENFontStyle.Italic);
            scale.Labels.Style.TextStyle.Fill = new NColorFill(NColor.White);

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

            controlStack.Add(radialGauge);

            m_Indicator1               = new NRangeIndicator();
            m_Indicator1.Value         = 50;
            m_Indicator1.Fill          = new NColorFill(NColor.LightBlue);
            m_Indicator1.Stroke.Color  = NColor.DarkBlue;
            m_Indicator1.EndWidth      = 20;
            m_Indicator1.AllowDragging = true;
            radialGauge.Indicators.Add(m_Indicator1);

            m_Indicator2               = new NNeedleValueIndicator();
            m_Indicator2.Value         = 79;
            m_Indicator2.Fill          = new NStockGradientFill(ENGradientStyle.Horizontal, ENGradientVariant.Variant1, NColor.White, NColor.Red);
            m_Indicator2.Stroke.Color  = NColor.Red;
            m_Indicator2.AllowDragging = true;
            radialGauge.Indicators.Add(m_Indicator2);

            m_Indicator3               = new NMarkerValueIndicator();
            m_Indicator3.Value         = 90;
            m_Indicator3.AllowDragging = true;
            radialGauge.Indicators.Add(m_Indicator3);

            radialGauge.SweepAngle = new NAngle(270.0, NUnit.Degree);

            return(stack);
        }
        public override void Initialize()
        {
            nChartControl1.Panels.Clear();

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

            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
            NRadialGaugePanel radialGauge = new NRadialGaugePanel();

            radialGauge.Location            = new NPointL(new NLength(10, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage));
            radialGauge.Size                = new NSizeL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage));
            radialGauge.BackgroundFillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Gray);
            radialGauge.PaintEffect         = new NGlassEffectStyle();
            radialGauge.BorderStyle         = new NEdgeBorderStyle(BorderShape.Auto);
            radialGauge.PositionChildPanelsInContentBounds = true;

            nChartControl1.Panels.Add(radialGauge);

            m_Axis = (NGaugeAxis)radialGauge.Axes[0];
            NStandardScaleConfigurator scale = (NStandardScaleConfigurator)m_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;

            m_Updating = true;

            MinorTickShapeComboBox.FillFromEnum(typeof(ScaleTickShape));
            MajorTickShapeComboBox.FillFromEnum(typeof(ScaleTickShape));
            PredefinedScaleStyleComboBox.FillFromEnum(typeof(PredefinedScaleStyle));
            PredefinedScaleStyleComboBox.SelectedIndex = (int)PredefinedScaleStyle.Standard;

            m_Updating = false;

            InitFormControls();
        }
Exemplo n.º 9
0
        protected override NWidget CreateExampleContent()
        {
            NStackPanel stack = new NStackPanel();

            stack.HorizontalPlacement = Layout.ENHorizontalPlacement.Left;

            NStackPanel controlStack = new NStackPanel();

            stack.Add(controlStack);

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

            m_RadialGauge.PreferredSize       = defaultRadialGaugeSize;
            m_RadialGauge.CapEffect           = new NGlassCapEffect();
            m_RadialGauge.Dial                = new NDial(ENDialShape.CutCircle, new NEdgeDialRim());
            m_RadialGauge.Dial.BackgroundFill = new NStockGradientFill(NColor.DarkGray, NColor.Black);

            // configure scale
            NGaugeAxis axis = new NGaugeAxis();

            m_RadialGauge.Axes.Add(axis);

            NLinearScale scale = (NLinearScale)axis.Scale;

            scale.SetPredefinedScale(ENPredefinedScaleStyle.Presentation);
            scale.Labels.Style.TextStyle.Font = new NFont("Arimo", 10, ENFontStyle.Bold);
            scale.Labels.Style.TextStyle.Fill = new NColorFill(NColor.White);
            scale.Labels.Style.Angle          = new NScaleLabelAngle(ENScaleLabelAngleMode.Scale, 90.0);
            scale.MinorTickCount     = 4;
            scale.Ruler.Stroke.Width = 0;
            scale.Ruler.Fill         = new NColorFill(NColor.DarkGray);

            // add radial gauge indicators
            m_RangeIndicator          = new NRangeIndicator();
            m_RangeIndicator.Value    = 20;
            m_RangeIndicator.Palette  = new NTwoColorPalette(NColor.Green, NColor.Red);
            m_RangeIndicator.Stroke   = null;
            m_RangeIndicator.EndWidth = 20;
            m_RadialGauge.Indicators.Add(m_RangeIndicator);

            m_ValueIndicator              = new NNeedleValueIndicator();
            m_ValueIndicator.Value        = 79;
            m_ValueIndicator.Fill         = new NStockGradientFill(ENGradientStyle.Horizontal, ENGradientVariant.Variant1, NColor.White, NColor.Red);
            m_ValueIndicator.Stroke.Color = NColor.Red;

            m_ValueIndicator.OffsetFromCenter = -20;

            m_RadialGauge.Indicators.Add(m_ValueIndicator);
            m_RadialGauge.SweepAngle = new NAngle(270.0, NUnit.Degree);

            // add radial gauge
            controlStack.Add(m_RadialGauge);

            return(stack);
        }
Exemplo n.º 10
0
        private void AddRangeIndicatorToGauge(NGaugePanel gauge)
        {
            // add some indicators
            NRangeIndicator rangeIndicator = new NRangeIndicator(new NRange1DD(75, 100));

            rangeIndicator.FillStyle         = new NColorFillStyle(Color.Red);
            rangeIndicator.StrokeStyle.Width = new NLength(0);
            rangeIndicator.BeginWidth        = new NLength(5);
            rangeIndicator.EndWidth          = new NLength(10);
            rangeIndicator.PaintOrder        = IndicatorPaintOrder.BeforeScale;

            gauge.Indicators.Add(rangeIndicator);
        }
Exemplo n.º 11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="gauge"></param>
        private void AddRangeIndicatorToGauge(NGauge gauge)
        {
            // add some indicators
            NRangeIndicator rangeIndicator = new NRangeIndicator(new NRange(75, 100));

            rangeIndicator.Fill         = new NColorFill(NColor.Red);
            rangeIndicator.Stroke.Width = 0.0;
            rangeIndicator.BeginWidth   = 5.0;
            rangeIndicator.EndWidth     = 10.0;
            rangeIndicator.PaintOrder   = ENIndicatorPaintOrder.BeforeScale;

            gauge.Indicators.Add(rangeIndicator);
        }
Exemplo n.º 12
0
        private NRangeIndicator CreateRangeIndicator(double minValue)
        {
            NRangeIndicator rangeIndicator = new NRangeIndicator();

            rangeIndicator.Value             = minValue;
            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);

            return(rangeIndicator);
        }
Exemplo n.º 13
0
        private void GenerateRandomValue(NRangeIndicator indicator)
        {
            double factor = indicator.Value > 50 ? 6 : 4;
            double value  = indicator.Value + m_Random.Next(10) - factor;

            if (value < 0)
            {
                value = 0;
            }
            else if (value > 100)
            {
                value = 100;
            }

            indicator.Value = value;
        }
Exemplo n.º 14
0
        private NRangeIndicator CreateRangeIndicator(double offsetFromScale)
        {
            NRangeIndicator rangeIndicator = new NRangeIndicator();

            rangeIndicator.Value           = 0;
            rangeIndicator.Stroke          = null;
            rangeIndicator.OffsetFromScale = offsetFromScale;
            rangeIndicator.BeginWidth      = 10;
            rangeIndicator.EndWidth        = 10;

            rangeIndicator.BeginWidth = 10;
            rangeIndicator.EndWidth   = 10;

            // assign palette to the indicator
            NColorValuePalette palette = new NColorValuePalette(new NColorValuePair[] { new NColorValuePair(80, NColor.Green), new NColorValuePair(100, NColor.Yellow), new NColorValuePair(120, NColor.Red) });

            rangeIndicator.Palette = palette;

            return(rangeIndicator);
        }
Exemplo n.º 15
0
        public override void Create()
        {
            m_Random = new Random();
            nChartControl1.Panels.Clear();

            NDigitalClockPanel digitalClock = new NDigitalClockPanel();

            digitalClock.Location = new NPointL(new NLength(10, NRelativeUnit.ParentPercentage), new NLength(5, NRelativeUnit.ParentPercentage));

            nChartControl1.Panels.Add(digitalClock);

            m_Indicator1 = new NRangeIndicator(30);
            m_Indicator2 = new NRangeIndicator(40);
            m_Indicator3 = new NRangeIndicator(50);

            NPanel meter1 = CreateStatusMeterPanel("Battery Meter 1",
                                                   new NPointL(new NLength(10, NRelativeUnit.ParentPercentage),
                                                               new NLength(20, NRelativeUnit.ParentPercentage)),
                                                   m_Indicator1);

            NPanel meter2 = CreateStatusMeterPanel("Battery Meter 2",
                                                   new NPointL(new NLength(10, NRelativeUnit.ParentPercentage),
                                                               new NLength(45, NRelativeUnit.ParentPercentage)),
                                                   m_Indicator2);

            NPanel meter3 = CreateStatusMeterPanel("Battery Meter 3",
                                                   new NPointL(new NLength(10, NRelativeUnit.ParentPercentage),
                                                               new NLength(70, NRelativeUnit.ParentPercentage)),
                                                   m_Indicator3);

            nChartControl1.Panels.Add(meter1);
            nChartControl1.Panels.Add(meter2);
            nChartControl1.Panels.Add(meter3);

            m_Timer          = new Timer();
            m_Timer.Interval = 1000;
            m_Timer.Elapsed += m_Timer_Elapsed;              //+= m_Timer_Tick;
            m_Timer.Start();
        }
        private NRadialGaugePanel CreateRadialGauge()
        {
            // create the radial gauge
            NRadialGaugePanel radialGauge = new NRadialGaugePanel();

            radialGauge.Location            = new NPointL(new NLength(32, NRelativeUnit.ParentPercentage), new NLength(40, NRelativeUnit.ParentPercentage));
            radialGauge.Size                = new NSizeL(new NLength(58, NRelativeUnit.ParentPercentage), new NLength(50, NRelativeUnit.ParentPercentage));
            radialGauge.BackgroundFillStyle = new NGradientFillStyle(Color.DarkGray, Color.Black);
            radialGauge.PaintEffect         = new NGlassEffectStyle();
            radialGauge.BorderStyle         = new NEdgeBorderStyle(BorderShape.Auto);

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

            ConfigureAxis(axis);

            // add some indicators
            m_RadialIndicator1                   = new NRangeIndicator();
            m_RadialIndicator1.Value             = 50;
            m_RadialIndicator1.FillStyle         = new NGradientFillStyle(Color.LightBlue, Color.DarkBlue);
            m_RadialIndicator1.StrokeStyle.Color = Color.DarkBlue;
            m_RadialIndicator1.EndWidth          = new NLength(20);
            radialGauge.Indicators.Add(m_RadialIndicator1);

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

            m_RadialIndicator3       = new NMarkerValueIndicator();
            m_RadialIndicator3.Value = 90;
            radialGauge.Indicators.Add(m_RadialIndicator3);

            return(radialGauge);
        }
        protected override NWidget CreateExampleContent()
        {
            NStackPanel stack = new NStackPanel();

            stack.HorizontalPlacement = Layout.ENHorizontalPlacement.Left;

            // create a linear gauge
            m_LinearGauge = new NLinearGauge();
            stack.Add(m_LinearGauge);
            m_LinearGauge.CapEffect       = new NGelCapEffect();
            m_LinearGauge.Border          = base.CreateBorder();
            m_LinearGauge.Padding         = new NMargins(20);
            m_LinearGauge.BorderThickness = new NMargins(6);
            m_LinearGauge.BackgroundFill  = new NStockGradientFill(NColor.Gray, NColor.Black);
            m_LinearGauge.PreferredSize   = new NSize(400, 150);

            m_LinearGauge.Axes.Clear();

            NRange celsiusRange = new NRange(-40.0, 60.0);

            // add celsius and farenheit axes
            NGaugeAxis celsiusAxis = new NGaugeAxis();

            celsiusAxis.Range  = celsiusRange;
            celsiusAxis.Anchor = new NModelGaugeAxisAnchor(-5, ENVerticalAlignment.Center, ENScaleOrientation.Left, 0.0f, 100.0f);
            m_LinearGauge.Axes.Add(celsiusAxis);

            NGaugeAxis farenheitAxis = new NGaugeAxis();

            farenheitAxis.Range  = new NRange(CelsiusToFarenheit(celsiusRange.Begin), CelsiusToFarenheit(celsiusRange.End));
            farenheitAxis.Anchor = new NModelGaugeAxisAnchor(5, ENVerticalAlignment.Center, ENScaleOrientation.Right, 0.0f, 100.0f);
            m_LinearGauge.Axes.Add(farenheitAxis);

            // configure the scales
            NLinearScale celsiusScale = (NLinearScale)celsiusAxis.Scale;

            ConfigureScale(celsiusScale, "°C");

            celsiusScale.Sections.Add(CreateSection(NColor.Red, NColor.Red, new NRange(40, 60)));
            celsiusScale.Sections.Add(CreateSection(NColor.Blue, NColor.SkyBlue, new NRange(-40, -20)));

            NLinearScale farenheitScale = (NLinearScale)farenheitAxis.Scale;

            ConfigureScale(farenheitScale, "°F");

            farenheitScale.Sections.Add(CreateSection(NColor.Red, NColor.Red, new NRange(CelsiusToFarenheit(40), CelsiusToFarenheit(60))));
            farenheitScale.Sections.Add(CreateSection(NColor.Blue, NColor.SkyBlue, new NRange(CelsiusToFarenheit(-40), CelsiusToFarenheit(-20))));

            // now add two indicators
            m_Indicator1              = new NRangeIndicator();
            m_Indicator1.Value        = 10;
            m_Indicator1.Stroke.Color = NColor.DarkBlue;
            m_Indicator1.Fill         = new NStockGradientFill(ENGradientStyle.Vertical, ENGradientVariant.Variant1, NColor.LightBlue, NColor.Blue);

            m_Indicator1.BeginWidth = 10;
            m_Indicator1.EndWidth   = 10;
            m_LinearGauge.Indicators.Add(m_Indicator1);

            m_Indicator2       = new NMarkerValueIndicator();
            m_Indicator2.Value = 33;
//			m_Indicator2.ShapFillStyle = new NStockGradientFill(ENGradientStyle.Horizontal, ENGradientVariant.Variant1, NColor.White, NColor.Red);
//			m_Indicator2.Shape.StrokeStyle.Color = Color.DarkRed;
            m_LinearGauge.Indicators.Add(m_Indicator2);

            return(stack);
        }
        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)
        {
            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);
        }
Exemplo n.º 20
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 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;
        }
        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 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)
        {
            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;
            }
        }
        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("Linear 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 a linear gauge
            m_LinearGauge = new NLinearGaugePanel();
            nChartControl1.Panels.Add(m_LinearGauge);
            m_LinearGauge.ContentAlignment    = ContentAlignment.MiddleCenter;
            m_LinearGauge.BorderStyle         = new NEdgeBorderStyle(BorderShape.RoundedRect);
            m_LinearGauge.PaintEffect         = new NGelEffectStyle();
            m_LinearGauge.BackgroundFillStyle = new NGradientFillStyle(Color.Gray, Color.Black);

            m_LinearGauge.Axes.Clear();

            NRange1DD celsiusRange = new NRange1DD(-40, 60);

            // add celsius and farenheit axes
            NGaugeAxis celsiusAxis = new NGaugeAxis();

            celsiusAxis.Range  = celsiusRange;
            celsiusAxis.Anchor = new NModelGaugeAxisAnchor(new NLength(-5), VertAlign.Center, RulerOrientation.Left, 0, 100);
            m_LinearGauge.Axes.Add(celsiusAxis);

            NGaugeAxis farenheitAxis = new NGaugeAxis();

            farenheitAxis.Range  = new NRange1DD(CelsiusToFarenheit(celsiusRange.Begin), CelsiusToFarenheit(celsiusRange.End));
            farenheitAxis.Anchor = new NModelGaugeAxisAnchor(new NLength(5), VertAlign.Center, RulerOrientation.Right, 0, 100);
            m_LinearGauge.Axes.Add(farenheitAxis);

            // configure the scales
            NLinearScaleConfigurator celsiusScale = (NLinearScaleConfigurator)celsiusAxis.ScaleConfigurator;

            ConfigureScale(celsiusScale, "°C");
            celsiusScale.Sections.Add(CreateSection(Color.Red, Color.Red, new NRange1DD(40, 60)));
            celsiusScale.Sections.Add(CreateSection(Color.Blue, Color.SkyBlue, new NRange1DD(-40, -20)));

            NLinearScaleConfigurator farenheitScale = (NLinearScaleConfigurator)farenheitAxis.ScaleConfigurator;

            ConfigureScale(farenheitScale, "°F");

            farenheitScale.Sections.Add(CreateSection(Color.Red, Color.Red, new NRange1DD(CelsiusToFarenheit(40), CelsiusToFarenheit(60))));
            farenheitScale.Sections.Add(CreateSection(Color.Blue, Color.SkyBlue, new NRange1DD(CelsiusToFarenheit(-40), CelsiusToFarenheit(-20))));

            // now add two indicators
            m_Indicator1                   = new NRangeIndicator();
            m_Indicator1.Value             = 10;
            m_Indicator1.StrokeStyle.Color = Color.DarkBlue;
            m_Indicator1.FillStyle         = new NGradientFillStyle(GradientStyle.Vertical, GradientVariant.Variant1, Color.LightBlue, Color.Blue);
            m_LinearGauge.Indicators.Add(m_Indicator1);

            m_Indicator2                         = new NMarkerValueIndicator();
            m_Indicator2.Value                   = 33;
            m_Indicator2.Shape.FillStyle         = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red);
            m_Indicator2.Shape.StrokeStyle.Color = Color.DarkRed;
            m_LinearGauge.Indicators.Add(m_Indicator2);

            // init form controls
            if (!Page.IsPostBack)
            {
                WebExamplesUtilities.FillComboWithEnumValues(RangeIndicatorOriginModeDropDownList, typeof(OriginMode));
                RangeIndicatorOriginModeDropDownList.SelectedIndex = 0;

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

                WebExamplesUtilities.FillComboWithEnumValues(GaugeOrientationDropDownList, typeof(LinearGaugeOrientation));
                GaugeOrientationDropDownList.SelectedIndex = 0;

                WebExamplesUtilities.FillComboWithValues(ValueIndicatorDropDownList, -20, 60, 10);
                WebExamplesUtilities.FillComboWithValues(RangeIndicatorValueDropDownList, -20, 60, 10);
                WebExamplesUtilities.FillComboWithValues(RangeIndicatorOriginDropDownList, -20, 60, 10);
                RangeIndicatorOriginDropDownList.SelectedIndex = 5;

                RangeIndicatorValueDropDownList.SelectedValue = m_Indicator1.Value.ToString();
                ValueIndicatorDropDownList.SelectedValue      = m_Indicator2.Value.ToString();
            }

            m_LinearGauge.Orientation = (LinearGaugeOrientation)GaugeOrientationDropDownList.SelectedIndex;

            if (m_LinearGauge.Orientation == LinearGaugeOrientation.Horizontal)
            {
                m_LinearGauge.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(50, NRelativeUnit.ParentPercentage));
                m_LinearGauge.Size     = new NSizeL(new NLength(90, NRelativeUnit.ParentPercentage), new NLength(55, NRelativeUnit.ParentPercentage));
            }
            else
            {
                m_LinearGauge.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(54, NRelativeUnit.ParentPercentage));
                m_LinearGauge.Size     = new NSizeL(new NLength(37, NRelativeUnit.ParentPercentage), new NLength(85, NRelativeUnit.ParentPercentage));
            }
            m_Indicator1.OriginMode = (OriginMode)RangeIndicatorOriginModeDropDownList.SelectedIndex;
            m_Indicator1.Origin     = Convert.ToDouble(RangeIndicatorOriginDropDownList.SelectedValue);
            m_Indicator1.Value      = Convert.ToDouble(RangeIndicatorValueDropDownList.SelectedValue);

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

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

            if (m_Indicator1.OriginMode != OriginMode.Custom)
            {
                RangeIndicatorOriginDropDownList.Enabled = false;
            }
            else
            {
                RangeIndicatorOriginDropDownList.Enabled = true;
            }
        }
        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;
            }
        }
        protected override NWidget CreateExampleContent()
        {
            NStackPanel stack = new NStackPanel();

            NStackPanel controlStack = new NStackPanel();

            stack.Add(controlStack);

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

            controlStack.Add(radialGauge);

            radialGauge.Dial                = new NDial(ENDialShape.Circle, new NEdgeDialRim());
            radialGauge.PreferredSize       = defaultRadialGaugeSize;
            radialGauge.Dial.BackgroundFill = new NStockGradientFill(NColor.DarkGray, NColor.Black);
            radialGauge.CapEffect           = new NGlassCapEffect();

            // configure the axis
            NGaugeAxis axis = new NGaugeAxis();

            radialGauge.Axes.Add(axis);

            NStandardScale scale = (NStandardScale)axis.Scale;

            scale.SetPredefinedScale(ENPredefinedScaleStyle.Scientific);
            scale.Labels.Style.TextStyle.Fill = new NColorFill(NColor.White);
            scale.Labels.Style.TextStyle.Font = new NFont("Tinos", 10, ENFontStyle.Italic | ENFontStyle.Bold);

            scale.OuterMajorTicks.Stroke.Color = NColor.White;
            scale.OuterMajorTicks.Length       = 6;

            scale.OuterMinorTicks.Stroke.Color = NColor.White;
            scale.OuterMinorTicks.Length       = 4;

            scale.Ruler.Stroke.Color = NColor.White;
            scale.MinorTickCount     = 4;

            // add some indicators
            m_RangeIndicator               = new NRangeIndicator();
            m_RangeIndicator.Value         = 50;
            m_RangeIndicator.Palette       = new NTwoColorPalette(NColor.DarkBlue, NColor.LightBlue);
            m_RangeIndicator.Stroke        = null;
            m_RangeIndicator.EndWidth      = 20;
            m_RangeIndicator.AllowDragging = true;
            radialGauge.Indicators.Add(m_RangeIndicator);

            m_NeedleIndicator               = new NNeedleValueIndicator();
            m_NeedleIndicator.Value         = 79;
            m_NeedleIndicator.AllowDragging = true;
            radialGauge.Indicators.Add(m_NeedleIndicator);
            radialGauge.SweepAngle = new NAngle(270, NUnit.Degree);

            m_MarkerIndicator                  = new NMarkerValueIndicator();
            m_MarkerIndicator.Value            = 90;
            m_MarkerIndicator.AllowDragging    = true;
            m_MarkerIndicator.OffsetOriginMode = ENIndicatorOffsetOriginMode.ScaleEnd;
            m_MarkerIndicator.OffsetFromScale  = 0.0;
            radialGauge.Indicators.Add(m_MarkerIndicator);

            return(stack);
        }
        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;
        }
Exemplo n.º 29
0
        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);
        }
Exemplo n.º 30
0
        public override void Create()
        {
            nChartControl1.Panels.Clear();

            // set a chart title
            NLabel header = new NLabel("Gauge Hit Testing");

            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 radialGauge = new NRadialGaugePanel();

            radialGauge.Location            = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(50, NRelativeUnit.ParentPercentage));
            radialGauge.Size                = new NSizeL(new NLength(100, NRelativeUnit.ParentPercentage), new NLength(100, NRelativeUnit.ParentPercentage));
            radialGauge.PaintEffect         = new NGlassEffectStyle();
            radialGauge.BorderStyle         = new NEdgeBorderStyle(BorderShape.Auto);
            radialGauge.BackgroundFillStyle = new NAdvancedGradientFillStyle(AdvancedGradientScheme.WhiteOnBlack, 0);

            radialGauge.Location = new NPointL(new NLength(10, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage));
            radialGauge.Size     = new NSizeL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage));
            radialGauge.PositionChildPanelsInContentBounds = true;

            // configure scale
            NLinearScaleConfigurator scale = ((NGaugeAxis)radialGauge.Axes[0]).ScaleConfigurator as NLinearScaleConfigurator;

            scale.SetPredefinedScaleStyle(PredefinedScaleStyle.PresentationNoStroke);
            scale.LabelFitModes                  = new LabelFitMode[0];
            scale.MinorTickCount                 = 3;
            scale.RulerStyle.FillStyle           = new NColorFillStyle(Color.FromArgb(40, Color.White));
            scale.OuterMajorTickStyle.FillStyle  = new NColorFillStyle(Color.Orange);
            scale.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 12, System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic);
            scale.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.White);

            nChartControl1.Panels.Add(radialGauge);

            NRangeIndicator indicator1 = new NRangeIndicator();

            indicator1.Value             = 50;
            indicator1.FillStyle         = new NColorFillStyle(Color.LightBlue);
            indicator1.StrokeStyle.Color = Color.DarkBlue;
            indicator1.EndWidth          = new NLength(20);
            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;

            NMarkerValueIndicator indicator3 = new NMarkerValueIndicator();

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

            // subscribe for control events
            nChartControl1.PreviewMouseMove      += new MouseEventHandler(nChartControl1_PreviewMouseMove);
            nChartControl1.Settings.RenderSurface = RenderSurface.Bitmap;
            nChartControl1.Controller.Tools.Clear();
        }