private void Draw() { _pieSlices.Clear(); gridRotateTransform.CenterX = this.RenderSize.Width / 2; gridRotateTransform.CenterY = this.RenderSize.Height / 2; var startAngle = 0; var color = BackgroundColor; if (Slices != null) { foreach (var slice in Slices) { var sliceSize = 360 / Slices.Count(); var pieSlice = new PieSlice { StartAngle = startAngle, Angle = sliceSize, Radius = Size / 2, BackgroundColor = color, Label = slice, ForegroundColor = ForegroundColor, HideLabel = HideLabels, }; _pieSlices.Add(pieSlice); startAngle += sliceSize; color = color.Lighten(); } } }
/** * CreateSlice * Add a new slice: with at least Coord and Dimension */ public void CreateSlice(Coord position, Dimension dimension, string name = "", AhsvImage image = null) { // get default name or string passed string sliceName = (name.Length < 2) ? "new Slice" + Slices.Count() : name; // ahsvImage can be null; Slices.Add(new SlicedImage(sliceName, position, dimension, image)); }