Exemple #1
0
        private String GetTextForAnnotation(NAnchorPanel annotation)
        {
            String sText = "";

            if (annotation is NRectangularCallout)
            {
                sText = "This is a rectangular callout panel \r\n";
            }
            else if (annotation is NRoundedRectangularCallout)
            {
                sText = "This is a rounded rectangular callout panel \r\n";
            }
            else if (annotation is NCutEdgeRectangularCallout)
            {
                sText = "This is a cut edge rectangular callout panel \r\n";
            }
            else if (annotation is NOvalCallout)
            {
                sText = "This is an oval callout panel \r\n";
            }
            else if (annotation is NArrowAnnotation)
            {
                sText = "This is an arrow annotation \r\n";
            }
            else if (annotation is NArrowCallout)
            {
                sText = "This is an arrow callout";
            }
            else
            {
                Debug.Assert(false);
            }

            return(sText + GetTextForAnchor(annotation.Anchor));
        }
        private void UpdateMiniCharts()
        {
            if (m_bLockUpdate == true)
            {
                return;
            }

            m_Chart.RemoveDescendantsOfType(typeof(NAnchorPanel));
            m_Chart.Series.Clear();

            // add bar and change bar color
            m_PointSeries = (NPointSeries)m_Chart.Series.Add(SeriesType.Point);

            // use custom X positions
            m_PointSeries.UseXValues = true;

            m_PointSeries.Size = new NLength(12, NRelativeUnit.ParentPercentage);

            // this will require to set the InflateMargins flag to true since in this mode
            // scale is determined only by the X positions of the shape and will not take
            // into account the size of the bubbles.
            m_PointSeries.InflateMargins = true;

            m_PointSeries.PointShape             = (PointShape)PointStyleComboBox.SelectedIndex;
            m_PointSeries.DataLabelStyle.Visible = false;

            // populate the shape series of the master chart
            int i = 0;

            for (i = 0; i < 5; i++)
            {
                float fShapeSize = 40 + Random.Next(5);

                m_PointSeries.XValues.Add(Random.Next(10));
                m_PointSeries.Values.Add(Random.Next(10));
                m_PointSeries.FillStyles[i] = new NColorFillStyle(RandomColor());
            }

            // create anchor panels attached to the shape series data points
            for (i = 0; i < m_PointSeries.Values.Count; i++)
            {
                NAnchorPanel anchorPanel = new NAnchorPanel();
                m_Chart.ChildPanels.Add(anchorPanel);

                anchorPanel.Size = new NSizeL(
                    new NLength(10, NRelativeUnit.ParentPercentage),
                    new NLength(10, NRelativeUnit.ParentPercentage));

                anchorPanel.Anchor           = new NDataPointAnchor(m_PointSeries, i, ContentAlignment.MiddleCenter, StringAlignment.Near);
                anchorPanel.ContentAlignment = ContentAlignment.MiddleCenter;
                anchorPanel.ChildPanels.Add(CreateAnchorPanelChart());
            }

            nChartControl1.Refresh();
        }
Exemple #3
0
        private void UpdateMiniCharts(NChart chart)
        {
            chart.RemoveDescendantsOfType(typeof(NAnchorPanel));
            chart.Series.Clear();

            // add a master point series
            NPointSeries pointSeries = (NPointSeries)chart.Series.Add(SeriesType.Point);

            pointSeries.UseXValues             = true;
            pointSeries.InflateMargins         = true;
            pointSeries.DataLabelStyle.Visible = false;
            pointSeries.Size      = new NLength(12, NRelativeUnit.ParentPercentage);
            pointSeries.FillStyle = new NColorFillStyle(Color.Gainsboro);

            // fill the point series with data
            for (int i = 0; i < 5; i++)
            {
                pointSeries.Values.Add(2 + Random.NextDouble() * 10);
                pointSeries.XValues.Add(2 + Random.NextDouble() * 10);
            }

            // create anchor panels attached to the point series data points
            for (int pointIndex = 0; pointIndex < pointSeries.Values.Count; pointIndex++)
            {
                NAnchorPanel anchorPanel = new NAnchorPanel();
                chart.ChildPanels.Add(anchorPanel);

                anchorPanel.Size = new NSizeL(
                    new NLength(10, NRelativeUnit.ParentPercentage),
                    new NLength(10, NRelativeUnit.ParentPercentage));

                anchorPanel.Anchor           = new NDataPointAnchor(pointSeries, pointIndex, ContentAlignment.MiddleCenter, StringAlignment.Near);
                anchorPanel.ContentAlignment = ContentAlignment.MiddleCenter;
                anchorPanel.ChildPanels.Add(CreateAnchorPanelChart());
            }
        }
Exemple #4
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);
        }