public static Color32 GetLineGradientColor(VisualMap visualMap, Vector3 pos, GridCoord grid, Axis axis,
                                                   Axis relativedAxis, Color32 defaultColor)
        {
            double value = 0;
            double min   = 0;
            double max   = 0;

            if (visualMap.dimension == 0)
            {
                min = axis.context.minValue;
                max = axis.context.maxValue;
                if (axis.IsCategory() && axis.boundaryGap)
                {
                    float startX = grid.context.x + axis.context.scaleWidth / 2;
                    value = (min + (pos.x - startX) / (grid.context.width - axis.context.scaleWidth) * (max - min));
                    if (visualMap.IsPiecewise())
                    {
                        value = (int)value;
                    }
                }
                else
                {
                    value = min + (pos.x - grid.context.x) / grid.context.width * (max - min);
                }
            }
            else
            {
                min = relativedAxis.context.minValue;
                max = relativedAxis.context.maxValue;
                if (relativedAxis.IsCategory() && relativedAxis.boundaryGap)
                {
                    float startY = grid.context.y + relativedAxis.context.scaleWidth / 2;
                    value = (min + (pos.y - startY) / (grid.context.height - relativedAxis.context.scaleWidth) * (max - min));
                    if (visualMap.IsPiecewise())
                    {
                        value = (int)value;
                    }
                }
                else
                {
                    value = min + (pos.y - grid.context.y) / grid.context.height * (max - min);
                }
            }

            var color = visualMap.GetColor(value);

            if (ChartHelper.IsClearColor(color))
            {
                return(defaultColor);
            }
            else
            {
                if (color.a != 0)
                {
                    color.a = defaultColor.a;
                }

                return(color);
            }
        }
 public static void GetLineGradientColor(VisualMap visualMap, float xValue, float yValue,
                                         out Color32 startColor, out Color32 toColor)
 {
     startColor = ChartConst.clearColor32;
     toColor    = ChartConst.clearColor32;
     if (visualMap.dimension == 0)
     {
         startColor = visualMap.IsPiecewise() ? visualMap.GetColor(xValue) : visualMap.GetColor(xValue - 1);
         toColor    = visualMap.IsPiecewise() ? startColor : visualMap.GetColor(xValue);
     }
     else
     {
         startColor = visualMap.IsPiecewise() ? visualMap.GetColor(yValue) : visualMap.GetColor(yValue - 1);
         toColor    = visualMap.IsPiecewise() ? startColor : visualMap.GetColor(yValue);
     }
 }