Example #1
0
        /// <summary>
        /// 获得一个类目数据在坐标系中代表的宽度
        /// </summary>
        /// <param name="coordinateWidth"></param>
        /// <param name="dataZoom"></param>
        /// <returns></returns>
        public static float GetDataWidth(Axis axis, float coordinateWidth, int dataCount, DataZoom dataZoom)
        {
            if (dataCount < 1)
            {
                dataCount = 1;
            }
            var categoryCount = axis.GetDataNumber(dataZoom);
            int segment       = (axis.boundaryGap ? categoryCount : categoryCount - 1);

            segment = segment <= 0 ? dataCount : segment;
            return(coordinateWidth / segment);
        }