public static IRenderer Renderer(AnimationMode mode, FitChartValue value, RectF drawingArea) { if (mode == AnimationMode.Linear) { return new LinearValueRenderer (drawingArea, value); } else { return new OverdrawValueRenderer (drawingArea, value); } }
private float CalculateSweepAngle(float animationSeek, FitChartValue value) { float result; var totalSizeOfValue = value.StartAngle + value.SweepAngle; if (totalSizeOfValue > animationSeek) { result = animationSeek - value.StartAngle; } else { result = value.SweepAngle; } return result; }
public void SetValue(float value) { chartValues.Clear (); var chartValue = new FitChartValue (value, valueStrokeColor); chartValue.Paint = BuildPaintForValue(); chartValue.StartAngle = StartAngle; chartValue.SweepAngle = CalculateSweepAngle(value); chartValues.Add(chartValue); maxSweepAngle = chartValue.SweepAngle; PlayAnimation(); }
public LinearValueRenderer (RectF drawingArea, FitChartValue value) : base(drawingArea, value) { }
public BaseRenderer (RectF drawingArea, FitChartValue value) { DrawingArea = drawingArea; Value = value; }
private void RenderValue(Canvas canvas, FitChartValue value) { if (!IsInEditMode) { var animationSeek = CalculateAnimationSeek (); var renderer = RendererFactory.Renderer (AnimationMode, value, drawingArea); var path = renderer.BuildPath (animationProgress, animationSeek); if (path != null) { canvas.DrawPath (path, value.Paint); } } else { var path = new Path (); path.AddArc (drawingArea, StartAngle, DesignModeSweepAngle); canvas.DrawPath (path, valueDesignPaint); } }
public OverdrawValueRenderer (RectF drawingArea, FitChartValue value) : base(drawingArea, value) { }