public override void ApplyState( SceneModifier modifier, RectangleF diagramBounds, BarSeriesPointLayoutParameters barParameters, float progress) { float startPositionX = diagramBounds.Left + diagramBounds.Width / 2; float startPositionY = diagramBounds.Top + diagramBounds.Height / 2; RectangleF barBounds = barParameters.Bounds; float endPositionX = barBounds.Left + barBounds.Width / 2; float endPositionY = barBounds.Top + barBounds.Height / 2; // Moves bar from the diagram center to its position on the diagram. modifier.Translate( (startPositionX - endPositionX) * (1 - progress), (startPositionY - endPositionY) * (1 - progress) ); // Scales bar. // Note that methods requiered for correct transform are called in inverse order. // This is a feature of affine transformations. modifier.Translate(endPositionX, endPositionY); modifier.Scale(progress, progress); modifier.Translate(-endPositionX, -endPositionY); }
public override void ApplyState( SceneModifier modifier, RectangleF diagramBounds, MarkerSeriesPointLayoutParameters markerParameters, float progress) { modifier.Translate(-markerParameters.Bounds.Right * (1 - progress), 0); }
public override void ApplyState(SceneModifier modifier, Rectangle diagramBounds, float progress) { float currentWidth = diagramBounds.Width * progress; float currentHeight = diagramBounds.Height * progress; float diagramCenterX = diagramBounds.X + diagramBounds.Width / 2.0f; float diagramCenterY = diagramBounds.Y + diagramBounds.Height / 2.0f; float dx = (currentWidth - diagramBounds.Width) / 2; float dy = (currentHeight - diagramBounds.Height) / 2; modifier.Translate(-dx, -dy); modifier.Scale(progress, progress); modifier.Translate(diagramCenterX, diagramCenterY); modifier.Rotate(progress * 360 * RotationCount); modifier.Translate(-diagramCenterX, -diagramCenterY); }
public override void ApplyState( SceneModifier modifier, RectangleF diagramBounds, FunnelSeriesPointLayoutParameters funnelParameters, float progress ) { RectangleF funnelBounds = funnelParameters.Bounds; float fanCenterX = funnelBounds.Left + funnelBounds.Width / 2; float fanCenterY = funnelBounds.Bottom; float fanRadius = (float)Math.Sqrt( (funnelBounds.Left - fanCenterX) * (funnelBounds.Left - fanCenterX) + (funnelBounds.Height) * (funnelBounds.Height) ); float startAngle = AnimationStartAngle - HalfMaxSweepAngle * progress; float sweepAngle = MaxSweepAngle * progress; float endAngle = startAngle + sweepAngle; float fanLeftBoundEndX = fanCenterX + (float)Math.Cos(startAngle / 180 * Math.PI) * fanRadius; float fanLeftBoundEndY = fanCenterY + (float)Math.Sin(startAngle / 180 * Math.PI) * fanRadius; float fanRightBoundEndX = fanCenterX + (float)Math.Cos(endAngle / 180 * Math.PI) * fanRadius; float fanRightBoundEndY = fanCenterY + (float)Math.Sin(endAngle / 180 * Math.PI) * fanRadius; RectangleF fanBounds = new RectangleF( fanCenterX - fanRadius, fanCenterY - fanRadius, 2 * fanRadius, 2 * fanRadius ); GraphicsPath path = new GraphicsPath(); path.AddLine(fanCenterX, fanCenterY, fanLeftBoundEndX, fanLeftBoundEndY); path.AddArc(fanBounds, startAngle, sweepAngle); path.AddLine(fanRightBoundEndX, fanRightBoundEndY, fanCenterX, fanCenterY); modifier.Clip(path); }
public override void ApplyState( SceneModifier modifier, RectangleF diagramBounds, PieSeriesPointLayoutParameters pieParameters, float progress ) { float pieCenterX = pieParameters.PieCenter.X; float pieCenterY = pieParameters.PieCenter.Y; float scale = (progress <= 0.5) ? 1 - 0.2f * progress : 0.8f + 0.2f * progress; // Note that methods requiered for correct transform are called in inverse order. // This is a feature of affine transformations. modifier.Translate(pieCenterX, pieCenterY); modifier.Scale(scale, scale); modifier.Translate(-pieCenterX, -pieCenterY); }
public override void ApplyState( SceneModifier modifier, RectangleF diagramBounds, MarkerSeriesPointLayoutParameters markerParameters, float progress ) { RectangleF markerBounds = markerParameters.Bounds; float markerCenterX = markerBounds.Left + markerBounds.Width / 2; float markerCenterY = markerBounds.Top + markerBounds.Height / 2; float startAngle = 360 - progress * 180; float sweepAngle = 360 * progress; float endAngle = startAngle + sweepAngle; // To apply a fan animation we need to compute parameters of // a marker's circumscribed сircle sector. float circumscribedCircleRadius = (float)Math.Sqrt( (markerBounds.Left - markerCenterX) * (markerBounds.Left - markerCenterX) + (markerBounds.Top - markerCenterY) * (markerBounds.Top - markerCenterY) ); float circumscribedCircleSectorLeftBoundEndX = markerCenterX + (float)Math.Cos(startAngle / 180 * Math.PI) * circumscribedCircleRadius; float circumscribedCircleSectorLeftBoundEndY = markerCenterY + (float)Math.Sin(startAngle / 180 * Math.PI) * circumscribedCircleRadius; float circumscribedCircleSectorRightBoundEndX = markerCenterX + (float)Math.Cos(endAngle / 180 * Math.PI) * circumscribedCircleRadius; float circumscribedCircleSectorRightBoundEndY = markerCenterY + (float)Math.Sin(endAngle / 180 * Math.PI) * circumscribedCircleRadius; RectangleF circumscribedCircleBounds = new RectangleF( markerCenterX - circumscribedCircleRadius, markerCenterY - circumscribedCircleRadius, 2 * circumscribedCircleRadius, 2 * circumscribedCircleRadius ); // Path representing a marker's circumscribed circle sector. GraphicsPath path = new GraphicsPath(); path.AddLine( markerCenterX, markerCenterY, circumscribedCircleSectorLeftBoundEndX, circumscribedCircleSectorLeftBoundEndY ); path.AddArc( circumscribedCircleBounds, startAngle, sweepAngle ); path.AddLine( circumscribedCircleSectorRightBoundEndX, circumscribedCircleSectorRightBoundEndY, markerCenterX, markerCenterY ); modifier.Clip(path); }