/// <summary>
        /// 获得分割线条数
        /// </summary>
        /// <param name="dataZoom"></param>
        /// <returns></returns>
        public static int GetScaleNumber(Axis axis, float coordinateWidth, DataZoom dataZoom = null)
        {
            int splitNum = GetSplitNumber(axis, coordinateWidth, dataZoom);

            if (splitNum == 0)
            {
                return(0);
            }
            if (axis.IsCategory())
            {
                var data     = axis.GetDataList(dataZoom);
                var scaleNum = 0;

                if (axis.boundaryGap)
                {
                    scaleNum = data.Count % splitNum == 0 ? splitNum + 1 : splitNum + 2;
                }
                else
                {
                    if (data.Count < splitNum)
                    {
                        scaleNum = splitNum;
                    }
                    else
                    {
                        scaleNum = data.Count % splitNum == 0 ? splitNum : splitNum + 1;
                    }
                }
                return(scaleNum);
            }
            else
            {
                return(splitNum + 1);
            }
        }
        public static Color32 GetLineGradientColor(VisualMap visualMap, Vector3 pos, CoordinateChart chart, Axis axis,
                                                   Color32 defaultColor)
        {
            float value = 0;
            var   min   = 0f;
            var   max   = 0f;

            if (visualMap.dimension == 0)
            {
                min = axis.runtimeMinValue;
                max = axis.runtimeMaxValue;
                var grid = chart.GetAxisGridOrDefault(axis);
                if (axis.IsCategory() && axis.boundaryGap)
                {
                    float startX = grid.runtimeX + axis.runtimeScaleWidth / 2;
                    value = (int)(min + (pos.x - startX) / (grid.runtimeWidth - axis.runtimeScaleWidth) * (max - min));
                }
                else
                {
                    value = min + (pos.x - grid.runtimeX) / grid.runtimeWidth * (max - min);
                }
            }
            else
            {
                Axis yAxis;
                if (axis is YAxis)
                {
                    yAxis = chart.xAxes[axis.index];
                    min   = yAxis.runtimeMinValue;
                    max   = yAxis.runtimeMaxValue;
                }
                else
                {
                    yAxis = chart.yAxes[axis.index];
                    min   = yAxis.runtimeMinValue;
                    max   = yAxis.runtimeMaxValue;
                }
                var grid = chart.GetAxisGridOrDefault(axis);
                if (yAxis.IsCategory() && yAxis.boundaryGap)
                {
                    float startY = grid.runtimeY + yAxis.runtimeScaleWidth / 2;
                    value = (int)(min + (pos.y - startY) / (grid.runtimeHeight - yAxis.runtimeScaleWidth) * (max - min));
                }
                else
                {
                    value = min + (pos.y - grid.runtimeY) / grid.runtimeHeight * (max - min);
                }
            }
            var color = visualMap.GetColor(value);

            if (ChartHelper.IsClearColor(color))
            {
                return(defaultColor);
            }
            else
            {
                return(color);
            }
        }
Пример #3
0
        /// <summary>
        /// 获得分割线条数
        /// </summary>
        /// <param name="dataZoom"></param>
        /// <returns></returns>
        internal static int GetScaleNumber(Axis axis, float coordinateWidth, DataZoom dataZoom = null)
        {
            int splitNum = GetSplitNumber(axis, coordinateWidth, dataZoom);

            if (axis.IsCategory())
            {
                int tick = Mathf.RoundToInt(axis.data.Count * 1f / splitNum);
                return(Mathf.CeilToInt(axis.data.Count * 1.0f / tick) + 1);
            }
            else
            {
                return(splitNum + 1);
            }
        }
 public static bool NeedShowSplit(Axis axis)
 {
     if (!axis.show)
     {
         return(false);
     }
     if (axis.IsCategory() && axis.GetDataList().Count <= 0)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
Пример #5
0
 private void GetStartEndPos(Axis xAxis, Axis yAxis, Grid grid, double value, ref Vector3 sp, ref Vector3 ep)
 {
     if (xAxis.IsCategory())
     {
         var pY = AxisHelper.GetAxisPosition(grid, yAxis, value);
         sp = new Vector3(grid.runtimeX, pY);
         ep = new Vector3(grid.runtimeX + grid.runtimeWidth, pY);
     }
     else
     {
         var pX = AxisHelper.GetAxisPosition(grid, xAxis, value);
         sp = new Vector3(pX, grid.runtimeY);
         ep = new Vector3(pX, grid.runtimeY + grid.runtimeHeight);
     }
 }
Пример #6
0
 internal static bool NeedShowSplit(Axis axis)
 {
     if (!axis.show)
     {
         return(false);
     }
     if (axis.IsCategory() && axis.data.Count <= 0)
     {
         return(false);
     }
     else if (axis.IsValue() && axis.runtimeMinValue == 0 && axis.runtimeMaxValue == 0)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
Пример #7
0
        private void UpdateAxisMinMaxValue(Axis axis, bool updateChart = true)
        {
            if (axis.IsCategory() || !axis.show)
            {
                return;
            }
            double tempMinValue = 0;
            double tempMaxValue = 0;

            if (axis is RadiusAxis)
            {
                SeriesHelper.GetXMinMaxValue(m_Series, null, axis.polarIndex, true, axis.inverse, out tempMinValue,
                                             out tempMaxValue, true);
            }
            else
            {
                SeriesHelper.GetYMinMaxValue(m_Series, null, axis.polarIndex, true, axis.inverse, out tempMinValue,
                                             out tempMaxValue, true);
            }
            AxisHelper.AdjustMinMaxValue(axis, ref tempMinValue, ref tempMaxValue, true);
            if (tempMinValue != axis.runtimeMinValue || tempMaxValue != axis.runtimeMaxValue)
            {
                m_IsPlayingAnimation = true;
                var needCheck = !m_IsPlayingAnimation && axis.runtimeLastCheckInverse == axis.inverse;
                axis.UpdateMinValue(tempMinValue, needCheck);
                axis.UpdateMaxValue(tempMaxValue, needCheck);
                axis.runtimeZeroXOffset      = 0;
                axis.runtimeZeroYOffset      = 0;
                axis.runtimeLastCheckInverse = axis.inverse;
                if (updateChart)
                {
                    UpdateAxisLabelText(axis);
                    RefreshChart();
                }
            }
            if (axis.IsValueChanging(500) && !m_IsPlayingAnimation)
            {
                UpdateAxisLabelText(axis);
                RefreshChart();
            }
        }
Пример #8
0
        /// <summary>
        /// 获得分割线条数
        /// </summary>
        /// <param name="dataZoom"></param>
        /// <returns></returns>
        public static int GetScaleNumber(Axis axis, float coordinateWidth, DataZoom dataZoom = null)
        {
            int splitNum = GetSplitNumber(axis, coordinateWidth, dataZoom);

            if (axis.IsCategory())
            {
                var data = axis.GetDataList(dataZoom);
                int tick = Mathf.RoundToInt(data.Count * 1f / splitNum);
                if (axis.boundaryGap)
                {
                    return(Mathf.CeilToInt(data.Count * 1.0f / tick) + 1);
                }
                else
                {
                    return(Mathf.CeilToInt(data.Count * 1.0f / tick));
                }
            }
            else
            {
                return(splitNum + 1);
            }
        }
        public static float GetAxisPosition(Grid grid, Axis axis, double value, int dataCount = 0, DataZoom dataZoom = null)
        {
            var gridHeight = axis is YAxis ? grid.runtimeHeight : grid.runtimeWidth;
            var gridXY     = axis is YAxis ? grid.runtimeY : grid.runtimeX;

            if (axis.IsCategory())
            {
                if (dataCount == 0)
                {
                    dataCount = axis.data.Count;
                }
                var   categoryIndex = (int)value;
                var   scaleWid      = AxisHelper.GetDataWidth(axis, grid.runtimeHeight, dataCount, dataZoom);
                float startY        = gridXY + (axis.boundaryGap ? scaleWid / 2 : 0);
                return(startY + scaleWid * categoryIndex);
            }
            else
            {
                var yDataHig = (axis.runtimeMinMaxRange == 0) ? 0f :
                               (float)((value - axis.runtimeMinValue) / axis.runtimeMinMaxRange * gridHeight);
                return(gridXY + yDataHig);
            }
        }
Пример #10
0
        /// <summary>
        /// 获得分割段宽度
        /// </summary>
        /// <param name="coordinateWidth"></param>
        /// <param name="dataZoom"></param>
        /// <returns></returns>
        internal static float GetScaleWidth(Axis axis, float coordinateWidth, int index, DataZoom dataZoom = null)
        {
            if (index < 0)
            {
                return(0);
            }
            int num      = GetScaleNumber(axis, coordinateWidth, dataZoom);
            int splitNum = GetSplitNumber(axis, coordinateWidth, dataZoom);

            if (num <= 0)
            {
                num = 1;
            }
            if (axis.type == Axis.AxisType.Value && axis.interval > 0)
            {
                if (axis.runtimeMinMaxRange <= 0)
                {
                    return(0);
                }
                if (index >= splitNum)
                {
                    return(coordinateWidth - (index - 1) * axis.interval * coordinateWidth / axis.runtimeMinMaxRange);
                }
                else
                {
                    return(axis.interval * coordinateWidth / axis.runtimeMinMaxRange);
                }
            }
            else
            {
                if (axis.IsCategory() && axis.data.Count > 0)
                {
                    int tick  = Mathf.RoundToInt(axis.data.Count * 1f / splitNum);
                    var count = axis.boundaryGap ? axis.data.Count : axis.data.Count - 1;
                    if (count <= 0)
                    {
                        return(0);
                    }
                    var each = coordinateWidth / count;
                    if (index >= num - 1)
                    {
                        if (axis.axisTick.alignWithLabel)
                        {
                            return(each * tick);
                        }
                        else
                        {
                            return(coordinateWidth - each * tick * (index - 1));
                        }
                    }
                    else
                    {
                        return(each * tick);
                    }
                }
                else
                {
                    if (splitNum <= 0)
                    {
                        return(0);
                    }
                    else
                    {
                        return(coordinateWidth / splitNum);
                    }
                }
            }
        }
        /// <summary>
        /// 获得分割段宽度
        /// </summary>
        /// <param name="coordinateWidth"></param>
        /// <param name="dataZoom"></param>
        /// <returns></returns>
        public static float GetScaleWidth(Axis axis, float coordinateWidth, int index, DataZoom dataZoom = null)
        {
            if (index < 0)
            {
                return(0);
            }
            int num      = GetScaleNumber(axis, coordinateWidth, dataZoom);
            int splitNum = GetSplitNumber(axis, coordinateWidth, dataZoom);

            if (num <= 0)
            {
                num = 1;
            }
            if (axis.type == Axis.AxisType.Value && axis.interval > 0)
            {
                if (axis.runtimeMinMaxRange <= 0)
                {
                    return(0);
                }
                if (index >= splitNum)
                {
                    return((float)(coordinateWidth - (index - 1) * axis.interval * coordinateWidth / axis.runtimeMinMaxRange));
                }
                else
                {
                    return((float)(axis.interval * coordinateWidth / axis.runtimeMinMaxRange));
                }
            }
            else
            {
                var data = axis.GetDataList(dataZoom);
                if (axis.IsCategory() && data.Count > 0)
                {
                    var count = axis.boundaryGap ? data.Count : data.Count - 1;
                    int tick  = count / splitNum;
                    if (count <= 0)
                    {
                        return(0);
                    }
                    var each = coordinateWidth / count;
                    if (axis.insertDataToHead)
                    {
                        var max = axis.boundaryGap ? splitNum : splitNum - 1;
                        if (index == 1)
                        {
                            if (axis.axisTick.alignWithLabel)
                            {
                                return(each * tick);
                            }
                            else
                            {
                                return(coordinateWidth - each * tick * max);
                            }
                        }
                        else
                        {
                            if (count < splitNum)
                            {
                                return(each);
                            }
                            else
                            {
                                return(each * (count / splitNum));
                            }
                        }
                    }
                    else
                    {
                        var max = axis.boundaryGap ? num - 1 : num;
                        if (index >= max)
                        {
                            if (axis.axisTick.alignWithLabel)
                            {
                                return(each * tick);
                            }
                            else
                            {
                                return(coordinateWidth - each * tick * (index - 1));
                            }
                        }
                        else
                        {
                            if (count < splitNum)
                            {
                                return(each);
                            }
                            else
                            {
                                return(each * (count / splitNum));
                            }
                        }
                    }
                }
                else
                {
                    if (splitNum <= 0)
                    {
                        return(0);
                    }
                    else
                    {
                        return(coordinateWidth / splitNum);
                    }
                }
            }
        }
Пример #12
0
        protected void InitAxis(Axis relativedAxis, Orient orient,
                                float axisStartX, float axisStartY, float axisLength, float relativedLength)
        {
            Axis axis = component;

            chart.InitAxisRuntimeData(axis);

            var objName = ChartCached.GetComponentObjectName(axis);
            var axisObj = ChartHelper.AddObject(objName,
                                                chart.transform,
                                                chart.chartMinAnchor,
                                                chart.chartMaxAnchor,
                                                chart.chartPivot,
                                                chart.chartSizeDelta);

            axisObj.SetActive(axis.show);
            axisObj.hideFlags = chart.chartHideFlags;
            ChartHelper.HideAllObject(axisObj);

            axis.gameObject = axisObj;
            axis.context.labelObjectList.Clear();

            if (!axis.show)
            {
                return;
            }

            var axisLabelTextStyle = axis.axisLabel.textStyle;
            var dataZoom           = chart.GetDataZoomOfAxis(axis);
            var splitNumber        = AxisHelper.GetScaleNumber(axis, axisLength, dataZoom);
            var totalWidth         = 0f;
            var eachWidth          = AxisHelper.GetEachWidth(axis, axisLength, dataZoom);
            var gapWidth           = axis.boundaryGap ? eachWidth / 2 : 0;

            var textWidth = axis.axisLabel.width > 0 ?
                            axis.axisLabel.width :
                            (orient == Orient.Horizonal ?
                             AxisHelper.GetScaleWidth(axis, axisLength, 0, dataZoom) :
                             (axisStartX - chart.chartX)
                            );

            var textHeight = axis.axisLabel.height > 0 ?
                             axis.axisLabel.height :
                             20f;

            var isPercentStack   = SeriesHelper.IsPercentStack <Bar>(chart.series);
            var inside           = axis.axisLabel.inside;
            var defaultAlignment = orient == Orient.Horizonal ? TextAnchor.MiddleCenter :
                                   ((inside && axis.IsLeft()) || (!inside && axis.IsRight()) ?
                                    TextAnchor.MiddleLeft :
                                    TextAnchor.MiddleRight);

            if (axis.IsCategory() && axis.boundaryGap)
            {
                splitNumber -= 1;
            }

            for (int i = 0; i < splitNumber; i++)
            {
                var labelWidth = AxisHelper.GetScaleWidth(axis, axisLength, i + 1, dataZoom);
                var labelName  = AxisHelper.GetLabelName(axis, axisLength, i,
                                                         axis.context.minValue,
                                                         axis.context.maxValue,
                                                         dataZoom, isPercentStack);

                var label = ChartHelper.AddAxisLabelObject(splitNumber, i,
                                                           ChartCached.GetAxisLabelName(i),
                                                           axisObj.transform,
                                                           new Vector2(textWidth, textHeight),
                                                           axis, chart.theme.axis, labelName,
                                                           Color.clear,
                                                           defaultAlignment);

                if (i == 0)
                {
                    axis.axisLabel.SetRelatedText(label.text, labelWidth);
                }

                var pos = GetLabelPosition(totalWidth + gapWidth, i);
                label.SetPosition(pos);
                CheckValueLabelActive(axis, i, label, pos);

                axis.context.labelObjectList.Add(label);

                totalWidth += labelWidth;
            }
            if (axis.axisName.show)
            {
                ChartLabel label         = null;
                var        relativedDist = (relativedAxis == null ? 0 : relativedAxis.context.offset);
                var        zeroPos       = new Vector3(axisStartX, axisStartY + relativedDist);
                var        offset        = axis.axisName.labelStyle.offset;
                var        autoColor     = axis.axisLine.GetColor(chart.theme.axis.lineColor);
                if (orient == Orient.Horizonal)
                {
                    var grid = chart.GetChartComponent <GridCoord>(axis.gridIndex);
                    var posY = !axis.axisName.onZero && grid != null? grid.context.y : GetAxisLineXOrY() + offset.y;
                    switch (axis.axisName.labelStyle.position)
                    {
                    case LabelStyle.Position.Start:

                        label = ChartHelper.AddChartLabel(s_DefaultAxisName, axisObj.transform, axis.axisName.labelStyle,
                                                          chart.theme.axis, axis.axisName.name, autoColor, TextAnchor.MiddleRight);
                        label.SetActive(axis.axisName.labelStyle.show);
                        label.SetPosition(axis.position == Axis.AxisPosition.Top ?
                                          new Vector2(zeroPos.x - offset.x, axisStartY + relativedLength + offset.y + axis.offset) :
                                          new Vector2(zeroPos.x - offset.x, posY));
                        break;

                    case LabelStyle.Position.Middle:

                        label = ChartHelper.AddChartLabel(s_DefaultAxisName, axisObj.transform, axis.axisName.labelStyle,
                                                          chart.theme.axis, axis.axisName.name, autoColor, TextAnchor.MiddleCenter);
                        label.SetActive(axis.axisName.labelStyle.show);
                        label.SetPosition(axis.position == Axis.AxisPosition.Top ?
                                          new Vector2(axisStartX + axisLength / 2 + offset.x, axisStartY + relativedLength - offset.y + axis.offset) :
                                          new Vector2(axisStartX + axisLength / 2 + offset.x, posY));
                        break;

                    default:

                        label = ChartHelper.AddChartLabel(s_DefaultAxisName, axisObj.transform, axis.axisName.labelStyle,
                                                          chart.theme.axis, axis.axisName.name, autoColor, TextAnchor.MiddleLeft);
                        label.SetActive(axis.axisName.labelStyle.show);
                        label.SetPosition(axis.position == Axis.AxisPosition.Top ?
                                          new Vector2(axisStartX + axisLength + offset.x, axisStartY + relativedLength + offset.y + axis.offset) :
                                          new Vector2(axisStartX + axisLength + offset.x, posY));
                        break;
                    }
                }
                else
                {
                    var grid = chart.GetChartComponent <GridCoord>(axis.gridIndex);
                    var posX = !axis.axisName.onZero && grid != null? grid.context.x : GetAxisLineXOrY() + offset.x;
                    switch (axis.axisName.labelStyle.position)
                    {
                    case LabelStyle.Position.Start:

                        label = ChartHelper.AddChartLabel(s_DefaultAxisName, axisObj.transform, axis.axisName.labelStyle,
                                                          chart.theme.axis, axis.axisName.name, autoColor, TextAnchor.MiddleCenter);
                        label.SetActive(axis.axisName.labelStyle.show);
                        label.SetPosition(axis.position == Axis.AxisPosition.Right ?
                                          new Vector2(axisStartX + relativedLength + offset.x + axis.offset, axisStartY - offset.y) :
                                          new Vector2(posX, axisStartY - offset.y));
                        break;

                    case LabelStyle.Position.Middle:

                        label = ChartHelper.AddChartLabel(s_DefaultAxisName, axisObj.transform, axis.axisName.labelStyle,
                                                          chart.theme.axis, axis.axisName.name, autoColor, TextAnchor.MiddleCenter);
                        label.SetActive(axis.axisName.labelStyle.show);
                        label.SetPosition(axis.position == Axis.AxisPosition.Right ?
                                          new Vector2(axisStartX + relativedLength - offset.x + axis.offset, axisStartY + axisLength / 2 + offset.y) :
                                          new Vector2(posX, axisStartY + axisLength / 2 + offset.y));
                        break;

                    default:
                        //LabelStyle.Position
                        label = ChartHelper.AddChartLabel(s_DefaultAxisName, axisObj.transform, axis.axisName.labelStyle,
                                                          chart.theme.axis, axis.axisName.name, autoColor, TextAnchor.MiddleCenter);
                        label.SetActive(axis.axisName.labelStyle.show);
                        label.SetPosition(axis.position == Axis.AxisPosition.Right ?
                                          new Vector2(axisStartX + relativedLength + offset.x + axis.offset, axisStartY + axisLength + offset.y) :
                                          new Vector2(posX, axisStartY + axisLength + offset.y));
                        break;
                    }
                }
            }
        }
Пример #13
0
        protected virtual void UpdatePointerValue(Axis axis)
        {
            var grid = chart.GetChartComponent <GridCoord>(axis.gridIndex);

            if (grid == null)
            {
                return;
            }
            if (!grid.context.isPointerEnter)
            {
                axis.context.pointerValue = double.PositiveInfinity;
            }
            else
            {
                var lastPointerValue = axis.context.pointerValue;
                if (axis.IsCategory())
                {
                    var dataZoom  = chart.GetDataZoomOfAxis(axis);
                    var dataCount = chart.series.Count > 0 ? chart.series[0].GetDataList(dataZoom).Count : 0;
                    var local     = chart.pointerPos;
                    if (axis is YAxis)
                    {
                        float splitWid = AxisHelper.GetDataWidth(axis, grid.context.height, dataCount, dataZoom);
                        for (int j = 0; j < axis.GetDataCount(dataZoom); j++)
                        {
                            float pY = grid.context.y + j * splitWid;
                            if ((axis.boundaryGap && (local.y > pY && local.y <= pY + splitWid)) ||
                                (!axis.boundaryGap && (local.y > pY - splitWid / 2 && local.y <= pY + splitWid / 2)))
                            {
                                axis.context.pointerValue         = j;
                                axis.context.pointerLabelPosition = axis.GetLabelObjectPosition(j);
                                if (j != lastPointerValue)
                                {
                                    if (chart.onAxisPointerValueChanged != null)
                                    {
                                        chart.onAxisPointerValueChanged(axis, j);
                                    }
                                }
                                break;
                            }
                        }
                    }
                    else
                    {
                        float splitWid = AxisHelper.GetDataWidth(axis, grid.context.width, dataCount, dataZoom);
                        for (int j = 0; j < axis.GetDataCount(dataZoom); j++)
                        {
                            float pX = grid.context.x + j * splitWid;
                            if ((axis.boundaryGap && (local.x > pX && local.x <= pX + splitWid)) ||
                                (!axis.boundaryGap && (local.x > pX - splitWid / 2 && local.x <= pX + splitWid / 2)))
                            {
                                axis.context.pointerValue         = j;
                                axis.context.pointerLabelPosition = axis.GetLabelObjectPosition(j);
                                if (j != lastPointerValue)
                                {
                                    if (chart.onAxisPointerValueChanged != null)
                                    {
                                        chart.onAxisPointerValueChanged(axis, j);
                                    }
                                }
                                break;
                            }
                        }
                    }
                }
                else
                {
                    if (axis is YAxis)
                    {
                        var yRate  = axis.context.minMaxRange / grid.context.height;
                        var yValue = yRate * (chart.pointerPos.y - grid.context.y - axis.context.offset);
                        if (axis.context.minValue > 0)
                        {
                            yValue += axis.context.minValue;
                        }

                        var labelX = axis.GetLabelObjectPosition(0).x;
                        axis.context.pointerValue         = yValue;
                        axis.context.pointerLabelPosition = new Vector3(labelX, chart.pointerPos.y);
                        if (yValue != lastPointerValue)
                        {
                            if (chart.onAxisPointerValueChanged != null)
                            {
                                chart.onAxisPointerValueChanged(axis, yValue);
                            }
                        }
                    }
                    else
                    {
                        var xRate  = axis.context.minMaxRange / grid.context.width;
                        var xValue = xRate * (chart.pointerPos.x - grid.context.x - axis.context.offset);
                        if (axis.context.minValue > 0)
                        {
                            xValue += axis.context.minValue;
                        }

                        var labelY = axis.GetLabelObjectPosition(0).y;
                        axis.context.pointerValue         = xValue;
                        axis.context.pointerLabelPosition = new Vector3(chart.pointerPos.x, labelY);
                        if (xValue != lastPointerValue)
                        {
                            if (chart.onAxisPointerValueChanged != null)
                            {
                                chart.onAxisPointerValueChanged(axis, xValue);
                            }
                        }
                    }
                }
            }
        }
Пример #14
0
        internal void UpdateAxisMinMaxValue(int axisIndex, Axis axis, bool updateChart = true)
        {
            if (!axis.show)
            {
                return;
            }

            if (axis.IsCategory())
            {
                axis.context.minValue    = 0;
                axis.context.maxValue    = SeriesHelper.GetMaxSerieDataCount(chart.series) - 1;
                axis.context.minMaxRange = axis.context.maxValue;
                return;
            }

            double tempMinValue = 0;
            double tempMaxValue = 0;

            chart.GetSeriesMinMaxValue(axis, axisIndex, out tempMinValue, out tempMaxValue);

            if (tempMinValue != axis.context.minValue ||
                tempMaxValue != axis.context.maxValue ||
                m_LastInterval != axis.interval ||
                m_LastSplitNumber != axis.splitNumber)
            {
                m_LastSplitNumber = axis.splitNumber;
                m_LastInterval    = axis.interval;

                axis.UpdateMinMaxValue(tempMinValue, tempMaxValue);
                axis.context.offset           = 0;
                axis.context.lastCheckInverse = axis.inverse;
                UpdateAxisTickValueList(axis);

                if (tempMinValue != 0 || tempMaxValue != 0)
                {
                    var grid = chart.GetChartComponent <GridCoord>(axis.gridIndex);
                    if (grid != null && axis is XAxis && axis.IsValue())
                    {
                        axis.context.offset = axis.context.minValue > 0 ?
                                              0 :
                                              (axis.context.maxValue < 0 ?
                                               grid.context.width :
                                               (float)(Math.Abs(axis.context.minValue) * (grid.context.width /
                                                                                          (Math.Abs(axis.context.minValue) + Math.Abs(axis.context.maxValue))))
                                              );
                        axis.context.x     = grid.context.x;
                        axis.context.y     = GetAxisLineXOrY();
                        axis.context.zeroY = grid.context.y;
                        axis.context.zeroX = grid.context.x - (float)(axis.context.minValue * grid.context.width / axis.context.minMaxRange);
                    }
                    if (grid != null && axis is YAxis && axis.IsValue())
                    {
                        axis.context.offset = axis.context.minValue > 0 ?
                                              0 :
                                              (axis.context.maxValue < 0 ?
                                               grid.context.height :
                                               (float)(Math.Abs(axis.context.minValue) * (grid.context.height /
                                                                                          (Math.Abs(axis.context.minValue) + Math.Abs(axis.context.maxValue))))
                                              );
                        axis.context.x     = GetAxisLineXOrY();
                        axis.context.y     = grid.context.y;
                        axis.context.zeroX = grid.context.x;
                        axis.context.zeroY = grid.context.y - (float)(axis.context.minValue * grid.context.height / axis.context.minMaxRange);
                    }
                }
                var dataZoom = chart.GetDataZoomOfAxis(axis);
                if (dataZoom != null && dataZoom.enable)
                {
                    if (axis is XAxis)
                    {
                        dataZoom.SetXAxisIndexValueInfo(axisIndex, tempMinValue, tempMaxValue);
                    }
                    else
                    {
                        dataZoom.SetYAxisIndexValueInfo(axisIndex, tempMinValue, tempMaxValue);
                    }
                }
                if (updateChart)
                {
                    UpdateAxisLabelText(axis);
                    chart.RefreshChart();
                }
            }
        }