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);
        }
예제 #2
0
        private NAdvancedGradientFillStyle Flow()
        {
            NAdvancedGradientFillStyle ag = new NAdvancedGradientFillStyle();

            ag.BackgroundColor = Color.FromArgb(64, 0, 128);

            ag.Points.Add(new NAdvancedGradientPoint(Color.FromArgb(255, 255, 128), 38, 17, 50, 48, AGPointShape.Line));
            ag.Points.Add(new NAdvancedGradientPoint(Color.FromArgb(255, 0, 128), 58, 74, 0, 100, AGPointShape.Line));

            return(ag);
        }
예제 #3
0
        private NAdvancedGradientFillStyle AzureLight()
        {
            NAdvancedGradientFillStyle ag = new NAdvancedGradientFillStyle();

            ag.BackgroundColor = Color.White;

            ag.Points.Add(new NAdvancedGradientPoint(Color.FromArgb(235, 168, 255), 87, 29, 0, 92, AGPointShape.Circle));
            ag.Points.Add(new NAdvancedGradientPoint(Color.FromArgb(64, 199, 255), 53, 82, 0, 81, AGPointShape.Circle));
            ag.Points.Add(new NAdvancedGradientPoint(Color.White, 16, 17, 0, 100, AGPointShape.Circle));

            return(ag);
        }
예제 #4
0
        private NAdvancedGradientFillStyle Reactor()
        {
            NAdvancedGradientFillStyle ag = new NAdvancedGradientFillStyle();

            ag.BackgroundColor = Color.Black;

            ag.Points.Add(new NAdvancedGradientPoint(Color.FromArgb(255, 128, 255), 50, 78, 0, 35, AGPointShape.Line));
            ag.Points.Add(new NAdvancedGradientPoint(Color.FromArgb(128, 128, 255), 50, 22, 0, 35, AGPointShape.Line));
            ag.Points.Add(new NAdvancedGradientPoint(Color.White, 50, 50, 0, 52, AGPointShape.Circle));

            return(ag);
        }
예제 #5
0
        public override void Initialize()
        {
            base.Initialize();

            nChartControl1.BackgroundStyle.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant2, Color.White, Color.FromArgb(230, 230, 244));

            // add label
            NLabel title = nChartControl1.Labels.AddHeader("Advanced Gradient Fill Style");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic);
            title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue);

            title.ContentAlignment = ContentAlignment.BottomCenter;
            title.Location         = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage));

            // setup chart and axes
            m_Chart = nChartControl1.Charts[0];
            m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective);
            m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.SoftTopLeft);
            m_Chart.Axis(StandardAxis.Depth).Visible = false;

            NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator();

            m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale;
            linearScale.MajorGridStyle.LineStyle.Pattern          = LinePattern.Dot;
            linearScale.MajorGridStyle.LineStyle.Color            = Color.White;

            linearScale = new NLinearScaleConfigurator();
            m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale;
            linearScale.MajorGridStyle.LineStyle.Pattern          = LinePattern.Dot;
            linearScale.MajorGridStyle.LineStyle.Color            = Color.White;
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);

            // set walls advanced gradient
            NAdvancedGradientFillStyle ag = AzureLight();

            m_Chart.Wall(ChartWallType.Back).FillStyle  = ag;
            m_Chart.Wall(ChartWallType.Left).FillStyle  = ag;
            m_Chart.Wall(ChartWallType.Floor).FillStyle = ag;

            // create bubble chart
            m_Bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble);
            m_Bubble.DataLabelStyle.Visible = false;
            m_Bubble.Legend.Mode            = SeriesLegendMode.DataPoints;
            m_Bubble.BubbleShape            = PointShape.Sphere;
            m_Bubble.BorderStyle.Width      = new NLength(0, NGraphicsUnit.Pixel);
            m_Bubble.UseXValues             = true;
            m_Bubble.InflateMargins         = true;
            m_Bubble.FillStyle = TheEye();

            GenerateData();
        }
예제 #6
0
        private NAdvancedGradientFillStyle TheEye()
        {
            NAdvancedGradientFillStyle ag = new NAdvancedGradientFillStyle();

            ag.BackgroundColor = Color.FromArgb(64, 0, 128);

            ag.Points.Add(new NAdvancedGradientPoint(Color.FromArgb(128, 128, 255), 50, 50, 0, 51, AGPointShape.Circle));
            ag.Points.Add(new NAdvancedGradientPoint(Color.White, 50, 50, 0, 49, AGPointShape.Line));
            ag.Points.Add(new NAdvancedGradientPoint(Color.FromArgb(0, 0, 64), 50, 50, 0, 23, AGPointShape.Circle));
            ag.Points.Add(new NAdvancedGradientPoint(Color.Black, 50, 50, 0, 13, AGPointShape.Circle));

            return(ag);
        }
예제 #7
0
        private NAdvancedGradientFillStyle Medusa()
        {
            NAdvancedGradientFillStyle ag = new NAdvancedGradientFillStyle();

            ag.BackgroundColor = Color.FromArgb(0, 0, 64);

            ag.Points.Add(new NAdvancedGradientPoint(Color.FromArgb(0, 128, 255), 12, 57, 0, 60, AGPointShape.Circle));
            ag.Points.Add(new NAdvancedGradientPoint(Color.White, 29, 29, 0, 35, AGPointShape.Circle));
            ag.Points.Add(new NAdvancedGradientPoint(Color.FromArgb(0, 128, 255), 57, 12, 0, 60, AGPointShape.Circle));
            ag.Points.Add(new NAdvancedGradientPoint(Color.FromArgb(128, 0, 255), 60, 60, 0, 37, AGPointShape.Circle));
            ag.Points.Add(new NAdvancedGradientPoint(Color.White, 84, 84, 0, 50, AGPointShape.Circle));

            return(ag);
        }
        private void InitDocument(NDrawingDocument document)
        {
            // Set up visual formatting
            document.BackgroundStyle.FrameStyle.Visible = false;
            document.Style.TextStyle.FontStyle          = new NFontStyle(document.Style.TextStyle.FontStyle.Name, 14);

            // Create the stylesheets
            int i     = 0;
            int count = GradientSchemes.Length;

            for (i = 0; i < count; i++)
            {
                AdvancedGradientScheme     scheme     = GradientSchemes[i];
                NStyleSheet                styleSheet = new NStyleSheet(scheme.ToString());
                NAdvancedGradientFillStyle fill       = new NAdvancedGradientFillStyle(scheme, 4);
                if (scheme.Equals(AdvancedGradientScheme.Green))
                {
                    // Make the green color dark
                    ((NAdvancedGradientPoint)fill.Points[0]).Color = Color.FromArgb(0, 128, 0);
                }
                NStyle.SetFillStyle(styleSheet, fill);
                document.StyleSheets.AddChild(styleSheet);

                NAdvancedGradientFillStyle highlightedFill = (NAdvancedGradientFillStyle)fill.Clone();
                ((NAdvancedGradientPoint)highlightedFill.Points[0]).Color = ControlPaint.LightLight(((NAdvancedGradientPoint)fill.Points[0]).Color);
                NStyleSheet highlightedStyleSheet = new NStyleSheet(styleSheet.Name + HighlightedSuffix);
                NStyle.SetFillStyle(highlightedStyleSheet, highlightedFill);
                document.StyleSheets.AddChild(highlightedStyleSheet);
            }

            // Create the board and info shapes
            NClickomaniaGame game = new NClickomaniaGame();

            CreateBoardShape(document, game);
            CreateInfoShape(document, game);
            game.BoardShape.Location = new NPointF(game.InfoShape.Bounds.Right + game.InfoShape.Width / 2, game.BoardShape.Location.Y);

            // Resize the document to fit all shapes
            document.SizeToContent();
            game.InfoShape.Location = new NPointF(game.InfoShape.Location.X, game.BoardShape.Location.Y);
            document.Tag            = game;
        }
        private void CreateLinearGauge()
        {
            m_LinearGauge = new NLinearGaugePanel();
            nChartControl1.Panels.Add(m_LinearGauge);

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

            advGradient.BackgroundColor = Color.Black;
            advGradient.Points.Add(new NAdvancedGradientPoint(Color.LightGray, 10, 10, 0, 100, AGPointShape.Circle));
            m_LinearGauge.BackgroundFillStyle = advGradient;
            m_LinearGauge.BorderStyle         = new NEdgeBorderStyle(BorderShape.RoundedRect);

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

            axis.Anchor = new NModelGaugeAxisAnchor(new NLength(20, NGraphicsUnit.Point), VertAlign.Center, RulerOrientation.Left);
            ConfigureScale((NLinearScaleConfigurator)axis.ScaleConfigurator);

            // add some indicators
            m_LinearGauge.Indicators.Add(new NMarkerValueIndicator(60));
        }
예제 #10
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);
        }
            protected void ChangeCurrentShapeColor(string webControlId, System.Web.HttpContext context, NStateObject state, EventArgs args, Color c)
            {
                NDiagramSessionStateObject diagramState = state as NDiagramSessionStateObject;

                NNodeList allShapes = diagramState.Document.ActiveLayer.Children(Nevron.Diagram.Filters.NFilters.Shape2D);

                NNodeList affectedNodes  = diagramState.HitTest(args as NCallbackMouseEventArgs);
                NNodeList affectedShapes = affectedNodes.Filter(Nevron.Diagram.Filters.NFilters.Shape2D);

                int    length;
                NShape shape;

                length = allShapes.Count;
                for (int i = 0; i < length; i++)
                {
                    shape = allShapes[i] as NShape;
                    if (shape.Tag != null)
                    {
                        shape.Style.FillStyle = shape.Tag as NAdvancedGradientFillStyle;
                    }
                }

                if (affectedShapes.Count == 0)
                {
                    return;
                }

                shape = affectedShapes[affectedShapes.Count - 1] as NShape;
                NAdvancedGradientFillStyle fs = shape.Style.FillStyle as NAdvancedGradientFillStyle;

                if (fs != null)
                {
                    shape.Tag             = fs;
                    shape.Style.FillStyle = new NColorFillStyle(c);
                }
            }
예제 #12
0
        private NFillStyle CreateAdvancedGradient()
        {
            NAdvancedGradientFillStyle agfs = new NAdvancedGradientFillStyle();

            agfs.BackgroundColor = Color.FromArgb(234, 234, 234);

            NAdvancedGradientPoint point1 = new NAdvancedGradientPoint();

            point1.X         = 50;
            point1.Y         = 50;
            point1.Color     = Color.FromArgb(51, 51, 51);
            point1.Intensity = 70;
            agfs.Points.Add(point1);

            NAdvancedGradientPoint point2 = new NAdvancedGradientPoint();

            point2.X         = 50;
            point2.Y         = 50;
            point2.Color     = Color.FromArgb(41, 41, 41);
            point2.Intensity = 50;
            agfs.Points.Add(point2);

            return(agfs);
        }
예제 #13
0
        private void InitDocument()
        {
            // modify the connectors style sheet
            NStyleSheet styleSheet = (NDrawingView1.Document.StyleSheets.GetChildByName(NDR.NameConnectorsStyleSheet, -1) as NStyleSheet);

            NTextStyle textStyle = new NTextStyle();

            textStyle.BackplaneStyle.Visible = true;
            textStyle.BackplaneStyle.StandardFrameStyle.InnerBorderWidth = new NLength(0);
            textStyle.BackplaneStyle.FillStyle = new NColorFillStyle(Color.FromArgb(200, Color.White));
            styleSheet.Style.TextStyle         = textStyle;

            styleSheet.Style.StrokeStyle = new NStrokeStyle(1, Color.Black);
            styleSheet.Style.StartArrowheadStyle.StrokeStyle = new NStrokeStyle(Color.FromArgb(0, Color.Black));
            styleSheet.Style.StartArrowheadStyle.FillStyle   = new NColorFillStyle(Color.FromArgb(0, Color.White));
            styleSheet.Style.EndArrowheadStyle.StrokeStyle   = new NStrokeStyle(1, Color.Black);

            // modify default stroke style
            NDrawingView1.Document.Style.StrokeStyle = new NStrokeStyle(Color.FromArgb(0, Color.White));

            // configure the document
            NDrawingView1.Document.Bounds = new NRectangleF(0, 0, 420, 320);
            NDrawingView1.Document.GraphicsSettings.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
            NDrawingView1.Document.GraphicsSettings.SmoothingMode     = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            NDrawingView1.Document.GraphicsSettings.PixelOffsetMode   = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
            NDrawingView1.Document.MeasurementUnit  = NGraphicsUnit.Pixel;
            NDrawingView1.Document.DrawingScaleMode = DrawingScaleMode.NoScale;

            NDrawingView1.Document.BackgroundStyle.FrameStyle.Visible = false;

            //	predefined styles
            NAdvancedGradientFillStyle ag1 = new NAdvancedGradientFillStyle();

            ag1.BackgroundColor = Color.Navy;
            ag1.Points.Add(new NAdvancedGradientPoint(Color.SkyBlue, 50, 50, 0, 79, AGPointShape.Circle));

            NAdvancedGradientFillStyle ag2 = new NAdvancedGradientFillStyle();

            ag2.BackgroundColor = Color.DarkRed;
            ag2.Points.Add(new NAdvancedGradientPoint(Color.Red, 50, 50, 0, 71, AGPointShape.Circle));

            NAdvancedGradientFillStyle ag3 = new NAdvancedGradientFillStyle();

            ag3.BackgroundColor = Color.Orange;
            ag3.Points.Add(new NAdvancedGradientPoint(Color.Yellow, 50, 50, 0, 50, AGPointShape.Circle));

            //	shapes
            NBasicShapesFactory factory = new NBasicShapesFactory(NDrawingView1.Document);

            NEllipseShape centerEllipse = factory.CreateShape((int)BasicShapes.Ellipse) as NEllipseShape;

            centerEllipse.Name                     = "CenterEllipse";
            centerEllipse.Width                    = 50f;
            centerEllipse.Height                   = 50f;
            centerEllipse.Center                   = new NPointF(210, 160);
            centerEllipse.Style.StrokeStyle        = null;
            centerEllipse.Style.FillStyle          = ag3;
            centerEllipse.Style.InteractivityStyle = new NInteractivityStyle(true, centerEllipse.Name);

            NEllipseShape rotatingEllipse = factory.CreateShape((int)BasicShapes.Ellipse) as NEllipseShape;

            rotatingEllipse.Name                     = "RotatingEllipse";
            rotatingEllipse.Width                    = 35f;
            rotatingEllipse.Height                   = 35f;
            rotatingEllipse.Center                   = new NPointF(centerEllipse.Bounds.X - 100, centerEllipse.Center.Y);
            rotatingEllipse.Style.StrokeStyle        = null;
            rotatingEllipse.Style.FillStyle          = ag1;
            rotatingEllipse.PinPoint                 = new NPointF(centerEllipse.Center.X, centerEllipse.Center.Y);
            rotatingEllipse.Style.InteractivityStyle = new NInteractivityStyle(true, rotatingEllipse.Name);

            NEllipseShape rotatingEllipse2 = factory.CreateShape((int)BasicShapes.Ellipse) as NEllipseShape;

            rotatingEllipse2.Name                     = "RotatingEllipse2";
            rotatingEllipse2.Width                    = 15f;
            rotatingEllipse2.Height                   = 15f;
            rotatingEllipse2.Center                   = new NPointF(centerEllipse.Bounds.Right + 30, centerEllipse.Center.Y);
            rotatingEllipse2.Style.StrokeStyle        = null;
            rotatingEllipse2.Style.FillStyle          = ag2;
            rotatingEllipse2.PinPoint                 = new NPointF(centerEllipse.Center.X, centerEllipse.Center.Y);
            rotatingEllipse2.Style.InteractivityStyle = new NInteractivityStyle(true, rotatingEllipse2.Name);

            NEllipseShape orbit1 = factory.CreateShape((int)BasicShapes.Ellipse) as NEllipseShape;

            orbit1.Name                      = "orbit1";
            orbit1.Width                     = 2 * (centerEllipse.Center.X - rotatingEllipse.Center.X);
            orbit1.Height                    = orbit1.Width;
            orbit1.Center                    = new NPointF(centerEllipse.Center.X, centerEllipse.Center.Y);
            orbit1.Style.StrokeStyle         = new NStrokeStyle(Color.Black);
            orbit1.Style.StrokeStyle.Pattern = LinePattern.Dot;
            orbit1.Style.StrokeStyle.Factor  = 2;
            orbit1.Style.FillStyle           = new NColorFillStyle(Color.FromArgb(0, Color.White));

            NEllipseShape orbit2 = factory.CreateShape((int)BasicShapes.Ellipse) as NEllipseShape;

            orbit2.Name                      = "orbit2";
            orbit2.Width                     = 2 * (centerEllipse.Center.X - rotatingEllipse2.Center.X);
            orbit2.Height                    = orbit2.Width;
            orbit2.Center                    = new NPointF(centerEllipse.Center.X, centerEllipse.Center.Y);
            orbit2.Style.StrokeStyle         = new NStrokeStyle(Color.Black);
            orbit2.Style.StrokeStyle.Pattern = LinePattern.Dot;
            orbit2.Style.StrokeStyle.Factor  = 2;
            orbit2.Style.FillStyle           = new NColorFillStyle(Color.FromArgb(0, Color.White));

            NDrawingView1.Document.ActiveLayer.AddChild(orbit1);
            NDrawingView1.Document.ActiveLayer.AddChild(orbit2);
            NDrawingView1.Document.ActiveLayer.AddChild(centerEllipse);
            NDrawingView1.Document.ActiveLayer.AddChild(rotatingEllipse);
            NDrawingView1.Document.ActiveLayer.AddChild(rotatingEllipse2);

            // some shapes need to have extra ports
            NRotatedBoundsPort port = new NRotatedBoundsPort(centerEllipse.UniqueId, ContentAlignment.MiddleCenter);

            port.Name = "MiddleCenter";
            centerEllipse.Ports.AddChild(port);

            port      = new NRotatedBoundsPort(rotatingEllipse.UniqueId, ContentAlignment.MiddleCenter);
            port.Name = "MiddleCenter";
            rotatingEllipse.Ports.AddChild(port);

            // connect shapes in levels
            NShape connector           = base.CreateConnector(NDrawingView1.Document, centerEllipse, "MiddleCenter", rotatingEllipse, "MiddleCenter", ConnectorType.Line, "Radius");
            NInteractivityStyle istyle = connector.ComposeInteractivityStyle();
        }
예제 #14
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;
        }
예제 #15
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);
            }
        }
예제 #16
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();
        }