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;
            }
        }
示例#2
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;
            }
        }
示例#3
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);
        }
        private void CreateRadialGauge()
        {
            // create the radial gauge
            m_RadialGauge = new NRadialGaugePanel();
            nChartControl1.Panels.Add(m_RadialGauge);

            // create the radial gauge
            m_RadialGauge.BeginAngle = -225;
            m_RadialGauge.SweepAngle = 270;

            // set some background
            m_RadialGauge.BackgroundFillStyle = new NColorFillStyle(Color.Black);;
            m_RadialGauge.PaintEffect         = new NGlassEffectStyle();
            m_RadialGauge.BorderStyle         = new NEdgeBorderStyle(BorderShape.Auto);

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

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

            ConfigureScale((NLinearScaleConfigurator)axis.ScaleConfigurator);

            // add some indicators
            AddRangeIndicatorToGauge(m_RadialGauge);

            NNeedleValueIndicator needle = new NNeedleValueIndicator(60);

            needle.OffsetFromScale = new NLength(15);
            m_RadialGauge.Indicators.Add(needle);

            LinearGaugeOrientationComboBox.SelectedIndex = 0;
        }
示例#5
0
        private void InitRadialGauge()
        {
            // create the radial gauge
            NRadialGaugePanel radialGauge = new NRadialGaugePanel();

            radialGauge.BorderStyle         = new NEdgeBorderStyle(BorderShape.Auto);
            radialGauge.ContentAlignment    = ContentAlignment.BottomRight;
            radialGauge.Location            = new NPointL(new NLength(10, NRelativeUnit.ParentPercentage), new NLength(50, NRelativeUnit.ParentPercentage));
            radialGauge.Size                = new NSizeL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(45, NRelativeUnit.ParentPercentage));
            radialGauge.InnerRadius         = new NLength(10, NGraphicsUnit.Point);
            radialGauge.BackgroundFillStyle = new NGradientFillStyle(Color.DarkGray, Color.Black);
            radialGauge.BoundsMode          = BoundsMode.Fit;
            radialGauge.AutoBorder          = RadialGaugeAutoBorder.RoundedOutline;

            NGlassEffectStyle glassEffect = new NGlassEffectStyle();

            glassEffect.LightDirection = 130;
            glassEffect.EdgeOffset     = new NLength(0);
            glassEffect.EdgeDepth      = new NLength(30, NRelativeUnit.ParentPercentage);
            radialGauge.PaintEffect    = glassEffect;

            nChartControl1.Panels.Add(radialGauge);

            NNeedleValueIndicator indicator1 = new NNeedleValueIndicator();

            radialGauge.Indicators.Add(indicator1);
            radialGauge.SweepAngle = 180;

            InitSections(radialGauge);
        }
示例#6
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();
        }
        private void CreateRadialGauge()
        {
            // create the radial gauge
            m_RadialGauge             = new NRadialGaugePanel();
            m_RadialGauge.PaintEffect = new NGlassEffectStyle();
            m_RadialGauge.BorderStyle = new NEdgeBorderStyle(BorderShape.Auto);
            nChartControl1.Panels.Add(m_RadialGauge);

            // create the radial gauge
            m_RadialGauge.SweepAngle = 270;
            m_RadialGauge.BeginAngle = -90;

            // set some background
            NAdvancedGradientFillStyle advGradient = new NAdvancedGradientFillStyle();

            advGradient.BackgroundColor = Color.Black;
            advGradient.Points.Add(new NAdvancedGradientPoint(Color.LightGray, 10, 10, 0, 100, AGPointShape.Circle));
            m_RadialGauge.BackgroundFillStyle = advGradient;

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

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

            ConfigureScale((NLinearScaleConfigurator)axis.ScaleConfigurator);

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

            needle.OffsetFromScale = new NLength(0);
            m_RadialGauge.Indicators.Add(needle);
        }
示例#8
0
        protected static void UpdateIndicators(NDocument document)
        {
            NLineSeries line = (NLineSeries)document.RootPanel.Charts[0].Series[0];

            double min = (double)line.Values[line.Values.FindMinValue()];
            double max = (double)line.Values[line.Values.FindMaxValue()];

            NGaugePanel panel1 = document.RootPanel.ChildPanels[2] as NGaugePanel;
            NGaugePanel panel2 = document.RootPanel.ChildPanels[3] as NGaugePanel;
            NGaugePanel panel3 = document.RootPanel.ChildPanels[4] as NGaugePanel;

            NNeedleValueIndicator minIndicator = panel1.Indicators[1] as NNeedleValueIndicator;
            NNeedleValueIndicator maxIndicator = panel2.Indicators[1] as NNeedleValueIndicator;
            NNeedleValueIndicator avgIndicator = panel3.Indicators[1] as NNeedleValueIndicator;

            minIndicator.Value = min;
            maxIndicator.Value = max;

            int    count = line.Values.Count;
            double sum   = 0;

            for (int i = 0; i < count; i++)
            {
                sum += (double)line.Values[i];
            }

            if (count > 0)
            {
                avgIndicator.Value = sum / count;
            }
            else
            {
                avgIndicator.Value = 0;
            }
        }
        private void CreateRadialGauge()
        {
            // create the radial gauge
            m_RadialGauge             = new NRadialGaugePanel();
            m_RadialGauge.BorderStyle = new NEdgeBorderStyle(BorderShape.Auto);
            nChartControl1.Panels.Add(m_RadialGauge);

            // create the radial gauge
            m_RadialGauge.SweepAngle = 270;
            m_RadialGauge.BeginAngle = -90;

            // set some background
            m_RadialGauge.BackgroundFillStyle = new NColorFillStyle(Color.Black);;

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

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

            ConfigureScale((NLinearScaleConfigurator)axis.ScaleConfigurator);

            // add some indicators
            AddRangeIndicatorToGauge(m_RadialGauge);

            NNeedleValueIndicator needle = new NNeedleValueIndicator(60);

            needle.OffsetOriginMode = IndicatorOffsetOriginMode.ScaleMiddle;
            m_RadialGauge.Indicators.Add(needle);
        }
示例#10
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (nChartControl1.RequiresInitialization)
            {
                nChartControl1.BackgroundStyle.FrameStyle.Visible = false;
                nChartControl1.Panels.Clear();
                NStandardFrameStyle frame = nChartControl1.BackgroundStyle.FrameStyle as NStandardFrameStyle;
                frame.InnerBorderWidth = new NLength(0);

                // set a chart title
                NLabel header = nChartControl1.Labels.AddFooter("Auto Refresh");
                header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
                header.TextStyle.FillStyle = new NColorFillStyle(Color.FromArgb(60, 90, 108));
                header.ContentAlignment    = ContentAlignment.BottomRight;
                header.Location            = new NPointL(new NLength(3, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage));

                // setup Line chart
                NCartesianChart chart = new NCartesianChart();

                chart.Location   = new NPointL(new NLength(3, NRelativeUnit.ParentPercentage), new NLength(3, NRelativeUnit.ParentPercentage));
                chart.Size       = new NSizeL(new NLength(100, NRelativeUnit.ParentPercentage), new NLength(65, NRelativeUnit.ParentPercentage));
                chart.BoundsMode = BoundsMode.Stretch;

                chart.Margins = new NMarginsL(5, 10, 5, 10);
                SetupLineChart(chart);

                nChartControl1.Panels.Add(chart);

                NRadialGaugePanel minRadialGauge = CreateGaugePanel();
                minRadialGauge.Size     = new NSizeL(new NLength(30, NRelativeUnit.ParentPercentage), new NLength(35, NRelativeUnit.ParentPercentage));
                minRadialGauge.Location = new NPointL(new NLength(3, NRelativeUnit.ParentPercentage), new NLength(63, NRelativeUnit.ParentPercentage));
                NNeedleValueIndicator minIndicator = CreateIndicator();
                DecorateGaugeAxis(minRadialGauge, new NRange1DD(0, 100), Color.Blue, Color.DarkBlue);
                minRadialGauge.Indicators.Add(minIndicator);
                minRadialGauge.ChildPanels.Add(CreateGaugeLabel("Min"));
                nChartControl1.Panels.Add(minRadialGauge);

                NRadialGaugePanel maxRadialGauge = CreateGaugePanel();
                maxRadialGauge.Size     = new NSizeL(new NLength(30, NRelativeUnit.ParentPercentage), new NLength(35, NRelativeUnit.ParentPercentage));
                maxRadialGauge.Location = new NPointL(new NLength(35, NRelativeUnit.ParentPercentage), new NLength(63, NRelativeUnit.ParentPercentage));
                DecorateGaugeAxis(maxRadialGauge, new NRange1DD(300, 400), Color.Red, Color.DarkRed);
                NNeedleValueIndicator maxIndicator = CreateIndicator();
                maxRadialGauge.Indicators.Add(maxIndicator);
                maxRadialGauge.ChildPanels.Add(CreateGaugeLabel("Max"));
                nChartControl1.Panels.Add(maxRadialGauge);

                NRadialGaugePanel avgRadialGauge = CreateGaugePanel();
                avgRadialGauge.Size     = new NSizeL(new NLength(30, NRelativeUnit.ParentPercentage), new NLength(35, NRelativeUnit.ParentPercentage));
                avgRadialGauge.Location = new NPointL(new NLength(68, NRelativeUnit.ParentPercentage), new NLength(63, NRelativeUnit.ParentPercentage));
                DecorateGaugeAxis(avgRadialGauge, new NRange1DD(100, 300), Color.Green, Color.DarkGreen);
                NNeedleValueIndicator avgIndicator = CreateIndicator();
                avgRadialGauge.Indicators.Add(avgIndicator);
                avgRadialGauge.ChildPanels.Add(CreateGaugeLabel("Avg"));
                nChartControl1.Panels.Add(avgRadialGauge);

                // generate some data
                GenerateNewData();
            }
        }
示例#11
0
        private NNeedleValueIndicator CreateIndicator()
        {
            NNeedleValueIndicator indicator = new NNeedleValueIndicator();

            indicator.Shape.FillStyle = new NGradientFillStyle(Color.White, Color.Red);

            return(indicator);
        }
        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);
        }
        protected NNeedleValueIndicator CreateIndicator()
        {
            NNeedleValueIndicator indicator = new NNeedleValueIndicator();

            indicator.Shape.FillStyle = new NGradientFillStyle(Color.White, Color.Red);
            indicator.OffsetFromScale = new NLength(4);

            return(indicator);
        }
        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();
        }
示例#15
0
        private void CreateSpeedGauge()
        {
            // create the radial gauge
            NRadialGaugePanel radialGauge = new NRadialGaugePanel();


            radialGauge.BackgroundFillStyle = CreateAdvancedGradient();
            radialGauge.BorderStyle         = new NEdgeBorderStyle(BorderShape.Auto);
            radialGauge.PaintEffect         = new NGlassEffectStyle();
            radialGauge.ContentAlignment    = ContentAlignment.BottomRight;
            radialGauge.Location            = new NPointL(new NLength(5, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage));
            radialGauge.Size = new NSizeL(new NLength(45, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage));

            NLabel label = new NLabel("km/h");

            label.ContentAlignment           = ContentAlignment.BottomCenter;
            label.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 20, FontStyle.Italic);
            label.TextStyle.FontStyle.Style  = FontStyle.Italic;
            label.TextStyle.FillStyle        = new NColorFillStyle(Color.White);
            label.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;
            label.BoundsMode       = BoundsMode.Fit;
            label.UseAutomaticSize = false;
            label.Size             = new NSizeL(
                new NLength(60, NRelativeUnit.ParentPercentage),
                new NLength(7, NRelativeUnit.ParentPercentage));
            label.Location = new NPointL(
                new NLength(50, NRelativeUnit.ParentPercentage),
                new NLength(55, NRelativeUnit.ParentPercentage));
            label.Cache = true;

            radialGauge.ChildPanels.Add(label);
            nChartControl1.Panels.Add(radialGauge);

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

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

            NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator;

            ConfigureScale(scale, new NRange1DD(220, 260));
            radialGauge.Indicators.Add(CreateRangeIndicator(220));

            NMarkerValueIndicator indicator3 = new NMarkerValueIndicator();

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

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

            radialGauge.BeginAngle = -240;
            radialGauge.SweepAngle = 300;
        }
示例#16
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);
        }
        private NNeedleValueIndicator CreateIndicator()
        {
            NNeedleValueIndicator indicator = new NNeedleValueIndicator();

            indicator.OffsetOriginMode = IndicatorOffsetOriginMode.ScaleBegin;
            indicator.OffsetFromScale  = new NLength(5);
            indicator.Shape.FillStyle  = new NGradientFillStyle(Color.White, Color.Red);

            return(indicator);
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            nChartControl1.Panels.Clear();
            nChartControl1.BackgroundStyle.FillStyle = new NGradientFillStyle(Color.White, Color.Black);

            // set a chart title
            NLabel header = nChartControl1.Labels.AddFooter("Financial Dashboard");

            header.BackgroundFillStyle         = new NColorFillStyle(Color.FromArgb(125, Color.White));
            header.DockMode                    = PanelDockMode.Top;
            header.TextStyle.ShadowStyle.Type  = ShadowType.Solid;
            header.TextStyle.ShadowStyle.Color = Color.White;
            header.TextStyle.FontStyle         = new NFontStyle("Times New Roman", 13, FontStyle.Italic);
            header.TextStyle.FillStyle         = new NColorFillStyle(Color.MidnightBlue);
            header.DockMargins                 = new NMarginsL(5, 5, 5, 0);

            // setup Stock chart
            nChartControl1.Panels.Add(CreateStockChart());

            NDockPanel gaugeContainerPanel = new NDockPanel();

            gaugeContainerPanel.DockMode = PanelDockMode.Fill;
            gaugeContainerPanel.Margins  = new NMarginsL(5, 0, 5, 5);
            gaugeContainerPanel.PositionChildPanelsInContentBounds = true;
            nChartControl1.Panels.Add(gaugeContainerPanel);

            m_MinRadialGauge          = CreateGaugePanel("Minimum");
            m_MinRadialGauge.Location = new NPointL(new NLength(0, NRelativeUnit.ParentPercentage), new NLength(0, NRelativeUnit.ParentPercentage));
            m_MinIndicator            = CreateIndicator();

            DecorateGaugeAxis(m_MinRadialGauge, new NRange1DD(0, 100), Color.Blue, Color.DarkBlue);
            m_MinRadialGauge.Indicators.Add(m_MinIndicator);
            gaugeContainerPanel.ChildPanels.Add(m_MinRadialGauge);

            m_MaxRadialGauge          = CreateGaugePanel("Maximum");
            m_MaxRadialGauge.Location = new NPointL(new NLength(34, NRelativeUnit.ParentPercentage), new NLength(0, NRelativeUnit.ParentPercentage));
            DecorateGaugeAxis(m_MaxRadialGauge, new NRange1DD(300, 400), Color.Red, Color.DarkRed);
            m_MaxIndicator = CreateIndicator();
            m_MaxRadialGauge.Indicators.Add(m_MaxIndicator);
            gaugeContainerPanel.ChildPanels.Add(m_MaxRadialGauge);

            m_AvgRadialGauge          = CreateGaugePanel("Average");
            m_AvgRadialGauge.Location = new NPointL(new NLength(68, NRelativeUnit.ParentPercentage), new NLength(0, NRelativeUnit.ParentPercentage));
            DecorateGaugeAxis(m_AvgRadialGauge, new NRange1DD(100, 300), Color.Green, Color.DarkGreen);
            m_AvgIndicator = CreateIndicator();
            m_AvgRadialGauge.Indicators.Add(m_AvgIndicator);
            gaugeContainerPanel.ChildPanels.Add(m_AvgRadialGauge);

            // generate some data
            GenerateData();
        }
示例#19
0
        public override void Initialize()
        {
            nChartControl1.Panels.Clear();
            nChartControl1.BackgroundStyle.FillStyle = new NGradientFillStyle(Color.White, Color.Black);

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Financial Dashboard");

            title.BackgroundFillStyle = new NColorFillStyle(Color.FromArgb(125, Color.White));
            title.DockMode            = PanelDockMode.Top;
            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic);
            title.TextStyle.FillStyle = new NColorFillStyle(Color.MidnightBlue);
            title.DockMargins         = new NMarginsL(10, 10, 10, 0);

            // setup Stock chart
            nChartControl1.Panels.Add(CreateStockChart());

            NDockPanel gaugeContainerPanel = new NDockPanel();

            gaugeContainerPanel.DockMode = PanelDockMode.Fill;
            gaugeContainerPanel.Margins  = new NMarginsL(10, 0, 10, 10);
            gaugeContainerPanel.PositionChildPanelsInContentBounds = true;
            nChartControl1.Panels.Add(gaugeContainerPanel);

            m_MinRadialGauge          = CreateGaugePanel("Minimum");
            m_MinRadialGauge.Location = new NPointL(new NLength(0, NRelativeUnit.ParentPercentage), new NLength(0, NRelativeUnit.ParentPercentage));
            m_MinIndicator            = CreateIndicator();

            DecorateGaugeAxis(m_MinRadialGauge, new NRange1DD(0, 100), Color.Blue, Color.DarkBlue);
            m_MinRadialGauge.Indicators.Add(m_MinIndicator);
            gaugeContainerPanel.ChildPanels.Add(m_MinRadialGauge);

            m_MaxRadialGauge          = CreateGaugePanel("Maximum");
            m_MaxRadialGauge.Location = new NPointL(new NLength(34, NRelativeUnit.ParentPercentage), new NLength(0, NRelativeUnit.ParentPercentage));
            DecorateGaugeAxis(m_MaxRadialGauge, new NRange1DD(300, 400), Color.Red, Color.DarkRed);
            m_MaxIndicator = CreateIndicator();
            m_MaxRadialGauge.Indicators.Add(m_MaxIndicator);
            gaugeContainerPanel.ChildPanels.Add(m_MaxRadialGauge);

            m_AvgRadialGauge          = CreateGaugePanel("Average");
            m_AvgRadialGauge.Location = new NPointL(new NLength(68, NRelativeUnit.ParentPercentage), new NLength(0, NRelativeUnit.ParentPercentage));
            DecorateGaugeAxis(m_AvgRadialGauge, new NRange1DD(100, 300), Color.Green, Color.DarkGreen);
            m_AvgIndicator = CreateIndicator();
            m_AvgRadialGauge.Indicators.Add(m_AvgIndicator);
            gaugeContainerPanel.ChildPanels.Add(m_AvgRadialGauge);

            // generate some data
            NewDataButton_Click(null, null);
        }
示例#20
0
        private void CreateRadialGauge()
        {
            // 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));

            nChartControl1.Panels.Add(m_RadialGauge);

            // create the radial gauge
            m_RadialGauge.SweepAngle = 270;
            m_RadialGauge.BeginAngle = -90;

            // set some background
            NAdvancedGradientFillStyle advGradient = new NAdvancedGradientFillStyle();

            advGradient.BackgroundColor = Color.Black;
            advGradient.Points.Add(new NAdvancedGradientPoint(Color.White, 10, 10, 0, 100, AGPointShape.Circle));
            m_RadialGauge.BackgroundFillStyle = advGradient;

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

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

            ConfigureScale((NLinearScaleConfigurator)axis.ScaleConfigurator);

            // add some indicators
            AddRangeIndicatorToGauge(m_RadialGauge);

            NNeedleValueIndicator needle = new NNeedleValueIndicator(60);

            m_RadialGauge.Indicators.Add(needle);
        }
        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 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 void Page_Load(object sender, System.EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                WebExamplesUtilities.FillComboWithValues(RedAxisPercentDropDownList, 10, 70, 10);
                RedAxisPercentDropDownList.SelectedIndex = 6;
            }

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

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

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

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

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

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

            m_RadialGauge.Axes.Clear();

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

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

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

            m_RadialGauge.Axes.Add(axis1);

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

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

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

            m_RadialGauge.Axes.Add(axis2);

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

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

            NNeedleValueIndicator needleValueIndicator1 = new NNeedleValueIndicator();

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

            NNeedleValueIndicator needleValueIndicator2 = new NNeedleValueIndicator();

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

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

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

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

            nChartControl1.Panels.Add(header);

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

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

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

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

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

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

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

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

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

            // init form controls

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

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

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

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

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

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

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

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

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

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

            nChartControl1.Panels.Add(header);

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

            NInteractivityStyle interactivityStyle1 = new NInteractivityStyle();

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

            rangeIndicator.InteractivityStyle = interactivityStyle1;

            m_RadialGauge.Indicators.Add(rangeIndicator);

            NNeedleValueIndicator needleIndicator = new NNeedleValueIndicator();

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

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

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

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

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

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

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

            NIndicatorDragTool indicatorDragTool = new NIndicatorDragTool();

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

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

            range.AllowDragging = true;

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

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

            needle.AllowDragging = true;

            if (needle.AllowDragging)
            {
                needle.InteractivityStyle.Tooltip.Text = "Drag Me";
            }
            else
            {
                needle.InteractivityStyle.Tooltip.Text = needle.Value.ToString();
            }
        }
示例#27
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();
        }
示例#28
0
        private void CreateRPMGauge()
        {
            // create the radial gauge
            NRadialGaugePanel radialGauge = new NRadialGaugePanel();

            radialGauge.PaintEffect         = new NGlassEffectStyle();
            radialGauge.BorderStyle         = new NEdgeBorderStyle(BorderShape.Auto);
            radialGauge.BackgroundFillStyle = CreateAdvancedGradient();
            radialGauge.ContentAlignment    = ContentAlignment.BottomRight;
            radialGauge.Location            = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage));
            radialGauge.Size = new NSizeL(new NLength(45, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage));

            NLabel label = new NLabel("RPM");

            label.ContentAlignment           = ContentAlignment.BottomCenter;
            label.TextStyle.FontStyle.Name   = "Palatino Linotype";
            label.TextStyle.FontStyle.Style  = System.Drawing.FontStyle.Italic;
            label.TextStyle.FillStyle        = new NColorFillStyle(Color.White);
            label.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;
            label.BoundsMode       = BoundsMode.Fit;
            label.UseAutomaticSize = false;
            label.Size             = new NSizeL(
                new NLength(60, NRelativeUnit.ParentPercentage),
                new NLength(7, NRelativeUnit.ParentPercentage));
            label.Location = new NPointL(
                new NLength(50, NRelativeUnit.ParentPercentage),
                new NLength(55, NRelativeUnit.ParentPercentage));
            label.Cache = true;

            radialGauge.ChildPanels.Add(label);
            nChartControl1.Panels.Add(radialGauge);

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

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

            NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator;

            ConfigureScale(scale, new NRange1DD(6000, 7000));
            radialGauge.Indicators.Add(CreateRangeIndicator(6000));

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

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

            // and a state indicator to the speed
            NGaugeModelAnchor modelAnchor = new NGaugeModelAnchor();

            modelAnchor.ModelPoint = new NPointL(new NLength(100, NRelativeUnit.ParentPercentage), new NLength(60));
            modelAnchor.Gauge      = radialGauge;

            NAnchorPanel anchorPanel = new NAnchorPanel();

            anchorPanel.Anchor = modelAnchor;

            CreateRotationStateIndicator();
            anchorPanel.ChildPanels.Add(m_RotationStateIndicator);

            radialGauge.ChildPanels.Add(anchorPanel);
        }
示例#29
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);
        }
示例#30
0
        private void CalculateIndicatorValue(NGaugePanel gauge, NSeries series)
        {
            NNeedleValueIndicator needle = gauge.Indicators[0] as NNeedleValueIndicator;

            needle.Value = 50;            // CalculateIndicatorValue(series);
        }