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

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

            radialGauge.Indicators.Add(knobIndicator);

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

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

            return(radialGauge);
        }
Exemple #2
0
        public override void Initialize()
        {
            nChartControl1.Panels.Clear();

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

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

            nChartControl1.Panels.Add(header);

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

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

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

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

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

            nChartControl1.Panels.Add(radialGauge);

            m_Indicator1                   = new NRangeIndicator();
            m_Indicator1.Value             = 50;
            m_Indicator1.FillStyle         = new NColorFillStyle(Color.LightBlue);
            m_Indicator1.StrokeStyle.Color = Color.DarkBlue;
            m_Indicator1.EndWidth          = new NLength(20);
            radialGauge.Indicators.Add(m_Indicator1);

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

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

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

            // init form controls
            UpdateTooltips();
        }
Exemple #3
0
        private void DecorateGaugeAxis(NRadialGaugePanel panel, NRange1DD range, Color colorLight, Color colorDark)
        {
            NGaugeAxis axis = (NGaugeAxis)panel.Axes[0];
            NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator;

            // create a range indicator
            NRangeIndicator rangeIndicator = new NRangeIndicator();

            rangeIndicator.OriginMode = OriginMode.Custom;
            rangeIndicator.Value      = range.Begin;
            rangeIndicator.Origin     = range.End;
            rangeIndicator.BeginWidth = new NLength(10);
            rangeIndicator.EndWidth   = new NLength(10);

            rangeIndicator.FillStyle         = new NColorFillStyle(Color.FromArgb(100, colorLight));
            rangeIndicator.StrokeStyle.Color = colorLight;
            panel.Indicators.Add(rangeIndicator);

            // create a scale section
            NScaleSectionStyle scaleSection = new NScaleSectionStyle();

            scaleSection.Range = range;
            scaleSection.MajorTickStrokeStyle = new NStrokeStyle(colorLight);
            scaleSection.MinorTickStrokeStyle = new NStrokeStyle(1, colorLight, LinePattern.Dot, 0, 2);

            NTextStyle labelStyle = new NTextStyle();

            labelStyle.FillStyle        = new NGradientFillStyle(colorLight, colorDark);
            labelStyle.FontStyle        = new NFontStyle("Arial", 10, FontStyle.Bold);
            scaleSection.LabelTextStyle = labelStyle;

            scale.Sections.Add(scaleSection);
        }
        protected NRadialGaugePanel CreateGaugePanel()
        {
            // create the radial gauge
            NRadialGaugePanel radialGauge = new NRadialGaugePanel();

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

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

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

            NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator;

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

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

            return(radialGauge);
        }
Exemple #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);
        }
        protected void DecorateGaugeAxis(NRadialGaugePanel panel, NRange1DD range, Color colorLight, Color colorDark)
        {
            NGaugeAxis axis = (NGaugeAxis)panel.Axes[0];
            NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator;

            NRangeIndicator rangeIndicator = new NRangeIndicator();

            rangeIndicator.OriginMode      = OriginMode.Custom;
            rangeIndicator.OffsetFromScale = new NLength(10);
            rangeIndicator.Value           = range.Begin;
            rangeIndicator.Origin          = range.End;

            rangeIndicator.FillStyle         = new NColorFillStyle(Color.FromArgb(30, colorLight));
            rangeIndicator.StrokeStyle.Width = new NLength(0);
            panel.Indicators.Add(rangeIndicator);

            NScaleSectionStyle scaleSection = new NScaleSectionStyle();

            scaleSection.Range = range;
            scaleSection.MajorTickFillStyle = new NColorFillStyle(colorLight);
            scaleSection.MinorTickFillStyle = new NColorFillStyle(colorLight);

            NTextStyle labelStyle = new NTextStyle();

            labelStyle.FillStyle        = new NColorFillStyle(colorDark);
            labelStyle.FontStyle.Style  = FontStyle.Bold;
            labelStyle.FontStyle.EmSize = new NLength(6);
            scaleSection.LabelTextStyle = labelStyle;

            scale.Sections.Add(scaleSection);
        }
        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);
        }
Exemple #8
0
        private void CreateRadialGauge()
        {
            // create the radial gauge
            m_RadialGauge = new NRadialGaugePanel();
            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);;
            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);
        }
        public override void Initialize()
        {
            base.Initialize();

            // configure device and interactivity
            nChartControl1.Panels.Clear();
            nChartControl1.Controller.Tools.Add(new NPanelSelectorTool());
            nChartControl1.Controller.Tools.Add(new NTrackballTool());

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Style Sheet Configurators");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic);
            title.FitAlignment        = ContentAlignment.MiddleLeft;
            title.Margins             = new NMarginsL(10, 10, 0, 0);
            title.DockMode            = PanelDockMode.Top;

            NDockPanel dockPanel = new NDockPanel();

            dockPanel.DockMode    = PanelDockMode.Fill;
            dockPanel.DockMargins = new NMarginsL(20, 5, 15, 10);
            dockPanel.PositionChildPanelsInContentBounds = true;
            nChartControl1.Panels.Add(dockPanel);

            NChart chart = CreateBarChart();

            chart.Enable3D   = true;
            chart.BoundsMode = BoundsMode.Fit;
            chart.Location   = new NPointL(5, 0);
            chart.Size       = new NSizeL(new NLength(60, NRelativeUnit.ParentPercentage), new NLength(100, NRelativeUnit.ParentPercentage));

            dockPanel.ChildPanels.Add(chart);
            NRadialGaugePanel gauge = CreateRadialGauge();

            dockPanel.ChildPanels.Add(gauge);
            gauge.Location = new NPointL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(10, NRelativeUnit.ParentPercentage));
            gauge.Size     = new NSizeL(new NLength(30, NRelativeUnit.ParentPercentage), new NLength(40, NRelativeUnit.ParentPercentage));

            gauge = CreateRadialGauge();
            dockPanel.ChildPanels.Add(gauge);
            gauge.Location = new NPointL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(50, NRelativeUnit.ParentPercentage));
            gauge.Size     = new NSizeL(new NLength(30, NRelativeUnit.ParentPercentage), new NLength(40, NRelativeUnit.ParentPercentage));

            // init form controls
            PaletteComboBox.FillFromEnum(typeof(ChartPredefinedPalette));
            PaletteComboBox.SelectedIndex = 0;

            // init form controls
            PopulateFillTemplateCombo(BackgroundFillTemplateComboBox);
            PopulateFillTemplateCombo(LabelsFillTemplateComboBox);
            PopulateFillTemplateCombo(WallsFillTemplateComboBox);
            PopulateFillTemplateCombo(SeriesFillTemplateComboBox);
            PopulateFillTemplateCombo(IndicatorsFillTemplateComboBox);

            PopulateStrokeTemplateCombo(LabelsStrokeTemplateComboBox, 0);
            PopulateStrokeTemplateCombo(IndicatorsStrokeTemplateComboBox);
            PopulateStrokeTemplateCombo(RulerStrokeTemplateComboBox);
            PopulateStrokeTemplateCombo(SeriesStrokeTemplateComboBox);
        }
Exemple #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();
            }
        }
        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();
        }
Exemple #12
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;
        }
        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();
        }
Exemple #14
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);
        }
        private NRadialGaugePanel CreateGaugePanel(string labelText)
        {
            // create the radial gauge
            NRadialGaugePanel radialGauge = new NRadialGaugePanel();

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

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

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

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

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

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

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

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

            NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator;

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

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

            return(radialGauge);
        }
        public override void Initialize()
        {
            base.Initialize();

            // configure device and interactivity
            nChartControl1.Panels.Clear();
            nChartControl1.Controller.Tools.Add(new NPanelSelectorTool());
            nChartControl1.Controller.Tools.Add(new NTrackballTool());

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Predefined Style Sheets");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic);
            title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue);
            title.FitAlignment        = ContentAlignment.MiddleLeft;
            title.Margins             = new NMarginsL(10, 10, 0, 0);
            title.DockMode            = PanelDockMode.Top;

            NDockPanel dockPanel = new NDockPanel();

            dockPanel.DockMode    = PanelDockMode.Fill;
            dockPanel.DockMargins = new NMarginsL(20, 5, 15, 10);
            dockPanel.PositionChildPanelsInContentBounds = true;
            nChartControl1.Panels.Add(dockPanel);

            NChart chart = CreateBarChart();

            chart.Enable3D   = true;
            chart.Location   = new NPointL(5, 0);
            chart.Size       = new NSizeL(new NLength(60, NRelativeUnit.ParentPercentage), new NLength(100, NRelativeUnit.ParentPercentage));
            chart.BoundsMode = BoundsMode.Fit;

            dockPanel.ChildPanels.Add(chart);
            NRadialGaugePanel gauge = CreateRadialGauge();

            dockPanel.ChildPanels.Add(gauge);
            gauge.Location = new NPointL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(10, NRelativeUnit.ParentPercentage));
            gauge.Size     = new NSizeL(new NLength(30, NRelativeUnit.ParentPercentage), new NLength(40, NRelativeUnit.ParentPercentage));

            gauge = CreateRadialGauge();
            dockPanel.ChildPanels.Add(gauge);
            gauge.Location = new NPointL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(50, NRelativeUnit.ParentPercentage));
            gauge.Size     = new NSizeL(new NLength(30, NRelativeUnit.ParentPercentage), new NLength(40, NRelativeUnit.ParentPercentage));

            PredefinedStyleSheetComboBox.FillFromEnum(typeof(PredefinedStyleSheet));
        }
Exemple #17
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);
        }
        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();
            }
        }
Exemple #20
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();
        }
Exemple #21
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);
        }
        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;
            }
        }
Exemple #23
0
        public override void Create()
        {
            nChartControl1.Panels.Clear();

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

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

            nChartControl1.Panels.Add(header);

            NDockPanel panelContainer = new NDockPanel();

            panelContainer.DockMode = PanelDockMode.Fill;

            // create the knob indicator
            NKnobIndicator knobIndicator = new NKnobIndicator();

            knobIndicator.OffsetFromScale = new NLength(-5);
            knobIndicator.OuterRimStyle.PatternRepeatCount = 5;
            knobIndicator.InnerRimStyle.PatternRepeatCount = 5;
            //knobIndicator.InnerRimStyle.Offset = new NLength(10);

            // apply fill style to the marker
            NAdvancedGradientFillStyle advancedGradientFill = new NAdvancedGradientFillStyle();

            advancedGradientFill.BackgroundColor = Color.Red;
            advancedGradientFill.Points.Add(new NAdvancedGradientPoint(Color.White, 20, 20, 0, 100, AGPointShape.Circle));
            knobIndicator.MarkerShape.FillStyle = advancedGradientFill;
            knobIndicator.ValueChanged         += knobIndicator_ValueChanged;

            m_RadialGauge    = CreateRadialGauge(knobIndicator);
            m_NumericDisplay = CreateNumericDisplay();

            panelContainer.ChildPanels.Add(m_NumericDisplay);
            panelContainer.ChildPanels.Add(m_RadialGauge);

            panelContainer.Margins = new NMarginsL(10, 10, 10, 10);
            nChartControl1.Panels.Add(panelContainer);

            nChartControl1.Controller.Tools.Add(new NSelectorTool());
            nChartControl1.Controller.Tools.Add(new NIndicatorDragTool());

            m_Updating = true;

            // Init form controls
            NExampleHelpers.FillComboWithEnumValues(MarkerShapeComboBox, typeof(SmartShape2D));
            MarkerShapeComboBox.SelectedIndex = (int)SmartShape2D.Ellipse;

            NExampleHelpers.BindComboToItemSource(MarkerOffsetComboBox, -100, 100, 5);
            MarkerOffsetComboBox.SelectedItem = (int)knobIndicator.OffsetFromScale.Value;

            NExampleHelpers.FillComboWithEnumValues(MarkerPaintOrderComboBox, typeof(KnobMarkerPaintOrder));
            MarkerPaintOrderComboBox.SelectedIndex = (int)knobIndicator.MarkerPaintOrder;

            // outer rim
            NExampleHelpers.FillComboWithEnumValues(OuterRimPatternComboBox, typeof(CircularRimPattern));
            OuterRimPatternComboBox.SelectedIndex = (int)knobIndicator.OuterRimStyle.Pattern;

            NExampleHelpers.BindComboToItemSource(OuterRimPatternRepeatCountComboBox, 0, 100, 5);
            OuterRimPatternRepeatCountComboBox.SelectedItem = (int)knobIndicator.OuterRimStyle.PatternRepeatCount;

            NExampleHelpers.BindComboToItemSource(OuterRimRadiusOffsetComboBox, 0, 100, 5);
            OuterRimRadiusOffsetComboBox.SelectedItem = (int)knobIndicator.OuterRimStyle.Offset.Value;

            // inner rim
            NExampleHelpers.FillComboWithEnumValues(InnerRimPatternComboBox, typeof(CircularRimPattern));
            InnerRimPatternComboBox.SelectedIndex = (int)knobIndicator.InnerRimStyle.Pattern;

            NExampleHelpers.BindComboToItemSource(InnerRimPatternRepeatCountComboBox, 0, 100, 5);
            InnerRimPatternRepeatCountComboBox.SelectedItem = (int)knobIndicator.InnerRimStyle.PatternRepeatCount;

            NExampleHelpers.BindComboToItemSource(InnerRimRadiusOffsetComboBox, 0, 100, 5);
            InnerRimRadiusOffsetComboBox.SelectedItem = (int)knobIndicator.InnerRimStyle.Offset.Value;

            m_Updating = false;

            OuterRimPatternRepeatCountComboBox.SelectedItem = 6;
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;
            nChartControl1.Panels.Clear();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            if (m_Indicator1.OriginMode != OriginMode.Custom)
            {
                RangeIndicatorOriginDropDownList.Enabled = false;
            }
            else
            {
                RangeIndicatorOriginDropDownList.Enabled = true;
            }
        }
        public override void Create()
        {
            nChartControl1.Panels.Clear();

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

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

            nChartControl1.Panels.Add(header);

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

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

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

            m_RadialGauge.Axes.Clear();

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

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

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

            m_RadialGauge.Axes.Add(axis1);

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

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

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

            m_RadialGauge.Axes.Add(axis2);

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

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

            NNeedleValueIndicator needleValueIndicator1 = new NNeedleValueIndicator();

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

            NNeedleValueIndicator needleValueIndicator2 = new NNeedleValueIndicator();

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

            RedAxisPercentScrollBar.Value = 70;
        }
        public override void Create()
        {
            nChartControl1.Panels.Clear();

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

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

            nChartControl1.Panels.Add(header);

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

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

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

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

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

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

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

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

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

            // init form controls

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

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

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

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

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

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

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

            NExampleHelpers.BindComboToItemSource(RangeIndicatorOriginComboBox, 0, 100, 5);
            RangeIndicatorOriginComboBox.SelectedItem = (int)m_Indicator1.Origin;
        }
Exemple #27
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();
        }
Exemple #28
0
        public override void Create()
        {
            nChartControl1.Panels.Clear();

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

            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(10, NRelativeUnit.ParentPercentage), new NLength(12, 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);

            NAdvancedGradientFillStyle advGradient = new NAdvancedGradientFillStyle();

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

            radialGauge.SweepAngle = 360;
            radialGauge.BeginAngle = -90;
            nChartControl1.Panels.Add(radialGauge);

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

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

            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.FromArgb(20, Color.LightGray)), null, true, 0, 0, 1, 1);

            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.Interlaced = true;
            scale.StripStyles.Add(stripStyle);
            scale.MinorTickCount = 4;
            scale.MajorTickMode  = MajorTickMode.CustomStep;
            scale.CustomStep     = 5.0f;
            scale.SetPredefinedScaleStyle(PredefinedScaleStyle.Watch);
            scale.OuterMajorTickStyle.FillStyle = new NGradientFillStyle(Color.White, Color.Beige);
            scale.OuterMajorTickStyle.LineStyle = new NStrokeStyle(Color.DarkGray);
            scale.OuterMajorTickStyle.Length    = new NLength(14);
            scale.RulerStyle.FillStyle          = new NColorFillStyle(Color.FromArgb(50, Color.Silver));
            scale.RulerStyle.BorderStyle        = new NStrokeStyle(Color.Beige);

            axis.UpdateScale();
            axis.SynchronizeScaleWithConfigurator = false;

            NTextStyle textStyle1 = new NTextStyle();

            textStyle1.FillStyle        = new NColorFillStyle(Color.White);
            textStyle1.BorderStyle      = new NStrokeStyle(1, Color.Beige);
            textStyle1.FontStyle.Style  = System.Drawing.FontStyle.Bold;
            textStyle1.FontStyle.EmSize = new NLength(22);
            NScaleLabelAngle angle = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0);

            NTextStyle textStyle2 = new NTextStyle();

            textStyle2.FillStyle        = new NColorFillStyle(Color.White);
            textStyle2.BorderStyle      = new NStrokeStyle(1, Color.Beige);
            textStyle2.FontStyle.Style  = System.Drawing.FontStyle.Bold;
            textStyle2.FontStyle.EmSize = new NLength(12);

            NCustomScaleDecorator customDecorator = new NCustomScaleDecorator();

            NValueScaleLabelStyle style1 = new NValueScaleLabelStyle(textStyle1, ContentAlignment.MiddleCenter, angle, new NLength(0));
            NValueScaleLabelStyle style2 = new NValueScaleLabelStyle(textStyle2, ContentAlignment.MiddleCenter, angle, new NLength(0));

            for (int i = 12; i > 0; i--)
            {
                string           text = NSystem.IntToRoman(i);
                NValueScaleLabel hourLabel;

                if (i % 3 == 0)
                {
                    hourLabel = new NValueScaleLabel(new NScaleValueDecorationAnchor(i * 5), text, (NValueScaleLabelStyle)style1.Clone());
                }
                else
                {
                    hourLabel = new NValueScaleLabel(new NScaleValueDecorationAnchor(i * 5), text, (NValueScaleLabelStyle)style2.Clone());
                }

                customDecorator.Decorations.Add(hourLabel);
            }

            NScaleLevel textLevel = (NScaleLevel)axis.Scale.Levels[1];

            textLevel.Decorators.Clear();
            textLevel.Decorators.Add(customDecorator);

            m_HoursArrow                         = new NNeedleValueIndicator();
            m_HoursArrow.Value                   = 79;
            m_HoursArrow.Shape.FillStyle         = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red);
            m_HoursArrow.Shape.StrokeStyle.Color = Color.Red;
            m_HoursArrow.OffsetOriginMode        = IndicatorOffsetOriginMode.ScaleEnd;
            m_HoursArrow.OffsetFromScale         = new NLength(30);
            m_HoursArrow.Width                   = new NLength(8);
            radialGauge.Indicators.Add(m_HoursArrow);

            m_MinituesArrow                         = new NNeedleValueIndicator();
            m_MinituesArrow.Value                   = 79;
            m_MinituesArrow.Shape.FillStyle         = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red);
            m_MinituesArrow.Shape.StrokeStyle.Color = Color.Red;
            m_MinituesArrow.OffsetOriginMode        = IndicatorOffsetOriginMode.ScaleEnd;
            m_MinituesArrow.OffsetFromScale         = new NLength(30);
            m_MinituesArrow.Width                   = new NLength(5);
            radialGauge.Indicators.Add(m_MinituesArrow);

            m_SecondsArrow                         = new NNeedleValueIndicator();
            m_SecondsArrow.Value                   = 79;
            m_SecondsArrow.Shape.FillStyle         = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red);
            m_MinituesArrow.OffsetOriginMode       = IndicatorOffsetOriginMode.ScaleEnd;
            m_SecondsArrow.Shape.StrokeStyle.Color = Color.Red;
            m_SecondsArrow.OffsetFromScale         = new NLength(10);
            m_SecondsArrow.Width                   = new NLength(1);
            radialGauge.Indicators.Add(m_SecondsArrow);

            //nChartControl1.AutoRefresh = true;
            SynchronizeWithTime();

            m_Timer           = new DispatcherTimer();
            m_Timer.Interval  = new TimeSpan(1000);
            m_Timer.Tick     += m_Timer_Tick;
            m_Timer.IsEnabled = true;
            m_Timer.Start();
        }
        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);
        }
Exemple #30
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!nChartControl1.Initialized)
            {
                nChartControl1.BackgroundStyle.FrameStyle.Visible = false;
                nChartControl1.Panels.Clear();
                nChartControl1.StateId = "Gauge1";

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

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

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

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

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

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

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

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

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