Example #1
0
        public static Color32 GetLineColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, bool highlight)
        {
            Color32 color     = ChartConst.clearColor32;
            var     lineStyle = GetLineStyle(serie, serieData);

            if (highlight)
            {
                var itemStyleEmphasis = GetItemStyleEmphasis(serie, null);
                if (itemStyleEmphasis != null && !ChartHelper.IsClearColor(itemStyleEmphasis.color))
                {
                    color = itemStyleEmphasis.color;
                    ChartHelper.SetColorOpacity(ref color, itemStyleEmphasis.opacity);
                    return(color);
                }
            }
            if (!ChartHelper.IsClearColor(lineStyle.color))
            {
                color = lineStyle.color;
            }
            else if (!ChartHelper.IsClearColor(serie.itemStyle.color))
            {
                color = serie.itemStyle.GetColor();
            }
            if (ChartHelper.IsClearColor(color))
            {
                color = theme.GetColor(index);
            }
            ChartHelper.SetColorOpacity(ref color, lineStyle.opacity);
            if (highlight)
            {
                color = ChartHelper.GetHighlightColor(color);
            }
            return(color);
        }
Example #2
0
        public static Color32 GetAreaToColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, bool highlight)
        {
            Color32 color     = ChartConst.clearColor32;
            var     areaStyle = GetAreaStyle(serie, serieData);

            if (areaStyle == null || !areaStyle.show)
            {
                return(color);
            }
            if (!ChartHelper.IsClearColor(areaStyle.toColor))
            {
                color = areaStyle.toColor;
            }
            else if (!ChartHelper.IsClearColor(serie.itemStyle.toColor))
            {
                color = serie.itemStyle.toColor;
            }
            else
            {
                color = theme.GetColor(index);
            }
            ChartHelper.SetColorOpacity(ref color, areaStyle.opacity);
            if (highlight)
            {
                if (!ChartHelper.IsClearColor(areaStyle.highlightToColor))
                {
                    color = areaStyle.highlightToColor;
                }
                else
                {
                    color = ChartHelper.GetHighlightColor(color);
                }
            }
            return(color);
        }
Example #3
0
        public static Color32 GetItemColor0(Serie serie, SerieData serieData, ThemeStyle theme, bool highlight, Color32 defaultColor)
        {
            if (serie == null)
            {
                return(ChartConst.clearColor32);
            }

            ItemStyle itemStyle = null;

            if (highlight)
            {
                itemStyle = GetItemStyleEmphasis(serie, serieData);
            }
            if (itemStyle == null)
            {
                itemStyle = GetItemStyle(serie, serieData);
            }

            var color = ChartHelper.IsClearColor(itemStyle.color0) ?
                        defaultColor :
                        itemStyle.color0;

            if (highlight)
            {
                color = ChartHelper.GetHighlightColor(color);
            }

            ChartHelper.SetColorOpacity(ref color, itemStyle.opacity);
            return(color);
        }
Example #4
0
        public static Color32 GetItemColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, bool highlight, bool opacity = true)
        {
            if (serie == null)
            {
                return(ChartConst.clearColor32);
            }

            ItemStyle itemStyle = null;

            if (highlight)
            {
                itemStyle = GetItemStyleEmphasis(serie, serieData);
            }
            if (itemStyle == null)
            {
                itemStyle = GetItemStyle(serie, serieData);
            }

            var color = ChartHelper.IsClearColor(itemStyle.color) ?
                        theme.GetColor(index) :
                        itemStyle.color;

            if (highlight)
            {
                color = ChartHelper.GetHighlightColor(color);
            }
            if (opacity)
            {
                ChartHelper.SetColorOpacity(ref color, itemStyle.opacity);
            }
            return(color);
        }
Example #5
0
        public static Color32 GetLineColor(Tooltip tooltip, ThemeStyle theme)
        {
            var lineStyle = tooltip.lineStyle;

            if (!ChartHelper.IsClearColor(lineStyle.color))
            {
                return(lineStyle.GetColor());
            }
            else
            {
                var color = theme.tooltip.lineColor;
                ChartHelper.SetColorOpacity(ref color, lineStyle.opacity);
                return(color);
            }
        }
Example #6
0
        public static Color32 GetItemBackgroundColor(Serie serie, SerieData serieData, ThemeStyle theme, int index,
                                                     bool highlight, bool useDefault = true)
        {
            var color = ChartConst.clearColor32;

            if (highlight)
            {
                var itemStyleEmphasis = GetItemStyleEmphasis(serie, serieData);
                if (itemStyleEmphasis != null && !ChartHelper.IsClearColor(itemStyleEmphasis.backgroundColor))
                {
                    color = itemStyleEmphasis.backgroundColor;
                    ChartHelper.SetColorOpacity(ref color, itemStyleEmphasis.opacity);
                    return(color);
                }
            }
            var itemStyle = GetItemStyle(serie, serieData);

            if (!ChartHelper.IsClearColor(itemStyle.backgroundColor))
            {
                color = itemStyle.backgroundColor;
                if (highlight)
                {
                    color = ChartHelper.GetHighlightColor(color);
                }
                ChartHelper.SetColorOpacity(ref color, itemStyle.opacity);
                return(color);
            }
            else if (useDefault)
            {
                color = theme.GetColor(index);
                if (highlight)
                {
                    color = ChartHelper.GetHighlightColor(color);
                }
                color.a = 50;
                return(color);
            }
            return(color);
        }