Ejemplo n.º 1
0
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                int hashCode = 41;

                if (Type != null)
                {
                    hashCode = hashCode * 59 + Type.GetHashCode();
                }

                if (Visible != null)
                {
                    hashCode = hashCode * 59 + Visible.GetHashCode();
                }

                if (LegendGroup != null)
                {
                    hashCode = hashCode * 59 + LegendGroup.GetHashCode();
                }

                if (Name != null)
                {
                    hashCode = hashCode * 59 + Name.GetHashCode();
                }

                if (UId != null)
                {
                    hashCode = hashCode * 59 + UId.GetHashCode();
                }

                if (Ids != null)
                {
                    hashCode = hashCode * 59 + Ids.GetHashCode();
                }

                if (CustomData != null)
                {
                    hashCode = hashCode * 59 + CustomData.GetHashCode();
                }

                if (Meta != null)
                {
                    hashCode = hashCode * 59 + Meta.GetHashCode();
                }

                if (MetaArray != null)
                {
                    hashCode = hashCode * 59 + MetaArray.GetHashCode();
                }

                if (HoverLabel != null)
                {
                    hashCode = hashCode * 59 + HoverLabel.GetHashCode();
                }

                if (Stream != null)
                {
                    hashCode = hashCode * 59 + Stream.GetHashCode();
                }

                if (UiRevision != null)
                {
                    hashCode = hashCode * 59 + UiRevision.GetHashCode();
                }

                if (X != null)
                {
                    hashCode = hashCode * 59 + X.GetHashCode();
                }

                if (Y != null)
                {
                    hashCode = hashCode * 59 + Y.GetHashCode();
                }

                if (Z != null)
                {
                    hashCode = hashCode * 59 + Z.GetHashCode();
                }

                if (Value != null)
                {
                    hashCode = hashCode * 59 + Value.GetHashCode();
                }

                if (IsoMin != null)
                {
                    hashCode = hashCode * 59 + IsoMin.GetHashCode();
                }

                if (IsoMax != null)
                {
                    hashCode = hashCode * 59 + IsoMax.GetHashCode();
                }

                if (Surface != null)
                {
                    hashCode = hashCode * 59 + Surface.GetHashCode();
                }

                if (SpaceFrame != null)
                {
                    hashCode = hashCode * 59 + SpaceFrame.GetHashCode();
                }

                if (Slices != null)
                {
                    hashCode = hashCode * 59 + Slices.GetHashCode();
                }

                if (Caps != null)
                {
                    hashCode = hashCode * 59 + Caps.GetHashCode();
                }

                if (Text != null)
                {
                    hashCode = hashCode * 59 + Text.GetHashCode();
                }

                if (TextArray != null)
                {
                    hashCode = hashCode * 59 + TextArray.GetHashCode();
                }

                if (HoverText != null)
                {
                    hashCode = hashCode * 59 + HoverText.GetHashCode();
                }

                if (HoverTextArray != null)
                {
                    hashCode = hashCode * 59 + HoverTextArray.GetHashCode();
                }

                if (HoverTemplate != null)
                {
                    hashCode = hashCode * 59 + HoverTemplate.GetHashCode();
                }

                if (HoverTemplateArray != null)
                {
                    hashCode = hashCode * 59 + HoverTemplateArray.GetHashCode();
                }

                if (CAuto != null)
                {
                    hashCode = hashCode * 59 + CAuto.GetHashCode();
                }

                if (CMin != null)
                {
                    hashCode = hashCode * 59 + CMin.GetHashCode();
                }

                if (CMax != null)
                {
                    hashCode = hashCode * 59 + CMax.GetHashCode();
                }

                if (CMid != null)
                {
                    hashCode = hashCode * 59 + CMid.GetHashCode();
                }

                if (ColorScale != null)
                {
                    hashCode = hashCode * 59 + ColorScale.GetHashCode();
                }

                if (AutoColorScale != null)
                {
                    hashCode = hashCode * 59 + AutoColorScale.GetHashCode();
                }

                if (ReverseScale != null)
                {
                    hashCode = hashCode * 59 + ReverseScale.GetHashCode();
                }

                if (ShowScale != null)
                {
                    hashCode = hashCode * 59 + ShowScale.GetHashCode();
                }

                if (ColorBar != null)
                {
                    hashCode = hashCode * 59 + ColorBar.GetHashCode();
                }

                if (ColorAxis != null)
                {
                    hashCode = hashCode * 59 + ColorAxis.GetHashCode();
                }

                if (Opacity != null)
                {
                    hashCode = hashCode * 59 + Opacity.GetHashCode();
                }

                if (OpacityScale != null)
                {
                    hashCode = hashCode * 59 + OpacityScale.GetHashCode();
                }

                if (LightPosition != null)
                {
                    hashCode = hashCode * 59 + LightPosition.GetHashCode();
                }

                if (Lighting != null)
                {
                    hashCode = hashCode * 59 + Lighting.GetHashCode();
                }

                if (FlatShading != null)
                {
                    hashCode = hashCode * 59 + FlatShading.GetHashCode();
                }

                if (Contour != null)
                {
                    hashCode = hashCode * 59 + Contour.GetHashCode();
                }

                if (HoverInfo != null)
                {
                    hashCode = hashCode * 59 + HoverInfo.GetHashCode();
                }

                if (HoverInfoArray != null)
                {
                    hashCode = hashCode * 59 + HoverInfoArray.GetHashCode();
                }

                if (ShowLegend != null)
                {
                    hashCode = hashCode * 59 + ShowLegend.GetHashCode();
                }

                if (Scene != null)
                {
                    hashCode = hashCode * 59 + Scene.GetHashCode();
                }

                if (IdsSrc != null)
                {
                    hashCode = hashCode * 59 + IdsSrc.GetHashCode();
                }

                if (CustomDataSrc != null)
                {
                    hashCode = hashCode * 59 + CustomDataSrc.GetHashCode();
                }

                if (MetaSrc != null)
                {
                    hashCode = hashCode * 59 + MetaSrc.GetHashCode();
                }

                if (XSrc != null)
                {
                    hashCode = hashCode * 59 + XSrc.GetHashCode();
                }

                if (YSrc != null)
                {
                    hashCode = hashCode * 59 + YSrc.GetHashCode();
                }

                if (ZSrc != null)
                {
                    hashCode = hashCode * 59 + ZSrc.GetHashCode();
                }

                if (ValueSrc != null)
                {
                    hashCode = hashCode * 59 + ValueSrc.GetHashCode();
                }

                if (TextSrc != null)
                {
                    hashCode = hashCode * 59 + TextSrc.GetHashCode();
                }

                if (HoverTextSrc != null)
                {
                    hashCode = hashCode * 59 + HoverTextSrc.GetHashCode();
                }

                if (HoverTemplateSrc != null)
                {
                    hashCode = hashCode * 59 + HoverTemplateSrc.GetHashCode();
                }

                if (HoverInfoSrc != null)
                {
                    hashCode = hashCode * 59 + HoverInfoSrc.GetHashCode();
                }

                return(hashCode);
            }
        }
Ejemplo n.º 2
0
        protected override void OnPaint(PaintEventArgs e)
        {
            const float EXTENUATED_MOVEMENT_FACTOR = 0.6f;

            e.Graphics.Clear(BackColor);

            e.Graphics.CompositingMode    = _compositingMode;
            e.Graphics.CompositingQuality = _compositingQuality;
            e.Graphics.PixelOffsetMode    = _pixelOffsetMode;
            e.Graphics.SmoothingMode      = _smoothingMode;
            e.Graphics.InterpolationMode  = _interpolationMode;

            base.OnPaint(e);

            if (Slices?.Count < 1)
            {
                return;
            }

            var offsetAlpha = Math.Max(Math.Min((Math.Abs(Offset.X) + Math.Abs(Offset.Y)) / 25, 50), 0);
            var zoomAlpha = Zoom == 0 ? 0 : Math.Min(Zoom / 10, 50);
            var depthAlpha = Depth == 0 ? 0 : Math.Min(Depth / 10, 50);
            var sliceAlpha = new[] { offsetAlpha, zoomAlpha, depthAlpha }.Max();

            using (var sliceBackBrush = new SolidBrush(Color.FromArgb(sliceAlpha, Color.Black)))
                using (var sliceBorderPen = new Pen(Color.FromArgb(20, Color.Black)))
                {
                    var maxSliceSize = new Size(Slices.Max(l => l.Width), Slices.Max(l => l.Height));
                    var originLeft   = (Width - maxSliceSize.Width) / 2;
                    var originTop    = (Height - maxSliceSize.Height) / 2;

                    for (int i = 0; i < Slices.Count; i++)
                    {
                        var slice = Slices[i];

                        var offsetAffectFactor = 0.0d;

                        if (TwoWaySpring)
                        {
                            offsetAffectFactor = (((double)i - (double)(Slices.Count / 2)) / (double)Slices.Count * 2);
                        }
                        else
                        {
                            offsetAffectFactor = (double)i / (double)Slices.Count;
                        }

                        var zoomAffectFactor = (double)(i + 1 /* +1 makes the last slice move with the zoom as well */) / (double)Slices.Count;
                        if (Zoom < 0)
                        {
                            zoomAffectFactor = Zoom;
                        }

                        var depthAffectFactor = ((double)Slices.Count - (double)(i + 1)) * EXTENUATED_MOVEMENT_FACTOR / (double)Slices.Count;

                        var left = originLeft + (int)(offsetAffectFactor * Offset.X);
                        var top  = originTop + (int)(offsetAffectFactor * Offset.Y);

                        var rect = new Rectangle(left, top, slice.Width, slice.Height);

                        var infateBy = (Zoom * zoomAffectFactor) - (Depth * depthAffectFactor);
                        var ratio    = ((double)slice.Width / (double)slice.Height);
                        rect.Inflate((int)(infateBy * ratio), (int)(infateBy));

                        if (rect.Height > Height || rect.Width > Width)
                        {
                            continue;
                        }

                        e.Graphics.FillRectangle(sliceBackBrush, rect);

                        e.Graphics.DrawImage(slice, rect);

                        if (sliceAlpha > 0)
                        {
                            e.Graphics.DrawRectangle(sliceBorderPen, rect);
                        }
                    }
                }
        }
Ejemplo n.º 3
0
        public bool Equals([AllowNull] Volume other)
        {
            if (other == null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return((Type == other.Type && Type != null && other.Type != null && Type.Equals(other.Type)) &&
                   (Visible == other.Visible && Visible != null && other.Visible != null && Visible.Equals(other.Visible)) &&
                   (LegendGroup == other.LegendGroup && LegendGroup != null && other.LegendGroup != null && LegendGroup.Equals(other.LegendGroup)) &&
                   (Name == other.Name && Name != null && other.Name != null && Name.Equals(other.Name)) &&
                   (UId == other.UId && UId != null && other.UId != null && UId.Equals(other.UId)) &&
                   (Equals(Ids, other.Ids) || Ids != null && other.Ids != null && Ids.SequenceEqual(other.Ids)) &&
                   (Equals(CustomData, other.CustomData) || CustomData != null && other.CustomData != null && CustomData.SequenceEqual(other.CustomData)) &&
                   (Meta == other.Meta && Meta != null && other.Meta != null && Meta.Equals(other.Meta)) &&
                   (Equals(MetaArray, other.MetaArray) || MetaArray != null && other.MetaArray != null && MetaArray.SequenceEqual(other.MetaArray)) &&
                   (HoverLabel == other.HoverLabel && HoverLabel != null && other.HoverLabel != null && HoverLabel.Equals(other.HoverLabel)) &&
                   (Stream == other.Stream && Stream != null && other.Stream != null && Stream.Equals(other.Stream)) &&
                   (UiRevision == other.UiRevision && UiRevision != null && other.UiRevision != null && UiRevision.Equals(other.UiRevision)) &&
                   (Equals(X, other.X) || X != null && other.X != null && X.SequenceEqual(other.X)) &&
                   (Equals(Y, other.Y) || Y != null && other.Y != null && Y.SequenceEqual(other.Y)) &&
                   (Equals(Z, other.Z) || Z != null && other.Z != null && Z.SequenceEqual(other.Z)) &&
                   (Equals(Value, other.Value) || Value != null && other.Value != null && Value.SequenceEqual(other.Value)) &&
                   (IsoMin == other.IsoMin && IsoMin != null && other.IsoMin != null && IsoMin.Equals(other.IsoMin)) &&
                   (IsoMax == other.IsoMax && IsoMax != null && other.IsoMax != null && IsoMax.Equals(other.IsoMax)) &&
                   (Surface == other.Surface && Surface != null && other.Surface != null && Surface.Equals(other.Surface)) &&
                   (SpaceFrame == other.SpaceFrame && SpaceFrame != null && other.SpaceFrame != null && SpaceFrame.Equals(other.SpaceFrame)) &&
                   (Slices == other.Slices && Slices != null && other.Slices != null && Slices.Equals(other.Slices)) &&
                   (Caps == other.Caps && Caps != null && other.Caps != null && Caps.Equals(other.Caps)) &&
                   (Text == other.Text && Text != null && other.Text != null && Text.Equals(other.Text)) &&
                   (Equals(TextArray, other.TextArray) || TextArray != null && other.TextArray != null && TextArray.SequenceEqual(other.TextArray)) &&
                   (HoverText == other.HoverText && HoverText != null && other.HoverText != null && HoverText.Equals(other.HoverText)) &&
                   (Equals(HoverTextArray, other.HoverTextArray) || HoverTextArray != null && other.HoverTextArray != null && HoverTextArray.SequenceEqual(other.HoverTextArray)) &&
                   (HoverTemplate == other.HoverTemplate && HoverTemplate != null && other.HoverTemplate != null && HoverTemplate.Equals(other.HoverTemplate)) &&
                   (Equals(HoverTemplateArray, other.HoverTemplateArray) ||
                    HoverTemplateArray != null && other.HoverTemplateArray != null && HoverTemplateArray.SequenceEqual(other.HoverTemplateArray)) &&
                   (CAuto == other.CAuto && CAuto != null && other.CAuto != null && CAuto.Equals(other.CAuto)) &&
                   (CMin == other.CMin && CMin != null && other.CMin != null && CMin.Equals(other.CMin)) &&
                   (CMax == other.CMax && CMax != null && other.CMax != null && CMax.Equals(other.CMax)) &&
                   (CMid == other.CMid && CMid != null && other.CMid != null && CMid.Equals(other.CMid)) &&
                   (ColorScale == other.ColorScale && ColorScale != null && other.ColorScale != null && ColorScale.Equals(other.ColorScale)) &&
                   (AutoColorScale == other.AutoColorScale && AutoColorScale != null && other.AutoColorScale != null && AutoColorScale.Equals(other.AutoColorScale)) &&
                   (ReverseScale == other.ReverseScale && ReverseScale != null && other.ReverseScale != null && ReverseScale.Equals(other.ReverseScale)) &&
                   (ShowScale == other.ShowScale && ShowScale != null && other.ShowScale != null && ShowScale.Equals(other.ShowScale)) &&
                   (ColorBar == other.ColorBar && ColorBar != null && other.ColorBar != null && ColorBar.Equals(other.ColorBar)) &&
                   (ColorAxis == other.ColorAxis && ColorAxis != null && other.ColorAxis != null && ColorAxis.Equals(other.ColorAxis)) &&
                   (Opacity == other.Opacity && Opacity != null && other.Opacity != null && Opacity.Equals(other.Opacity)) &&
                   (OpacityScale == other.OpacityScale && OpacityScale != null && other.OpacityScale != null && OpacityScale.Equals(other.OpacityScale)) &&
                   (LightPosition == other.LightPosition && LightPosition != null && other.LightPosition != null && LightPosition.Equals(other.LightPosition)) &&
                   (Lighting == other.Lighting && Lighting != null && other.Lighting != null && Lighting.Equals(other.Lighting)) &&
                   (FlatShading == other.FlatShading && FlatShading != null && other.FlatShading != null && FlatShading.Equals(other.FlatShading)) &&
                   (Contour == other.Contour && Contour != null && other.Contour != null && Contour.Equals(other.Contour)) &&
                   (HoverInfo == other.HoverInfo && HoverInfo != null && other.HoverInfo != null && HoverInfo.Equals(other.HoverInfo)) &&
                   (Equals(HoverInfoArray, other.HoverInfoArray) || HoverInfoArray != null && other.HoverInfoArray != null && HoverInfoArray.SequenceEqual(other.HoverInfoArray)) &&
                   (ShowLegend == other.ShowLegend && ShowLegend != null && other.ShowLegend != null && ShowLegend.Equals(other.ShowLegend)) &&
                   (Scene == other.Scene && Scene != null && other.Scene != null && Scene.Equals(other.Scene)) &&
                   (IdsSrc == other.IdsSrc && IdsSrc != null && other.IdsSrc != null && IdsSrc.Equals(other.IdsSrc)) &&
                   (CustomDataSrc == other.CustomDataSrc && CustomDataSrc != null && other.CustomDataSrc != null && CustomDataSrc.Equals(other.CustomDataSrc)) &&
                   (MetaSrc == other.MetaSrc && MetaSrc != null && other.MetaSrc != null && MetaSrc.Equals(other.MetaSrc)) &&
                   (XSrc == other.XSrc && XSrc != null && other.XSrc != null && XSrc.Equals(other.XSrc)) &&
                   (YSrc == other.YSrc && YSrc != null && other.YSrc != null && YSrc.Equals(other.YSrc)) &&
                   (ZSrc == other.ZSrc && ZSrc != null && other.ZSrc != null && ZSrc.Equals(other.ZSrc)) &&
                   (ValueSrc == other.ValueSrc && ValueSrc != null && other.ValueSrc != null && ValueSrc.Equals(other.ValueSrc)) &&
                   (TextSrc == other.TextSrc && TextSrc != null && other.TextSrc != null && TextSrc.Equals(other.TextSrc)) &&
                   (HoverTextSrc == other.HoverTextSrc && HoverTextSrc != null && other.HoverTextSrc != null && HoverTextSrc.Equals(other.HoverTextSrc)) &&
                   (HoverTemplateSrc == other.HoverTemplateSrc && HoverTemplateSrc != null && other.HoverTemplateSrc != null && HoverTemplateSrc.Equals(other.HoverTemplateSrc)) &&
                   (HoverInfoSrc == other.HoverInfoSrc && HoverInfoSrc != null && other.HoverInfoSrc != null && HoverInfoSrc.Equals(other.HoverInfoSrc)));
        }
Ejemplo n.º 4
0
 public void AddSlice(int sliceId, Slice slice)
 {
     Slices.Add(sliceId, slice);
     Width  = Math.Max(Width, slice.Width);
     Height = Math.Max(Height, slice.Height);
 }
Ejemplo n.º 5
0
 public IEnumerable <IntPtr> GetSlicePointers()
 {
     return(Slices.Select(i => i.Pixels));
 }
Ejemplo n.º 6
0
        internal void Draw()
        {
            if (!IsControlLaoded)
            {
                return;
            }

            //No cache for you gauge :( kill and redraw please
            foreach (var child in Canvas.Children.Cast <UIElement>()
                     .Where(x => !Equals(x, Stick) && !(x is AngularSection) && !(x is PieSlice)).ToArray())
            {
                Canvas.Children.Remove(child);
            }

            Wedge = Wedge > 360 ? 360 : (Wedge < 0 ? 0 : Wedge);

            var fromAlpha = (360 - Wedge) * .5;
            var toAlpha   = 360 - fromAlpha;

            var d = ActualWidth < ActualHeight ? ActualWidth : ActualHeight;

            Stick.Height = d * .5 * .8;
            Stick.Width  = Stick.Height * .2;

            Canvas.SetLeft(Stick, ActualWidth * .5 - Stick.Width * .5);
            Canvas.SetTop(Stick, ActualHeight * .5 - Stick.Height * .9);

            var ticksHi  = d * .5;
            var ticksHj  = d * .47;
            var labelsHj = d * .44;

            foreach (var section in Sections)
            {
                PieSlice slice;

                section.Owner = this;

                if (!Slices.TryGetValue(section, out slice))
                {
                    slice           = new PieSlice();
                    Slices[section] = slice;
                }

                var p = (Canvas)section.Parent;
                if (p != null)
                {
                    p.Children.Remove(section);
                }
                Canvas.Children.Add(section);
                var ps = (Canvas)slice.Parent;
                if (ps != null)
                {
                    ps.Children.Remove(slice);
                }
                Canvas.Children.Add(slice);
            }

            UpdateSections();

            var ts = double.IsNaN(TicksStep) ? DecideInterval((ToValue - FromValue) / 5) : TicksStep;

            if (ts / (FromValue - ToValue) > 300)
            {
                throw new LiveChartsException("TicksStep property is too small compared with the range in " +
                                              "the gauge, to avoid performance issues, please increase it.");
            }

            for (var i = FromValue; i <= ToValue; i += ts)
            {
                var alpha = LinearInterpolation(fromAlpha, toAlpha, FromValue, ToValue, i) + 90;

                var tick = new Line
                {
                    X1 = ActualWidth * .5 + ticksHi * Math.Cos(alpha * Math.PI / 180),
                    X2 = ActualWidth * .5 + ticksHj * Math.Cos(alpha * Math.PI / 180),
                    Y1 = ActualHeight * .5 + ticksHi * Math.Sin(alpha * Math.PI / 180),
                    Y2 = ActualHeight * .5 + ticksHj * Math.Sin(alpha * Math.PI / 180)
                };
                Canvas.Children.Add(tick);
                tick.SetBinding(Shape.StrokeProperty,
                                new Binding {
                    Path = new PropertyPath(TicksForegroundProperty), Source = this
                });
                tick.SetBinding(Shape.StrokeThicknessProperty,
                                new Binding {
                    Path = new PropertyPath(TicksStrokeThicknessProperty), Source = this
                });
            }

            var ls = double.IsNaN(LabelsStep) ? DecideInterval((ToValue - FromValue) / 5) : LabelsStep;

            if (ls / (FromValue - ToValue) > 300)
            {
                throw new LiveChartsException("LabelsStep property is too small compared with the range in " +
                                              "the gauge, to avoid performance issues, please increase it.");
            }

            for (var i = FromValue; i <= ToValue; i += ls)
            {
                var alpha = LinearInterpolation(fromAlpha, toAlpha, FromValue, ToValue, i) + 90;

                var tick = new Line
                {
                    X1 = ActualWidth * .5 + ticksHi * Math.Cos(alpha * Math.PI / 180),
                    X2 = ActualWidth * .5 + labelsHj * Math.Cos(alpha * Math.PI / 180),
                    Y1 = ActualHeight * .5 + ticksHi * Math.Sin(alpha * Math.PI / 180),
                    Y2 = ActualHeight * .5 + labelsHj * Math.Sin(alpha * Math.PI / 180)
                };

                Canvas.Children.Add(tick);
                var label = new TextBlock
                {
                    Text = LabelFormatter(i)
                };

                label.SetBinding(EffectProperty,
                                 new Binding {
                    Path = new PropertyPath(LabelsEffectProperty), Source = this
                });

                Canvas.Children.Add(label);
                label.UpdateLayout();
                Canvas.SetLeft(label, alpha < 270
                    ? tick.X2
                    : (Math.Abs(alpha - 270) < 4
                        ? tick.X2 - label.ActualWidth * .5
                        : tick.X2 - label.ActualWidth));
                Canvas.SetTop(label, tick.Y2);
                tick.SetBinding(Shape.StrokeProperty,
                                new Binding {
                    Path = new PropertyPath(TicksForegroundProperty), Source = this
                });
                tick.SetBinding(Shape.StrokeThicknessProperty,
                                new Binding {
                    Path = new PropertyPath(TicksStrokeThicknessProperty), Source = this
                });
            }
            MoveStick();
        }
Ejemplo n.º 7
0
        internal void Draw()
        {
            if (!IsControlLaoded)
            {
                return;
            }

            //No cache for you gauge :( kill and redraw please
            foreach (var child in Canvas.Children
                     .Where(x => !Equals(x, Stick) && !(x is AngularSection) && !(x is PieSlice)).ToArray())
            {
                Canvas.Children.Remove(child);
            }

            Wedge = Wedge > 360 ? 360 : (Wedge < 0 ? 0 : Wedge);

            var fromAlpha = (360 - Wedge) * .5;
            var toAlpha   = 360 - fromAlpha;

            var d = ActualWidth < ActualHeight ? ActualWidth : ActualHeight;

            Stick.Height = d * .5 * .8;
            Stick.Width  = Stick.Height * .2;

            Canvas.SetLeft(Stick, ActualWidth * .5 - Stick.Width * .5);
            Canvas.SetTop(Stick, ActualHeight * .5 - Stick.Height * .9);

            var ticksHi  = d * .5;
            var ticksHj  = d * .47;
            var labelsHj = d * .44;

            foreach (var section in Sections)
            {
                PieSlice slice;
                section.Owner = this;

                if (!Slices.TryGetValue(section, out slice))
                {
                    slice           = new PieSlice();
                    Slices[section] = slice;
                }

                var p = (Canvas)section.Parent;
                p?.Children.Remove(section);
                Canvas.Children.Add(section);
                var ps = (Canvas)slice.Parent;
                ps?.Children.Remove(slice);
                Canvas.Children.Add(slice);
            }

            UpdateSections();

            for (var i = FromValue; i <= ToValue; i += TicksStep)
            {
                var alpha = LinearInterpolation(fromAlpha, toAlpha, FromValue, ToValue, i) + 90;

                var tick = new Line
                {
                    X1 = ActualWidth * .5 + ticksHi * Math.Cos(alpha * Math.PI / 180),
                    X2 = ActualWidth * .5 + ticksHj * Math.Cos(alpha * Math.PI / 180),
                    Y1 = ActualHeight * .5 + ticksHi * Math.Sin(alpha * Math.PI / 180),
                    Y2 = ActualHeight * .5 + ticksHj * Math.Sin(alpha * Math.PI / 180)
                };
                Canvas.Children.Add(tick);
                tick.SetBinding(Shape.StrokeProperty,
                                new Binding {
                    Path = new PropertyPath("TicksForeground"), Source = this
                });
                tick.SetBinding(Shape.StrokeThicknessProperty,
                                new Binding {
                    Path = new PropertyPath("TicksStrokeThickness"), Source = this
                });
            }

            for (var i = FromValue; i <= ToValue; i += LabelsStep)
            {
                var alpha = LinearInterpolation(fromAlpha, toAlpha, FromValue, ToValue, i) + 90;

                var tick = new Line
                {
                    X1 = ActualWidth * .5 + ticksHi * Math.Cos(alpha * Math.PI / 180),
                    X2 = ActualWidth * .5 + labelsHj * Math.Cos(alpha * Math.PI / 180),
                    Y1 = ActualHeight * .5 + ticksHi * Math.Sin(alpha * Math.PI / 180),
                    Y2 = ActualHeight * .5 + labelsHj * Math.Sin(alpha * Math.PI / 180)
                };

                Canvas.Children.Add(tick);
                var label = new TextBlock
                {
                    Text = LabelFormatter(i)
                };

                //label.SetBinding(EffectProperty,
                //new Binding {Path = new PropertyPath("LabelsEffect"), Source = this});

                Canvas.Children.Add(label);
                label.UpdateLayout();
                Canvas.SetLeft(label, alpha < 270
                    ? tick.X2
                    : (Math.Abs(alpha - 270) < 4
                        ? tick.X2 - label.ActualWidth * .5
                        : tick.X2 - label.ActualWidth));
                Canvas.SetTop(label, tick.Y2);
                tick.SetBinding(Shape.StrokeProperty,
                                new Binding {
                    Path = new PropertyPath("TicksForeground"), Source = this
                });
                tick.SetBinding(Shape.StrokeThicknessProperty,
                                new Binding {
                    Path = new PropertyPath("TicksStrokeThickness"), Source = this
                });
            }
            MoveStick();
        }