Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NStackPanel stack = new NStackPanel();

            NStackPanel controlStack = new NStackPanel();

            controlStack.Direction = ENHVDirection.LeftToRight;
            stack.Add(controlStack);

            m_LinearGauge                 = new NLinearGauge();
            m_LinearGauge.Orientation     = ENLinearGaugeOrientation.Vertical;
            m_LinearGauge.PreferredSize   = defaultLinearVerticalGaugeSize;
            m_LinearGauge.BackgroundFill  = new NStockGradientFill(NColor.DarkGray, NColor.Black);
            m_LinearGauge.CapEffect       = new NGelCapEffect();
            m_LinearGauge.Border          = base.CreateBorder();
            m_LinearGauge.Padding         = new NMargins(20);
            m_LinearGauge.BorderThickness = new NMargins(6);

            controlStack.Add(m_LinearGauge);

            NMarkerValueIndicator markerIndicator = new NMarkerValueIndicator();

            m_LinearGauge.Indicators.Add(markerIndicator);

            InitSections(m_LinearGauge);

            // create the radial gauge
            m_RadialGauge = new NRadialGauge();
            m_RadialGauge.PreferredSize = defaultRadialGaugeSize;
            NEdgeDialRim dialRim = new NEdgeDialRim();

            dialRim.OuterBevelWidth           = 2.0;
            dialRim.InnerBevelWidth           = 2.0;
            dialRim.MiddleBevelWidth          = 2.0;
            m_RadialGauge.Dial                = new NDial(ENDialShape.CutCircle, dialRim);
            m_RadialGauge.Dial.BackgroundFill = new NStockGradientFill(NColor.DarkGray, NColor.Black);
            m_RadialGauge.InnerRadius         = 15;

            NGlassCapEffect glassCapEffect = new NGlassCapEffect();

            glassCapEffect.LightDirection = new NAngle(130, NUnit.Degree);
            glassCapEffect.EdgeOffset     = 0;
            glassCapEffect.EdgeDepth      = 0.30;
            m_RadialGauge.CapEffect       = glassCapEffect;

            controlStack.Add(m_RadialGauge);

            NNeedleValueIndicator needleIndicator = new NNeedleValueIndicator();

            m_RadialGauge.Indicators.Add(needleIndicator);
            m_RadialGauge.SweepAngle = new NAngle(180, NUnit.Degree);

            InitSections(m_RadialGauge);

            m_DataFeedTimer       = new NTimer();
            m_DataFeedTimer.Tick += new Function(OnDataFeedTimerTick);
            m_DataFeedTimer.Start();

            return(stack);
        }
Esempio n. 2
0
        private void CreateLinearGauge()
        {
            m_LinearGauge                 = new NLinearGauge();
            m_LinearGauge.Orientation     = ENLinearGaugeOrientation.Vertical;
            m_LinearGauge.PreferredWidth  = 200;
            m_LinearGauge.PreferredHeight = 300;
            m_LinearGauge.CapEffect       = new NGlassCapEffect();
            m_LinearGauge.Border          = base.CreateBorder();
            m_LinearGauge.Padding         = new NMargins(20);
            m_LinearGauge.BorderThickness = new NMargins(6);
            m_LinearGauge.BackgroundFill  = new NStockGradientFill(NColor.DarkGray, NColor.Black);

            m_LinearGauge.Axes.Clear();
        }
Esempio n. 3
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NStackPanel stack = new NStackPanel();

            NStackPanel controlStack = new NStackPanel();

            controlStack.Padding = new NMargins(20);
            stack.Add(controlStack);

            m_LinearGauge               = new NLinearGauge();
            m_LinearGauge.Padding       = new NMargins(30);
            m_LinearGauge.PreferredSize = defaultLinearHorizontalGaugeSize;
            controlStack.Add(m_LinearGauge);

            NGaugeAxis axis = new NGaugeAxis();

            m_LinearGauge.Axes.Add(axis);
            axis.Anchor = new NDockGaugeAxisAnchor(ENGaugeAxisDockZone.Top, true, ENScaleOrientation.Left, 0, 100);

            axis = new NGaugeAxis();
            m_LinearGauge.Axes.Add(axis);
            axis.Anchor = new NDockGaugeAxisAnchor(ENGaugeAxisDockZone.Top, true, ENScaleOrientation.Left, 0, 50);

            // create the radial gauge
            m_RadialGauge = new NRadialGauge();
            m_RadialGauge.PreferredSize     = defaultRadialGaugeSize;
            m_RadialGauge.NeedleCap.Visible = false;
            controlStack.Add(m_RadialGauge);

            // create the radial gauge
            m_RadialGauge.SweepAngle      = new NAngle(270, NUnit.Degree);
            m_RadialGauge.BeginAngle      = new NAngle(-90, NUnit.Degree);
            m_RadialGauge.PreferredHeight = 400;

            // configure the axis
            axis = new NGaugeAxis();
            m_RadialGauge.Axes.Add(axis);
            axis.Range  = new NRange(0, 100);
            axis.Anchor = new NDockGaugeAxisAnchor(ENGaugeAxisDockZone.Top, true, ENScaleOrientation.Left, 0.0f, 100.0f);

            // configure the axis
            axis = new NGaugeAxis();
            m_RadialGauge.Axes.Add(axis);
            axis.Range  = new NRange(0, 100);
            axis.Anchor = new NDockGaugeAxisAnchor(ENGaugeAxisDockZone.Top, true, ENScaleOrientation.Left, 0.0f, 50.0f);

            NNeedleValueIndicator indicator = new NNeedleValueIndicator();

            indicator.ScaleAxis       = axis;
            indicator.OffsetFromScale = 20;
            m_RadialGauge.Indicators.Add(indicator);

            NMarkerValueIndicator markerValueIndicator = new NMarkerValueIndicator(10);

            markerValueIndicator.Shape = ENScaleValueMarkerShape.Bar;
            m_RadialGauge.Indicators.Add(new NMarkerValueIndicator(10));
            m_RadialGauge.Indicators.Add(new NMarkerValueIndicator(90));


            NNeedleValueIndicator needle = new NNeedleValueIndicator();

            needle.Value = 10;
            needle.Shape = ENNeedleShape.Needle4;

            needle.Fill   = new NColorFill(NColor.DarkGreen);
            needle.Stroke = new NStroke(NColor.DarkGreen);

//			radialGauge.Indicators.Add(needle);

            markerValueIndicator.Width  = 20;
            markerValueIndicator.Height = 20;
            markerValueIndicator.Fill   = new NColorFill(NColor.DarkGreen);
            markerValueIndicator.Stroke = new NStroke(1.0, NColor.DarkGreen);


            return(stack);
        }
Esempio n. 4
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NStackPanel stack = new NStackPanel();

            NStackPanel controlStack = new NStackPanel();

            controlStack.Direction = ENHVDirection.LeftToRight;
            stack.Add(controlStack);

            m_LinearGauge                 = new NLinearGauge();
            m_LinearGauge.Orientation     = ENLinearGaugeOrientation.Vertical;
            m_LinearGauge.PreferredSize   = defaultLinearVerticalGaugeSize;
            m_LinearGauge.CapEffect       = new NGelCapEffect();
            m_LinearGauge.Border          = base.CreateBorder();
            m_LinearGauge.Padding         = new NMargins(20);
            m_LinearGauge.BorderThickness = new NMargins(6);
            controlStack.Add(m_LinearGauge);

            // create the background panel
            NAdvancedGradientFill advGradient = new NAdvancedGradientFill();

            advGradient.BackgroundColor = NColor.Black;
            advGradient.Points.Add(new NAdvancedGradientPoint(NColor.LightGray, new NAngle(10, NUnit.Degree), 0.1f, 0, 1.0f, ENAdvancedGradientPointShape.Circle));
            m_LinearGauge.BackgroundFill = advGradient;

            m_LinearGauge.Axes.Clear();
            NGaugeAxis axis = new NGaugeAxis();

            m_LinearGauge.Axes.Add(axis);
            axis.Anchor = new NModelGaugeAxisAnchor(24.0, ENVerticalAlignment.Center, ENScaleOrientation.Left);

            ConfigureScale((NLinearScale)axis.Scale);

            // add some indicators
            m_LinearGauge.Indicators.Add(new NMarkerValueIndicator(60));

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

            m_RadialGauge.CapEffect = new NGlassCapEffect();
            m_RadialGauge.Dial      = new NDial(ENDialShape.Circle, new NEdgeDialRim());

            // set some background
            advGradient = new NAdvancedGradientFill();
            advGradient.BackgroundColor = NColor.Black;
            advGradient.Points.Add(new NAdvancedGradientPoint(NColor.LightGray, new NAngle(10, NUnit.Degree), 0.1f, 0, 1.0f, ENAdvancedGradientPointShape.Circle));
            m_RadialGauge.Dial.BackgroundFill = advGradient;
            m_RadialGauge.CapEffect           = new NGlassCapEffect(ENCapEffectShape.Ellipse);

            // create the radial gauge
            m_RadialGauge.SweepAngle = new NAngle(270, NUnit.Degree);
            m_RadialGauge.BeginAngle = new NAngle(-90, NUnit.Degree);

            // FIX remove
            axis.Scale.Title.Text = "Axis Title";

            NStandardScale scale = axis.Scale as NStandardScale;

            scale.MajorTickMode   = ENMajorTickMode.AutoMinDistance;
            scale.MinTickDistance = 50;

            // configure the axis
            m_RadialGauge.Axes.Clear();
            axis       = new NGaugeAxis();
            axis.Range = new NRange(0, 100);
            axis.Anchor.ScaleOrientation = ENScaleOrientation.Right;
            axis.Anchor = new NDockGaugeAxisAnchor(ENGaugeAxisDockZone.Top, true, ENScaleOrientation.Right, 0, 100);
            m_RadialGauge.Axes.Add(axis);

            ConfigureScale((NLinearScale)axis.Scale);

            // add some indicators
            NNeedleValueIndicator needle = new NNeedleValueIndicator(60);

            needle.OffsetOriginMode = ENIndicatorOffsetOriginMode.ScaleMiddle;
            needle.OffsetFromScale  = 15;
            m_RadialGauge.Indicators.Add(needle);

            return(stack);
        }
        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);
        }