void CreateChart() { pies.Clear(); // define the figure origin and size var figureOrigin = new D2DPoint(300, 300); var figureSize = new D2DSize(300, 300); var records = new float[] { .6f, .3f, .1f }; float currentAngle = 0; // create pie geometries from records foreach (var record in records) { var angleSpan = record * 360; var path = Device.CreatePieGeometry(figureOrigin, figureSize, currentAngle, currentAngle + angleSpan); pies.Add(new PieInfo { path = path, color = D2DColor.Randomly() }); currentAngle += angleSpan; } Invalidate(); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); const int NODE_COUNT = 1000; for (int i = 0; i < NODE_COUNT; i++) { var node = new Node() { text = "Node" + i, rect = new D2DRect(rand.Next(ClientRectangle.Width), rand.Next(ClientRectangle.Height), 100, 20), color = D2DColor.Randomly(), fontSize = rand.Next(12, 24), speed = (float)(rand.NextDouble() * 2.0), }; nodes.Add(node); } }