示例#1
0
        /// <summary>
        ///     Initializes the series colors if they are not set
        /// </summary>
        public override void InitializeColors()
        {
            var wpfChart  = (Chart)Model.Chart.View;
            var nextColor = wpfChart.GetNextDefaultColor();

            if (Stroke == null)
            {
                SetValue(StrokeProperty, new SolidColorBrush(nextColor));
            }
            if (Fill == null)
            {
                SetValue(FillProperty, new SolidColorBrush(nextColor));
            }

            var defaultColdColor = new Color
            {
                A = (byte)(nextColor.A * (DefaultFillOpacity > 1
                    ? 1
                    : DefaultFillOpacity < 0
                        ? 0
                        : DefaultFillOpacity)),
                R = nextColor.R,
                G = nextColor.G,
                B = nextColor.B
            };

            if (!GradientStopCollection.Any())
            {
                GradientStopCollection.Add(new GradientStop
                {
                    Color  = defaultColdColor,
                    Offset = 0
                });
                GradientStopCollection.Add(new GradientStop
                {
                    Color  = nextColor,
                    Offset = 1
                });
            }
        }