Exemple #1
0
        internal static Color32 GetItemStyleGradientColor(ItemStyle itemStyle, Vector3 pos, CoordinateChart chart, Axis axis, Color32 defaultColor)
        {
            var min   = axis.runtimeMinValue;
            var max   = axis.runtimeMaxValue;
            var value = min + (pos.x - chart.coordinateX) / chart.coordinateWidth * (max - min);
            var rate  = (value - min) / (max - min);
            var color = itemStyle.GetGradientColor(rate, defaultColor);

            if (ChartHelper.IsClearColor(color))
            {
                return(defaultColor);
            }
            else
            {
                return(color);
            }
        }
Exemple #2
0
        public static Color32 GetItemStyleGradientColor(ItemStyle itemStyle, Vector3 pos, CoordinateChart chart,
                                                        Axis axis, Color32 defaultColor)
        {
            var min   = axis.runtimeMinValue;
            var max   = axis.runtimeMaxValue;
            var grid  = chart.GetAxisGridOrDefault(axis);
            var value = min + (pos.x - grid.runtimeX) / grid.runtimeWidth * (max - min);
            var rate  = (value - min) / (max - min);
            var color = itemStyle.GetGradientColor((float)rate, defaultColor);

            if (ChartHelper.IsClearColor(color))
            {
                return(defaultColor);
            }
            else
            {
                return(color);
            }
        }