예제 #1
0
        /// <summary>
        ///
        /// </summary>
        void OnDataFeedTimerTick()
        {
            // update linear gauge
            NGauge[] gauges = new NGauge[] { m_RadialGauge, m_LinearGauge };

            for (int i = 0; i < gauges.Length; i++)
            {
                NGauge gauge = gauges[i];

                NValueIndicator valueIndicator = (NValueIndicator)gauge.Indicators[0];
                NStandardScale  scale          = (NStandardScale)gauge.Axes[0].Scale;

                NScaleSection blueSection = (NScaleSection)scale.Sections[0];
                NScaleSection redSection  = (NScaleSection)scale.Sections[1];

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

                // FIX: Smart Shapes
                if (blueSection.Range.Contains(valueIndicator.Value))
                {
//					valueIndicator.Shape.FillStyle = new NStockGradientFill(ENGradientStyle.Horizontal, ENGradientVariant.Variant1, NColor.White, NColor.Blue);
//					valueIndicator.Shape.StrokeStyle = new NStrokeStyle(Color.Blue);
                }
                else if (redSection.Range.Contains(valueIndicator.Value))
                {
//					valueIndicator.Shape.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red);
//					valueIndicator.Shape.StrokeStyle = new NStrokeStyle(Color.Red);
                }
                else
                {
//					valueIndicator.Shape.FillStyle = new NColorFillStyle(Color.LightGreen);
//					valueIndicator.Shape.StrokeStyle = new NStrokeStyle(Color.DarkGreen);
                }
            }
        }
예제 #2
0
        private void timer1_Tick(object sender, System.EventArgs e)
        {
            if (nChartControl1.Panels.Count < 3)
            {
                return;
            }

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

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

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

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

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

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

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

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

            nChartControl1.Refresh();
        }