Exemple #1
0
        public void updateLineGauge()
        {
            LinearScale linearScale = new LinearScale();

            linearScale.StartValue         = 20;
            linearScale.EndValue           = 100;
            linearScale.MajorIntervalCount = 20;
            //linearScale.MinorIntervalCount = 5;

            LinearScaleLevelBar linearScaleLevelBar = new LinearScaleLevelBar();

            linearScaleLevelBar.Value = 20;

            LinearScaleRange linearScaleRange = new LinearScaleRange();

            linearScaleRange.StartValue = 0;
            linearScaleRange.EndValue   = 100;


            //Add Items
            linearScale.LevelBars.Add(linearScaleLevelBar);
            linearScale.Ranges.Add(linearScaleRange);


            LineGauge.Scales.Add(linearScale);
        }
Exemple #2
0
        public void Should_Allow_To_Set_Range()
        {
            var sut = new LinearScale();

            sut.Range(new Range <Double>(0, 5));
            Assert.AreEqual(5, sut.Range().Max);
        }
        public void T001_MajorTicksSpacedOne()
        {
            var scale = new LinearScale();
            var s     = (LinearTickSpacing)scale.TickSpacing;

            s.OrgGrace  = 0;
            s.EndGrace  = 0;
            s.ZeroLever = 0;

            for (int tmt = 4; tmt <= 16; ++tmt)
            {
                s.TargetNumberOfMajorTicks = tmt;
                s.TargetNumberOfMinorTicks = 1;

                s.FinalProcessScaleBoundaries(0, tmt - 1, scale);

                var majorTicks = s.GetMajorTicks();

                Assert.IsNotNull(majorTicks);
                Assert.AreEqual(tmt, majorTicks.Length);

                for (int i = 0; i <= tmt - 1; ++i)
                {
                    Assert.AreEqual(majorTicks[i], i);
                }
            }
        }
Exemple #4
0
        public void Should_Invert_Value()
        {
            var sut    = new LinearScale(new Range <Double>(0, 1), new Range <Double>(0, 100));
            var scaled = sut.Invert(30);

            Assert.AreEqual(0.3, scaled);
        }
Exemple #5
0
        public void Should_Scale_Value()
        {
            var sut    = new LinearScale(new Range <Double>(0, 1), new Range <Double>(0, 100));
            var scaled = sut.Scale(0.3);

            Assert.AreEqual(30, scaled);
        }
Exemple #6
0
 /// <summary>
 /// Initializes the log.
 /// </summary>
 public void InitializeLog()
 {
     timer          = new DispatcherTimer();
     timer.Interval = TimeSpan.FromMilliseconds(1000);
     timer.Tick    += new EventHandler(timer_Tick);
     currentScale   = m_scale1;
     slider.Value   = currentScale.Pointers[1].Value;
 }
Exemple #7
0
 /// <summary>
 /// Initializes the style to default values.
 /// </summary>
 public DensityImagePlotStyle()
 {
     ColorProvider = new ColorProvider.ColorProviderBGRY();
     Scale         = new LinearScale()
     {
         TickSpacing = new NoTickSpacing()
     };                                                         // Ticks are not needed here, they will only disturb the bounds of the scale
     InitializeMembers();
 }
        private Model3D CreateCube(double x, double z, int minHeight, int maxHeight, Instance c, AbstractHeatMap heatMap)
        {
            var color        = heatMap.GetBrush(c);
            var scaledHeight = LinearScale.Apply(c.LinesOfCode, minHeight, maxHeight);

            var result = CreateCube(x, z, scaledHeight, color);

            modelClassXRef.Add(result, c);
            return(result);
        }
Exemple #9
0
        public virtual void DragTo(int x, int y, PointF refPoint, bool dragging)
        {
            LinearScale scale = this.GetScale();

            this.dragging = dragging;
            double value = scale.GetValue(refPoint, new PointF((float)x, (float)y));

            value = scale.GetValueLimit(value, this.SnappingEnabled, this.SnappingInterval);
            if (this.Common != null)
            {
                this.Value = value;
            }
        }
Exemple #10
0
        internal virtual void DragTo(int x, int y, PointF refPoint, bool dragging)
        {
            LinearScale scale = GetScale();

            this.dragging = dragging;
            double value = scale.GetValue(refPoint, new PointF(x, y));

            value = scale.GetValueLimit(value, SnappingEnabled, SnappingInterval);
            if (Common != null)
            {
                Value = value;
            }
        }
Exemple #11
0
        private void SetupOldAxis(int idx, Altaxo.Graph.Scales.Deprecated.Scale axis, bool isLinked, double orgA, double orgB, double endA, double endB)
        {
            Scale transScale = null;

            if (axis is Altaxo.Graph.Scales.Deprecated.TextScale)
            {
                transScale = new TextScale();
            }
            else if (axis is Altaxo.Graph.Scales.Deprecated.DateTimeScale)
            {
                transScale = new DateTimeScale();
            }
            else if (axis is Altaxo.Graph.Scales.Deprecated.Log10Scale)
            {
                transScale = new Log10Scale();
            }
            else if (axis is Altaxo.Graph.Scales.Deprecated.AngularScale)
            {
                transScale = (axis as Altaxo.Graph.Scales.Deprecated.AngularScale).UseDegrees ? new AngularDegreeScale() : (Scale) new AngularRadianScale();
            }
            else if (axis is Altaxo.Graph.Scales.Deprecated.LinearScale)
            {
                transScale = new LinearScale();
            }
            else
            {
                throw new ArgumentException("Axis type unknown");
            }

            if (transScale.RescalingObject is IUnboundNumericScaleRescaleConditions)
            {
                (transScale.RescalingObject as IUnboundNumericScaleRescaleConditions).SetUserParameters(BoundaryRescaling.AutoTempFixed, BoundariesRelativeTo.Absolute, axis.OrgAsVariant, BoundaryRescaling.AutoTempFixed, BoundariesRelativeTo.Absolute, axis.EndAsVariant);
            }

            if (transScale.RescalingObject is Altaxo.Graph.Scales.Rescaling.NumericScaleRescaleConditions &&
                axis.RescalingObject is Altaxo.Graph.Scales.Rescaling.NumericScaleRescaleConditions)
            {
                ((Altaxo.Graph.Scales.Rescaling.NumericScaleRescaleConditions)transScale.RescalingObject).CopyFrom((Altaxo.Graph.Scales.Rescaling.NumericScaleRescaleConditions)axis.RescalingObject);
            }

            if (isLinked)
            {
#pragma warning disable CS0618 // Type or member is obsolete
                var ls = new LinkedScale(transScale, idx);
#pragma warning restore CS0618 // Type or member is obsolete
                ls.SetLinkParameter(orgA, orgB, endA, endB);
                transScale = ls;
            }

            _scales[idx] = transScale;
        }
Exemple #12
0
        static void SetupLinearScale(LinearScale linearScale)
        {
            linearScale.BeginUpdate();

            AddScaleRanges(linearScale);
            linearScale.MinValue = 0;
            linearScale.MaxValue = 100;

            linearScale.Appearance.Brush = new SolidBrushObject(Color.Transparent);

            linearScale.MinorTickmark.ShowTick = false;
            linearScale.MajorTickmark.ShowTick = false;
            linearScale.MajorTickmark.ShowText = false;

            linearScale.EndUpdate();
        }
Exemple #13
0
        /// <summary>
        /// Handles the SelectionChanged event of the FrequencyComboBox control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Controls.SelectionChangedEventArgs"/> instance containing the event data.</param>
        private void FrequencyComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBox c = sender as ComboBox;

            switch (c.SelectedIndex)
            {
            case 0:
                currentScale = m_scale1;
                break;

            case 1:
                currentScale = m_scale2;
                break;

            case 2:
                currentScale = m_scale3;
                break;

            case 3:
                currentScale = m_scale4;
                break;

            case 4:
                currentScale = m_scale5;
                break;

            case 5:
                currentScale = m_scale6;
                break;

            case 6:
                currentScale = m_scale7;
                break;

            case 7:
                currentScale = m_scale8;
                break;

            case 8:
                currentScale = m_scale9;
                break;
            }
            if (slider != null)
            {
                slider.Value = currentScale.Pointers[1].Value;
            }
        }
Exemple #14
0
        private void colorHandle()
        {
            LinearScale linearScale = new LinearScale();

            linearScale.MinimumValue = 0;
            linearScale.MaximumValue = 100;

            ColorCollection colors = new ColorCollection();

            colors.Add(System.Windows.Media.Colors.Blue);
            colors.Add(System.Windows.Media.Colors.Pink);
            colors.Add(System.Windows.Media.Colors.Red);


            linearScale.Colors = colors;

            SetColors = linearScale;
        }
Exemple #15
0
        public MarkerStyleAttrib GetMarkerStyleAttrib(MapGraphics g)
        {
            MarkerStyleAttrib markerStyleAttrib = new MarkerStyleAttrib();

            if (!string.IsNullOrEmpty(this.Image))
            {
                return(markerStyleAttrib);
            }
            float absoluteDimension  = g.GetAbsoluteDimension(this.MarkerLength);
            float absoluteDimension2 = g.GetAbsoluteDimension(this.Width);

            markerStyleAttrib.path = g.CreateMarker(new PointF(0f, 0f), absoluteDimension2, absoluteDimension, this.MarkerStyle);
            float num = 0f;

            if (this.Placement == Placement.Cross || this.Placement == Placement.Inside)
            {
                num = (float)(num + 180.0);
            }
            if (this.GetGauge().GetOrientation() == Orientation.Vertical)
            {
                num = (float)(num + 270.0);
            }
            if (num > 0.0)
            {
                using (Matrix matrix = new Matrix())
                {
                    matrix.Rotate(num);
                    markerStyleAttrib.path.Transform(matrix);
                }
            }
            float       num2              = this.CalculateMarkerDistance();
            LinearScale scale             = this.GetScale();
            float       positionFromValue = scale.GetPositionFromValue(scale.GetValueLimit(this.Position));
            PointF      pointOrigin       = Point.Empty;

            pointOrigin             = ((this.GetGauge().GetOrientation() != 0) ? g.GetAbsolutePoint(new PointF(num2, positionFromValue)) : g.GetAbsolutePoint(new PointF(positionFromValue, num2)));
            markerStyleAttrib.brush = g.GetMarkerBrush(markerStyleAttrib.path, this.MarkerStyle, pointOrigin, 0f, this.FillColor, this.FillGradientType, this.FillSecondaryColor, this.FillHatchStyle);
            using (Matrix matrix2 = new Matrix())
            {
                matrix2.Translate(pointOrigin.X, pointOrigin.Y, MatrixOrder.Append);
                markerStyleAttrib.path.Transform(matrix2);
                return(markerStyleAttrib);
            }
        }
Exemple #16
0
        internal ZoomPanel(CommonElements common)
            : base(common)
        {
            Name    = "ZoomPanel";
            scale   = new LinearScale(this);
            pointer = new LinearPointer(this);
            MapCore mapCore = GetMapCore();

            Scale.LabelStyle.Visible           = false;
            Scale.MajorTickMark.Visible        = false;
            Scale.MinorTickMark.Length         = 30f;
            Scale.MinorTickMark.Width          = 10f;
            Scale.MinorTickMark.EnableGradient = false;
            Scale.FillGradientType             = GradientType.None;
            Scale.FillHatchStyle = MapHatchStyle.None;
            Scale.ShadowOffset   = 0f;
            Scale.BorderWidth    = 1;
            Scale.Width          = 15f;
            Scale.Minimum        = 0.0;
            Scale.Maximum        = 100.00000000001;
            double tickMarksInterval = GetTickMarksInterval(TickCount);

            Scale.MinorTickMark.Interval = tickMarksInterval;
            Pointer.Placement            = Placement.Cross;
            if (mapCore != null && mapCore.Viewport != null)
            {
                Pointer.Position = mapCore.Viewport.Zoom;
            }
            Pointer.SnappingEnabled  = true;
            Pointer.SnappingInterval = tickMarksInterval;
            Pointer.FillGradientType = GradientType.None;
            Pointer.FillHatchStyle   = MapHatchStyle.None;
            Pointer.ShadowOffset     = 0f;
            if (mapCore != null && mapCore.Viewport != null)
            {
                ZoomLevel = mapCore.Viewport.Zoom;
            }
            zoomInButton  = new PanelButton(this, PanelButtonType.ZoomButton, PanelButtonStyle.RoundedRectangle, zoomButtonClickHandler);
            zoomOutButton = new PanelButton(this, PanelButtonType.ZoomOut, PanelButtonStyle.RoundedRectangle, zoomButtonClickHandler);
            ApplyStyle();
            ApplyColors();
        }
Exemple #17
0
        public GraphicsPath GetPointerPath(MapGraphics g)
        {
            if (!this.Visible)
            {
                return(null);
            }
            GraphicsPath graphicsPath = new GraphicsPath();
            LinearScale  scale        = this.GetScale();

            scale.GetPositionFromValue(scale.GetValueLimit(this.Position));
            if (this.Type == LinearPointerType.Marker)
            {
                MarkerStyleAttrib markerStyleAttrib = this.GetMarkerStyleAttrib(g);
                if (markerStyleAttrib.path != null)
                {
                    graphicsPath.AddPath(markerStyleAttrib.path, false);
                }
            }
            return(graphicsPath);
        }
Exemple #18
0
        internal GraphicsPath GetPointerPath(MapGraphics g)
        {
            if (!Visible)
            {
                return(null);
            }
            GraphicsPath graphicsPath = new GraphicsPath();
            LinearScale  scale        = GetScale();

            scale.GetPositionFromValue(scale.GetValueLimit(Position));
            if (Type == LinearPointerType.Marker)
            {
                MarkerStyleAttrib markerStyleAttrib = GetMarkerStyleAttrib(g);
                if (markerStyleAttrib.path != null)
                {
                    graphicsPath.AddPath(markerStyleAttrib.path, connect: false);
                }
            }
            return(graphicsPath);
        }
Exemple #19
0
 public DensityLegendArea(PointD2D size, bool isXYInterchanged, bool isXReversed, Scale scale, TickSpacing tickSpacing)
 {
     _size   = size;
     _scales = new ScaleCollection()
     {
         ParentObject = this
     };
     _scales[0]        = scale;
     scale.TickSpacing = tickSpacing;
     _scales[1]        = new LinearScale()
     {
         TickSpacing = new NoTickSpacing()
     };
     _coordinateSystem = new Altaxo.Graph.Gdi.CS.G2DCartesicCoordinateSystem()
     {
         ParentObject = this
     };
     _coordinateSystem.IsXYInterchanged = isXYInterchanged;
     _coordinateSystem.IsXReverse       = isXReversed;
     _coordinateSystem.UpdateAreaSize(_size);
 }
Exemple #20
0
        private void colorHandle()
        {
            LinearScale linearScale = new LinearScale();

            //Heatmap heatmap = new Heatmap();

            linearScale.MinimumValue = 0;
            linearScale.MaximumValue = 100;

            ColorCollection colors = new ColorCollection();

            colors.Add(System.Windows.Media.Colors.Blue);
            colors.Add(System.Windows.Media.Colors.Pink);
            colors.Add(System.Windows.Media.Colors.Red);

            //linearScale.Colors =new[] { System.Windows.Media.Colors.Blue, System.Windows.Media.Colors.Pink, System.Windows.Media.Colors.Red };

            linearScale.Colors = colors;

            //heatmap.ValueScale = linearScale;
            SetColors = linearScale;
        }
Exemple #21
0
        static void AddScaleRanges(LinearScale scale)
        {
            LinearScaleRange range1 = new LinearScaleRange();

            range1.AppearanceRange.ContentBrush = new SolidBrushObject(Color.Green);
            range1.StartValue = 0;
            range1.EndValue   = 20;

            LinearScaleRange range2 = new LinearScaleRange();

            range2.AppearanceRange.ContentBrush = new SolidBrushObject(Color.Yellow);
            range2.StartValue = 20;
            range2.EndValue   = 40;

            LinearScaleRange range3 = new LinearScaleRange();

            range3.AppearanceRange.ContentBrush = new SolidBrushObject(Color.Red);
            range3.StartValue = 40;
            range3.EndValue   = 100;

            scale.Ranges.Clear();
            scale.Ranges.AddRange(new IRange[] { range1, range2, range3 });
        }
Exemple #22
0
        XRGauge CreateGauge()
        {
            XRGauge gauge = new XRGauge()
            {
                ViewType  = DashboardGaugeType.Linear,
                ViewStyle = DashboardGaugeStyle.Full,
                SizeF     = new SizeF(500, 200)
            };

            IDashboardGauge gaugeControl  = gauge.Gauge;
            var             gaugeElements = gaugeControl.Elements;

            LinearScale linearScale = GetOrAdd <LinearScale>(gaugeElements);

            SetupLinearScale(linearScale);

            LinearScaleRangeBar rangeBar = GetOrAdd <LinearScaleRangeBar>(gaugeElements);

            SetupRangeBar(rangeBar);

            AddMarker(gaugeControl as DashboardGauge, 50f);

            return(gauge);
        }
        public void T002_TestZeroLever()
        {
            var scale = new LinearScale();
            var s     = (LinearTickSpacing)scale.TickSpacing;

            s.OrgGrace  = 0;
            s.EndGrace  = 0;
            s.ZeroLever = 0;

            Altaxo.Data.AltaxoVariant org, end;

            s.ZeroLever = 0.25;

            for (int i = 0; i < 50; ++i)
            {
                org = i;
                end = i + 100; // Span now is 100

                s.PreProcessScaleBoundaries(ref org, ref end, true, true);
                Assert.AreEqual(i <= 25 ? 0 : i, org.ToDouble());

                Assert.AreEqual(i + 100, end.ToDouble());
            }
        }
		public override View GetSampleContent (Context con)
		{

			SfLinearGauge linearGauge = new SfLinearGauge (con);
			//	linearGauge.LayoutParameters =new LinearLayout.LayoutParams(parentLayout.getMeasuredWidth(),parentLayout.getMeasuredHeight()-150);
			ObservableCollection<LinearScale> scales = new ObservableCollection<LinearScale> ();
			ObservableCollection<LinearPointer> pointers = new ObservableCollection<LinearPointer> ();
			ObservableCollection<LinearRange> ranges = new ObservableCollection<LinearRange> ();

			linearGauge.SetX (0);
			linearGauge.SetY (0);



			linearGauge.SetBackgroundColor (Color.Rgb (255, 255, 255));

			linearGauge.SetOrientation (SfLinearGauge.Orientation.Vertical);

			// adding  new scale
			LinearScale outerScale = new LinearScale ();
			outerScale.Minimum = 0;
			outerScale.Maximum = 100;
			outerScale.ScaleBarSize = 50;
			outerScale.ScaleBarLength = 100;
			outerScale.Interval = 20;
			outerScale.ScaleBarColor = Color.ParseColor ("#FAECEC");
			outerScale.MinorTicksPerInterval = 2;
			outerScale.LabelFontSize = 17;
			outerScale.LabelColor = Color.ParseColor ("#545454");
			outerScale.LabelPostfix = "%";

			//adding major ticks
			LinearTickSettings outerScale_majorTicksSettings = new LinearTickSettings ();
			outerScale_majorTicksSettings.Color = Color.ParseColor ("#AFAFAF");//
			outerScale_majorTicksSettings.Length = 20;
			outerScale_majorTicksSettings.StrokeWidth = 5;
			outerScale_majorTicksSettings.Offset = 0;

			outerScale.MajorTickSettings = outerScale_majorTicksSettings;

			//adding minor ticks
			LinearTickSettings outerScale_minorTicksSettings = new LinearTickSettings ();
			outerScale_minorTicksSettings.Color = Color.ParseColor ("#AFAFAF");
			outerScale_minorTicksSettings.Length = 10;
			outerScale_minorTicksSettings.StrokeWidth = 5;
			outerScale_minorTicksSettings.Offset = 0;
			outerScale.MinorTickSettings = outerScale_minorTicksSettings;

			// adding Symbol Pointer
			SymbolPointer outerScale_needlePointer = new SymbolPointer ();
			outerScale_needlePointer.Value = pointervalue;
			outerScale_needlePointer.StrokeWidth = 0;
			outerScale_needlePointer.Offset = 0.3f;
			outerScale_needlePointer.Color = Color.ParseColor ("#414D4F");
			pointers.Add (outerScale_needlePointer);

			//adding Bar Pointer
			BarPointer rangePointer = new BarPointer ();
			rangePointer.Value = barvalue;
			rangePointer.Color = Color.ParseColor ("#CE4545");//
			rangePointer.StrokeWidth = 20;
			pointers.Add (rangePointer);

			outerScale.Pointers = pointers;

			//adding ranges
			LinearRange lowerRange = new LinearRange ();
			lowerRange.StartWidth = 30;
			lowerRange.EndWidth = 30;
			lowerRange.Color = Color.ParseColor ("#67d6db");
			lowerRange.StartValue = 0;
			lowerRange.EndValue = 50;
			lowerRange.Offset = -.3;
			ranges.Add (lowerRange);

			LinearRange higherRange = new LinearRange ();
			higherRange.StartWidth = 30;
			higherRange.EndWidth = 30;
			higherRange.Color = Color.ParseColor ("#32B8C6");
			higherRange.StartValue = 50;
			higherRange.EndValue = 100;
			higherRange.Offset = -.3;
			ranges.Add (higherRange);

			outerScale.Ranges = ranges;


			scales.Add (outerScale);
			linearGauge.Scales = scales;
			TextView textview = new TextView (con);

			textview.Text = "Memory Usage";
			textview.TextSize = 20;
			textview.SetTextColor (Color.ParseColor ("#CE4545"));

			LinearLayout ln = new LinearLayout (con);
			ln.Orientation = Orientation.Vertical;

			ln.SetBackgroundColor (Color.Rgb (255, 255, 255));
			ln.SetGravity ((GravityFlags)17);

			LinearLayout ln1 = new LinearLayout (con);
			ln1.AddView (textview);
			ln1.SetGravity ((GravityFlags)17);

			ln1.SetBackgroundColor (Color.Rgb (255, 255, 255));

			ln.AddView (ln1);
			ln.AddView (linearGauge);
			return ln;
		}
Exemple #25
0
        public override void Paint(System.Drawing.Graphics g, IPaintContext paintContext)
        {
            if (null == _cachedArea)
            {
                return;
            }

            bool orientationIsVertical = IsOrientationVertical;
            bool scaleIsReversed       = IsScaleReversed;

            int pixelH = orientationIsVertical ? _bitmapPixelsAcross : _bitmapPixelsAlong;
            int pixelV = orientationIsVertical ? _bitmapPixelsAlong : _bitmapPixelsAcross;

            if (null == _bitmap || _bitmap.Width != pixelH || _bitmap.Height != pixelV)
            {
                if (null != _bitmap)
                {
                    _bitmap.Dispose();
                }

                _bitmap = new Bitmap(pixelH, pixelV, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
            }

            Data.AltaxoVariant porg;
            Data.AltaxoVariant pend;
            NumericalScale     originalZScale;

            Plot.IColorProvider colorProvider;

            if (null != PlotItem)
            {
                porg           = PlotItem.Style.Scale.OrgAsVariant;
                pend           = PlotItem.Style.Scale.EndAsVariant;
                originalZScale = PlotItem.Style.Scale;
                colorProvider  = PlotItem.Style.ColorProvider;
            }
            else
            {
                porg           = 0;
                pend           = 1;
                originalZScale = new LinearScale();
                colorProvider  = new Plot.ColorProvider.ColorProviderBGRY();
            }

            var legendScale       = (NumericalScale)ScaleWithTicks;
            var legendTickSpacing = ScaleWithTicks.TickSpacing;

            // Fill the bitmap

            for (int i = 0; i < _bitmapPixelsAlong; i++)
            {
                double r     = (scaleIsReversed ^ orientationIsVertical) ? 1 - i / (double)(_bitmapPixelsAlong - 1) : i / (double)(_bitmapPixelsAlong - 1);
                double l     = originalZScale.PhysicalToNormal(legendScale.NormalToPhysical(r));
                var    color = colorProvider.GetColor(l);
                if (orientationIsVertical)
                {
                    for (int j = 0; j < _bitmapPixelsAcross; j++)
                    {
                        _bitmap.SetPixel(j, i, color);
                    }
                }
                else
                {
                    for (int j = 0; j < _bitmapPixelsAcross; j++)
                    {
                        _bitmap.SetPixel(i, j, color);
                    }
                }
            }

            var graphicsState = g.Save();

            TransformGraphics(g);

            {
                // Three tricks are neccessary to get the color legend (which is the bitmap) drawn smooth and uniformly:
                // Everything other than this will result in distorted image, or soft (unsharp) edges
                var graphicsState2 = g.Save();                   // Of course, save the graphics state so we can make our tricks undone afterwards
                g.InterpolationMode = InterpolationMode.Default; // Trick1: Set the interpolation mode, whatever it was before, back to default
                g.PixelOffsetMode   = PixelOffsetMode.Default;   // Trick2: Set the PixelOffsetMode, whatever it was before, back to default

                g.DrawImage(_bitmap,
                            new RectangleF(0, 0, (float)Size.X, (float)Size.Y),
                            new Rectangle(0, 0, pixelH - 1, pixelV - 1), GraphicsUnit.Pixel); // Trick3: Paint both in X and Y direction one pixel less than the source bitmap acually has, this prevents soft edges

                g.Restore(graphicsState2);                                                    // make our tricks undone here
            }
            _axisStyles.Paint(g, paintContext, _cachedArea);

            g.Restore(graphicsState);
        }
Exemple #26
0
        public override View GetSampleContent(Android.Content.Context con)
        {
            /****************
            **Linear Gauge**
            ****************/
            SfLinearGauge linearGauge = new SfLinearGauge(con);
            ObservableCollection <LinearScale>   scales   = new ObservableCollection <LinearScale>();
            ObservableCollection <LinearPointer> pointers = new ObservableCollection <LinearPointer>();
            ObservableCollection <LinearRange>   ranges   = new ObservableCollection <LinearRange>();

            linearGauge.SetX(0);
            linearGauge.SetY(0);
            linearGauge.SetBackgroundColor(Color.Rgb(255, 255, 255));
            linearGauge.SetOrientation(SfLinearGauge.Orientation.Horizontal);

            var density = con.Resources.DisplayMetrics.Density;

            //Annotation
            LinearGaugeAnnotation annotation = new LinearGaugeAnnotation();

            annotation.ScaleValue = 15;
            annotation.ViewMargin = new PointF(0, 30);
            ImageView imageView = new ImageView(con);

            imageView.SetImageResource(Resource.Drawable.Low);
            LinearLayout layout = new LinearLayout(con);

            layout.LayoutParameters = new LinearLayout.LayoutParams((int)(80 * density), 60);
            layout.SetGravity(GravityFlags.Center);
            layout.AddView(imageView);
            annotation.View = layout;
            linearGauge.Annotations.Add(annotation);

            //Annotation1
            LinearGaugeAnnotation annotation1 = new LinearGaugeAnnotation();

            annotation1.ScaleValue = 45;
            annotation1.ViewMargin = new PointF(0, 30);
            ImageView imageView1 = new ImageView(con);

            imageView1.SetImageResource(Resource.Drawable.Moderate);
            LinearLayout layout1 = new LinearLayout(con);

            layout1.LayoutParameters = new LinearLayout.LayoutParams((int)(80 * density), 60);
            layout1.SetGravity(GravityFlags.Center);
            layout1.AddView(imageView1);
            annotation1.View = layout1;
            linearGauge.Annotations.Add(annotation1);

            //Annotation2
            LinearGaugeAnnotation annotation2 = new LinearGaugeAnnotation();

            annotation2.ScaleValue = 75;
            annotation2.ViewMargin = new PointF(0, 30);
            ImageView imageView2 = new ImageView(con);

            imageView2.SetImageResource(Resource.Drawable.High);
            LinearLayout layout2 = new LinearLayout(con);

            layout2.LayoutParameters = new LinearLayout.LayoutParams((int)(80 * density), 60);
            layout2.SetGravity(GravityFlags.Center);
            layout2.AddView(imageView2);
            annotation2.View = layout2;
            linearGauge.Annotations.Add(annotation2);

            //Annotation3
            LinearGaugeAnnotation annotation3 = new LinearGaugeAnnotation();

            annotation3.ScaleValue = 15;
            annotation3.ViewMargin = new PointF(0, 80);
            TextView text = new TextView(con);

            text.Text = "Low";
            text.SetTextColor(Color.ParseColor("#30b32d"));
            LinearLayout layout3 = new LinearLayout(con);

            layout3.LayoutParameters = new LinearLayout.LayoutParams((int)(60 * density), 60);
            layout3.SetGravity(GravityFlags.Center);
            layout3.AddView(text);
            annotation3.View = layout3;
            linearGauge.Annotations.Add(annotation3);

            //Annotation4
            LinearGaugeAnnotation annotation4 = new LinearGaugeAnnotation();

            annotation4.ScaleValue = 45;
            annotation4.ViewMargin = new PointF(0, 80);
            TextView text1 = new TextView(con);

            text1.Text = "Moderate";
            text1.SetTextColor(Color.ParseColor("#ffdd00"));
            LinearLayout layout4 = new LinearLayout(con);

            layout4.LayoutParameters = new LinearLayout.LayoutParams((int)(90 * density), 60);
            layout4.SetGravity(GravityFlags.Center);
            layout4.AddView(text1);
            annotation4.View = layout4;
            linearGauge.Annotations.Add(annotation4);

            //Annotation5
            LinearGaugeAnnotation annotation5 = new LinearGaugeAnnotation();

            annotation5.ScaleValue = 75;
            annotation5.ViewMargin = new PointF(0, 80);
            TextView text2 = new TextView(con);

            text2.Text = "High";
            text2.SetTextColor(Color.ParseColor("#f03e3e"));
            LinearLayout layout5 = new LinearLayout(con);

            layout5.LayoutParameters = new LinearLayout.LayoutParams((int)(60 * density), 60);
            layout5.SetGravity(GravityFlags.Center);
            layout5.AddView(text2);
            annotation5.View = layout5;
            linearGauge.Annotations.Add(annotation5);

            //Annotation6
            LinearGaugeAnnotation annotation6 = new LinearGaugeAnnotation();

            annotation6.ScaleValue = 45;
            annotation6.ViewMargin = new PointF(0, -50);
            LinearLayout layout6 = new LinearLayout(con);

            layout6.LayoutParameters = new LinearLayout.LayoutParams((int)(200 * density), 100);
            layout6.SetGravity(GravityFlags.Center);
            layout6.AddView(new TextView(con)
            {
                Text = "CPU Utilization", TextSize = 20
            });
            annotation6.View = layout6;
            linearGauge.Annotations.Add(annotation6);

            //OuterScale
            LinearScale outerScale = new LinearScale();

            outerScale.Minimum               = 0;
            outerScale.Maximum               = 90;
            outerScale.ShowLabels            = false;
            outerScale.ScaleBarColor         = Color.Transparent;
            outerScale.Offset                = -50;
            outerScale.MinorTicksPerInterval = 1;
            outerScale.ScaleBarSize          = 13;
            outerScale.ScaleDirection        = LinearScaleDirection.Backward;

            //OuterScale MajorTicksSettings
            LinearTickSettings outerScale_majorTicksSettings = new LinearTickSettings();

            outerScale_majorTicksSettings.Color       = Color.Transparent;
            outerScale_majorTicksSettings.Length      = 0;
            outerScale_majorTicksSettings.StrokeWidth = 1;
            outerScale.MajorTickSettings = outerScale_majorTicksSettings;

            //OuterScale MinorTicksSettings
            LinearTickSettings outerScale_minorTicksSettings = new LinearTickSettings();

            outerScale_minorTicksSettings.Color       = Color.Transparent;
            outerScale_minorTicksSettings.Length      = 0;
            outerScale_minorTicksSettings.StrokeWidth = 1;
            outerScale.MinorTickSettings = outerScale_minorTicksSettings;

            //Symbol Pointer
            SymbolPointer outerScale_needlePointer = new SymbolPointer();

            outerScale_needlePointer.Value       = pointervalue;
            outerScale_needlePointer.StrokeWidth = 12;
            outerScale_needlePointer.Color       = Color.Red;
            outerScale_needlePointer.MarkerShape = MarkerShape.InvertedTriangle;
            pointers.Add(outerScale_needlePointer);
            outerScale.Pointers = pointers;

            //Symbol Range
            LinearRange range = new LinearRange();

            range.StartWidth = 60;
            range.EndWidth   = 60;
            range.Color      = Color.ParseColor("#30b32d");
            range.StartValue = 0;
            range.EndValue   = 30;
            ranges.Add(range);

            //Symbol Range1
            LinearRange range1 = new LinearRange();

            range1.StartWidth = 60;
            range1.EndWidth   = 60;
            range1.Color      = Color.ParseColor("#ffdd00");
            range1.StartValue = 30;
            range1.EndValue   = 60;
            ranges.Add(range1);

            //Symbol Range2
            LinearRange range2 = new LinearRange();

            range2.StartWidth = 60;
            range2.EndWidth   = 60;
            range2.Color      = Color.ParseColor("#f03e3e");
            range2.StartValue = 60;
            range2.EndValue   = 90;
            ranges.Add(range2);
            outerScale.Ranges = ranges;

            scales.Add(outerScale);
            linearGauge.Scales = scales;

            //Main Gauge Layout
            LinearLayout mainLinearGaugeLayout = new LinearLayout(con);

            mainLinearGaugeLayout.Orientation = Android.Widget.Orientation.Vertical;
            mainLinearGaugeLayout.SetBackgroundColor(Color.Rgb(255, 255, 255));
            mainLinearGaugeLayout.SetGravity((GravityFlags)17);

            //Linear Gauge Layout
            LinearLayout linearGaugeLayout = new LinearLayout(con);

            linearGaugeLayout.SetGravity((GravityFlags)17);
            linearGaugeLayout.SetBackgroundColor(Color.Rgb(255, 255, 255));
            mainLinearGaugeLayout.AddView(linearGaugeLayout);
            mainLinearGaugeLayout.AddView(linearGauge);

            return(mainLinearGaugeLayout);
        }
Exemple #27
0
        private void RangeLayout1()
        {
            DisplayMetrics displayMetrics = context.Resources.DisplayMetrics;
            float          screenHeight   = displayMetrics.HeightPixels;

            /****************
            **Linear Gauge**
            ****************/
            linearGauge1 = new SfLinearGauge(context);
            ObservableCollection <LinearScale>   scales   = new ObservableCollection <LinearScale>();
            ObservableCollection <LinearPointer> pointers = new ObservableCollection <LinearPointer>();
            ObservableCollection <LinearRange>   ranges   = new ObservableCollection <LinearRange>();

            linearGauge1.SetX(0);
            linearGauge1.SetY(0);
            linearGauge1.SetBackgroundColor(Color.Rgb(255, 255, 255));
            linearGauge1.SetOrientation(SfLinearGauge.Orientation.Horizontal);

            //OuterScale
            LinearScale outerScale = new LinearScale();

            outerScale.Minimum               = 0;
            outerScale.Maximum               = 100;
            outerScale.Interval              = 25;
            outerScale.LabelOffset           = 15;
            outerScale.ScaleBarColor         = Color.Transparent;
            outerScale.MinorTicksPerInterval = 0;
            outerScale.LabelFontSize         = 14;
            outerScale.LabelColor            = Color.ParseColor("#424242");
            outerScale.ShowTicks             = false;

            //Symbol Pointer
            SymbolPointer outerScale_needlePointer = new SymbolPointer();

            outerScale_needlePointer.SymbolPosition = SymbolPointerPosition.Far;
            outerScale_needlePointer.Value          = pointervalue;
            outerScale_needlePointer.StrokeWidth    = 10;
            outerScale_needlePointer.Color          = Color.Black;
            outerScale_needlePointer.MarkerShape    = MarkerShape.InvertedTriangle;
            pointers.Add(outerScale_needlePointer);
            outerScale.Pointers = pointers;

            //Symbol Range
            LinearRange range = new LinearRange();

            range.StartWidth = 20;
            range.EndWidth   = 20;
            range.Color      = Color.ParseColor("#1A237E");
            range.StartValue = 0;
            range.EndValue   = 25;
            ranges.Add(range);

            //Symbol Range1
            LinearRange range1 = new LinearRange();

            range1.StartWidth = 20;
            range1.EndWidth   = 20;
            range1.Color      = Color.ParseColor("#283593");
            range1.StartValue = 25;
            range1.EndValue   = 50;
            ranges.Add(range1);

            //Symbol Range2
            LinearRange range2 = new LinearRange();

            range2.StartWidth = 20;
            range2.EndWidth   = 20;
            range2.Color      = Color.ParseColor("#3F51B5");
            range2.StartValue = 50;
            range2.EndValue   = 75;
            ranges.Add(range2);

            //Symbol Range3
            LinearRange range3 = new LinearRange();

            range3.StartWidth = 20;
            range3.EndWidth   = 20;
            range3.Color      = Color.ParseColor("#5C6BC0");
            range3.StartValue = 75;
            range3.EndValue   = 100;
            ranges.Add(range3);

            outerScale.Ranges = ranges;

            scales.Add(outerScale);
            linearGauge1.Scales = scales;

            linearGauge1.LayoutParameters = (new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent, (int)(screenHeight / 4)));

            //Range Layout
            range1Layout = new LinearLayout(context);
            range1Layout.SetGravity(GravityFlags.Center);
            range1Layout.AddView(linearGauge1);
        }
Exemple #28
0
        private void RangeLayout3()
        {
            DisplayMetrics displayMetrics = context.Resources.DisplayMetrics;
            float          screenHeight   = displayMetrics.HeightPixels;

            /****************
            **Linear Gauge**
            ****************/
            linearGauge3 = new SfLinearGauge(context);
            ObservableCollection <LinearScale>   scales   = new ObservableCollection <LinearScale>();
            ObservableCollection <LinearPointer> pointers = new ObservableCollection <LinearPointer>();
            ObservableCollection <LinearRange>   ranges   = new ObservableCollection <LinearRange>();

            linearGauge3.SetX(0);
            linearGauge3.SetY(0);
            linearGauge3.SetBackgroundColor(Color.Rgb(255, 255, 255));
            linearGauge3.SetOrientation(SfLinearGauge.Orientation.Horizontal);

            //OuterScale
            LinearScale outerScale = new LinearScale();

            outerScale.LabelFontSize = 14;
            outerScale.Interval      = 25;
            outerScale.LabelOffset   = 15;
            outerScale.ScaleBarSize  = 20;
            outerScale.ScaleBarColor = Color.Transparent;
            outerScale.LabelColor    = Color.ParseColor("#424242");
            outerScale.ShowTicks     = false;

            //Symbol Pointer
            SymbolPointer outerScale_needlePointer = new SymbolPointer();

            outerScale_needlePointer.SymbolPosition = SymbolPointerPosition.Far;
            outerScale_needlePointer.Value          = pointervalue;
            outerScale_needlePointer.StrokeWidth    = 10;
            outerScale_needlePointer.Color          = Color.Black;
            outerScale_needlePointer.MarkerShape    = MarkerShape.InvertedTriangle;
            pointers.Add(outerScale_needlePointer);
            outerScale.Pointers = pointers;

            //Symbol Range
            LinearRange range = new LinearRange();

            range.StartWidth = 20;
            range.EndWidth   = 20;
            range.StartValue = 0;
            range.EndValue   = 100;
            ranges.Add(range);
            outerScale.Ranges   = ranges;
            range.GradientStops = new ObservableCollection <GaugeGradientStop>()
            {
                new GaugeGradientStop()
                {
                    Value = 0, Color = Color.ParseColor("#FFF9C2C3")
                },
                new GaugeGradientStop()
                {
                    Value = 100, Color = Color.ParseColor("#FFD91D71")
                }
            };

            scales.Add(outerScale);
            linearGauge3.Scales = scales;

            linearGauge3.LayoutParameters = (new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent, (int)screenHeight / 4));

            //Range Layout
            range3Layout = new LinearLayout(context);
            range3Layout.SetGravity(GravityFlags.Center);
            range3Layout.AddView(linearGauge3);
        }
        public override View GetSampleContent(Android.Content.Context con)
        {
            /****************
            **Linear Gauge**
            ****************/
            SfLinearGauge linearGauge = new SfLinearGauge(con);
            ObservableCollection <LinearScale>   scales   = new ObservableCollection <LinearScale>();
            ObservableCollection <LinearPointer> pointers = new ObservableCollection <LinearPointer>();

            linearGauge.SetX(0);
            linearGauge.SetY(0);
            linearGauge.SetBackgroundColor(Color.Rgb(255, 255, 255));
            linearGauge.SetOrientation(SfLinearGauge.Orientation.Horizontal);


            //OuterScale
            outerScale                       = new LinearScale();
            outerScale.Minimum               = 0;
            outerScale.Maximum               = 100;
            outerScale.ScaleBarSize          = 40;
            outerScale.Interval              = 10;
            outerScale.ScaleBarColor         = Color.ParseColor("#e0e9f9");
            outerScale.MinorTicksPerInterval = 0;
            outerScale.LabelFontSize         = 14;
            outerScale.LabelColor            = Color.ParseColor("#424242");
            outerScale.CornerRadius          = 20;
            outerScale.CornerRadiusType      = CornerRadiusType.End;

            //OuterScale MajorTicksSettings
            LinearTickSettings outerScale_majorTicksSettings = new LinearTickSettings();

            outerScale_majorTicksSettings.Color       = Color.ParseColor("#9E9E9E");//
            outerScale_majorTicksSettings.Length      = 10;
            outerScale_majorTicksSettings.StrokeWidth = 1;
            outerScale.MajorTickSettings = outerScale_majorTicksSettings;

            //Symbol Pointer
            outerScale_needlePointer = new SymbolPointer();
            outerScale_needlePointer.SymbolPosition  = SymbolPointerPosition.Away;
            outerScale_needlePointer.Value           = pointervalue;
            outerScale_needlePointer.StrokeWidth     = 12;
            outerScale_needlePointer.Color           = Color.ParseColor("#5b86e5");
            outerScale_needlePointer.MarkerShape     = MarkerShape.Triangle;
            outerScale_needlePointer.EnableAnimation = false;
            pointers.Add(outerScale_needlePointer);

            //Bar Pointer
            rangePointer                  = new BarPointer();
            rangePointer.Value            = barvalue;
            rangePointer.StrokeWidth      = 30;
            rangePointer.EnableAnimation  = false;
            rangePointer.CornerRadius     = 15;
            rangePointer.CornerRadiusType = CornerRadiusType.End;
            rangePointer.GradientStops    = new ObservableCollection <GaugeGradientStop>()
            {
                new GaugeGradientStop()
                {
                    Value = 0, Color = Color.ParseColor("#36d1dc")
                },
                new GaugeGradientStop()
                {
                    Value = 75, Color = Color.ParseColor("#5b86e5")
                }
            };
            pointers.Add(rangePointer);
            outerScale.Pointers = pointers;

            scales.Add(outerScale);
            linearGauge.Scales = scales;

            //Linear Gauge Layout
            LinearLayout linearGaugeLayout = new LinearLayout(con);

            linearGaugeLayout.SetBackgroundColor(Color.Rgb(255, 255, 255));
            linearGaugeLayout.AddView(linearGauge);

            return(linearGaugeLayout);
        }
Exemple #30
0
        public LinearGauge_Default()
        {
            InitializeComponent();

            //Scale
            ObservableCollection <LinearScale> scales = new ObservableCollection <LinearScale>();
            LinearScale scale = new LinearScale();

            scale.MinimumValue          = 0;
            scale.MaximumValue          = 100;
            scale.Interval              = 20;
            scale.ScaleBarLength        = 100;
            scale.ScaleBarColor         = Color.FromRgb(250, 236, 236);
            scale.LabelColor            = Color.FromRgb(84, 84, 84);
            scale.MinorTicksPerInterval = 1;
            scale.ScaleBarSize          = 13;
            scale.ScalePosition         = ScalePosition.BackWard;

            //Major Ticks setting
            LinearTickSettings major = new LinearTickSettings();

            major.Length            = 10;
            major.Color             = Color.FromRgb(175, 175, 175);
            major.Thickness         = 1;
            scale.MajorTickSettings = major;

            //Minor Ticks setting
            LinearTickSettings minor = new LinearTickSettings();

            minor.Length            = 10;
            minor.Color             = Color.FromRgb(175, 175, 175);
            minor.Thickness         = 1;
            scale.MinorTickSettings = minor;

            List <LinearPointer> pointers = new List <LinearPointer>();
            //SymbolPointer
            SymbolPointer symbolPointer = new SymbolPointer();

            symbolPointer.Value     = 50;
            symbolPointer.Offset    = 0.0;
            symbolPointer.Thickness = 3;
            symbolPointer.Color     = Color.FromRgb(65, 77, 79);

            //BarPointer
            BarPointer rangePointer = new BarPointer();

            rangePointer.Value = 50;
            rangePointer.Color = Color.FromRgb(206, 69, 69);
            if (Device.Idiom == TargetIdiom.Phone)
            {
                rangePointer.Thickness = 30;
            }
            rangePointer.Thickness = 10;
            pointers.Add(symbolPointer);
            pointers.Add(rangePointer);

            scale.Pointers = pointers;

            //Range
            LinearRange symbolRange = new LinearRange();

            symbolRange.StartValue = 0;
            symbolRange.EndValue   = 50;
            symbolRange.Color      = Color.FromRgb(234, 248, 249);
            symbolRange.StartWidth = 10;
            symbolRange.EndWidth   = 10;
            if (Device.OS == TargetPlatform.Windows)
            {
                symbolRange.Offset = -0.07;
            }
            else
            {
                symbolRange.Offset = -0.17;
            }
            scale.Ranges.Add(symbolRange);

            //Range
            LinearRange pointerRange = new LinearRange();

            pointerRange.StartValue = 50;
            pointerRange.EndValue   = 100;
            pointerRange.Color      = Color.FromRgb(50, 184, 198);
            pointerRange.StartWidth = 10;
            pointerRange.EndWidth   = 10;

            if (Device.OS == TargetPlatform.Windows)
            {
                pointerRange.Offset = -0.07;
                if (Device.Idiom == TargetIdiom.Tablet)
                {
                    gettingStarted.FontSize = 25;
                }
            }
            else
            {
                pointerRange.Offset = -0.17;
            }

            scale.Ranges.Add(pointerRange);
            scales.Add(scale);
            linearGauge.BindingContext = scales;
        }
Exemple #31
0
        public override View GetSampleContent(Context con)
        {
            SfLinearGauge linearGauge = new SfLinearGauge(con);
            //	linearGauge.LayoutParameters =new LinearLayout.LayoutParams(parentLayout.getMeasuredWidth(),parentLayout.getMeasuredHeight()-150);
            ObservableCollection <LinearScale>   scales   = new ObservableCollection <LinearScale> ();
            ObservableCollection <LinearPointer> pointers = new ObservableCollection <LinearPointer> ();
            ObservableCollection <LinearRange>   ranges   = new ObservableCollection <LinearRange> ();

            linearGauge.SetX(0);
            linearGauge.SetY(0);



            linearGauge.SetBackgroundColor(Color.Rgb(255, 255, 255));

            linearGauge.SetOrientation(SfLinearGauge.Orientation.Vertical);

            // adding  new scale
            LinearScale outerScale = new LinearScale();

            outerScale.Minimum               = 0;
            outerScale.Maximum               = 100;
            outerScale.ScaleBarSize          = 50;
            outerScale.ScaleBarLength        = 100;
            outerScale.Interval              = 20;
            outerScale.ScaleBarColor         = Color.ParseColor("#FAECEC");
            outerScale.MinorTicksPerInterval = 2;
            outerScale.LabelFontSize         = 17;
            outerScale.LabelColor            = Color.ParseColor("#545454");
            outerScale.LabelPostfix          = "%";

            //adding major ticks
            LinearTickSettings outerScale_majorTicksSettings = new LinearTickSettings();

            outerScale_majorTicksSettings.Color       = Color.ParseColor("#AFAFAF");       //
            outerScale_majorTicksSettings.Length      = 20;
            outerScale_majorTicksSettings.StrokeWidth = 5;
            outerScale_majorTicksSettings.Offset      = 0;

            outerScale.MajorTickSettings = outerScale_majorTicksSettings;

            //adding minor ticks
            LinearTickSettings outerScale_minorTicksSettings = new LinearTickSettings();

            outerScale_minorTicksSettings.Color       = Color.ParseColor("#AFAFAF");
            outerScale_minorTicksSettings.Length      = 10;
            outerScale_minorTicksSettings.StrokeWidth = 5;
            outerScale_minorTicksSettings.Offset      = 0;
            outerScale.MinorTickSettings = outerScale_minorTicksSettings;

            // adding Symbol Pointer
            SymbolPointer outerScale_needlePointer = new SymbolPointer();

            outerScale_needlePointer.Value       = pointervalue;
            outerScale_needlePointer.StrokeWidth = 0;
            outerScale_needlePointer.Offset      = 0.3f;
            outerScale_needlePointer.Color       = Color.ParseColor("#414D4F");
            pointers.Add(outerScale_needlePointer);

            //adding Bar Pointer
            BarPointer rangePointer = new BarPointer();

            rangePointer.Value       = barvalue;
            rangePointer.Color       = Color.ParseColor("#CE4545");       //
            rangePointer.StrokeWidth = 20;
            pointers.Add(rangePointer);

            outerScale.Pointers = pointers;

            //adding ranges
            LinearRange lowerRange = new LinearRange();

            lowerRange.StartWidth = 30;
            lowerRange.EndWidth   = 30;
            lowerRange.Color      = Color.ParseColor("#67d6db");
            lowerRange.StartValue = 0;
            lowerRange.EndValue   = 50;
            lowerRange.Offset     = -.3;
            ranges.Add(lowerRange);

            LinearRange higherRange = new LinearRange();

            higherRange.StartWidth = 30;
            higherRange.EndWidth   = 30;
            higherRange.Color      = Color.ParseColor("#32B8C6");
            higherRange.StartValue = 50;
            higherRange.EndValue   = 100;
            higherRange.Offset     = -.3;
            ranges.Add(higherRange);

            outerScale.Ranges = ranges;


            scales.Add(outerScale);
            linearGauge.Scales = scales;
            TextView textview = new TextView(con);

            textview.Text     = "Memory Usage";
            textview.TextSize = 20;
            textview.SetTextColor(Color.ParseColor("#CE4545"));

            LinearLayout ln = new LinearLayout(con);

            ln.Orientation = Orientation.Vertical;

            ln.SetBackgroundColor(Color.Rgb(255, 255, 255));
            ln.SetGravity((GravityFlags)17);

            LinearLayout ln1 = new LinearLayout(con);

            ln1.AddView(textview);
            ln1.SetGravity((GravityFlags)17);

            ln1.SetBackgroundColor(Color.Rgb(255, 255, 255));

            ln.AddView(ln1);
            ln.AddView(linearGauge);
            return(ln);
        }
		public LinearGauge ()
		{
			//InitializeComponent ();
			linearGauge = new SfLinearGauge ();
			linearGauge.BackgroundColor = Color.White;
			linearGauge.Orientation = Syncfusion.SfGauge.XForms.Orientation.OrientationVertical;
			//Scale
			ObservableCollection<LinearScale> scales = new ObservableCollection<LinearScale> ();
			LinearScale scale = new LinearScale ();
			scale.MinimumValue = 0;
			scale.MaximumValue = 100;
			scale.Interval = 20;
			scale.ScaleBarLength = 100;
			//			scale.LabelPostfix = "%";
			scale.ScaleBarColor = Color.FromRgb (250, 236, 236);
			scale.LabelColor = Color.FromRgb (84, 84, 84); 
			scale.MinorTicksPerInterval = 1;
			scale.ScaleBarSize = 13;
			scale.ScalePosition = ScalePosition.BackWard;
			List<LinearPointer> pointers = new List<LinearPointer> ();
			//SymbolPointer
			SymbolPointer symbolPointer = new SymbolPointer ();
			symbolPointer.Value = 50;
			symbolPointer.Offset = 0.0;
			symbolPointer.Thickness = 3;
			symbolPointer.Color = Color.FromRgb (65, 77, 79);

			//BarPointer
			BarPointer rangePointer = new BarPointer ();
			rangePointer.Value = 50;
			rangePointer.Color = Color.FromRgb (206, 69, 69);
			rangePointer.Thickness = 10;
			pointers.Add (symbolPointer);
			pointers.Add (rangePointer);

			//Range
			LinearRange range = new LinearRange ();
			range.StartValue = 0;
			range.EndValue = 50;
			range.Color = Color.FromRgb (234, 248, 249);
			range.StartWidth = 10;
			range.EndWidth = 10;
            if (Device.OS == TargetPlatform.Windows)
            {
                range.Offset = -0.07;
            }
            else
            range.Offset = -0.17;
			scale.Ranges.Add (range);


			//Range
			LinearRange range2 = new LinearRange ();
			range2.StartValue = 50;
			range2.EndValue = 100;
			range2.Color = Color.FromRgb (50, 184, 198);
			range2.StartWidth = 10;
            range2.EndWidth = 10; 
            if (Device.OS == TargetPlatform.Windows)
            {
                range2.Offset = -0.07;
            }
            else
			range2.Offset = -0.17;
			scale.Ranges.Add (range2);

			//Minor Ticks setting
			LinearTickSettings minor = new LinearTickSettings ();
			minor.Length = 10;
			minor.Color = Color.FromRgb (175, 175, 175);
			minor.Thickness = 1;
			scale.MinorTickSettings = minor;

			//Major Ticks setting
			LinearTickSettings major = new LinearTickSettings ();
			major.Length = 10;
			major.Color = Color.FromRgb (175, 175, 175);
			major.Thickness = 1;
			scale.MajorTickSettings = major;

			scale.Pointers = pointers;
			scales.Add (scale);
			linearGauge.Scales = scales;



			Label label;
			if (Device.OS == TargetPlatform.iOS) {
				label = new Label () {
					Text = "Memory Usage",HorizontalOptions = LayoutOptions.Center,
					HeightRequest = 50,
					TextColor = Color.Black
				};
				label.FontAttributes = FontAttributes.Bold;
				label.FontSize = 25;
			} else {
				label = new Label () {
					Text = "Memory Usage",HorizontalOptions = LayoutOptions.Center,
					HeightRequest = 50,
					TextColor = Color.Black
				};
				label.FontAttributes = FontAttributes.Bold;
				label.FontSize = 25;
			}

			var mainStack = new StackLayout {
				BackgroundColor = Color.White,
				Spacing = 10,
				Padding = Device.OnPlatform (iOS: 10, Android : 10, WinPhone : 50),
				Children = { label, linearGauge }
			};
			mainStack.SizeChanged += (object sender, EventArgs e) => {
				linearGauge.HeightRequest = mainStack.Height - 150;
				linearGauge.WidthRequest = mainStack.Width - 50;

			};
			this.ContentView = mainStack;
			//this.BackgroundColor = Color.Black;
		}