Пример #1
0
        protected void DrawAxisSplit(VertexHelper vh, AxisTheme theme, DataZoom dataZoom,
                                     Orient orient, float startX, float startY, float axisLength, float splitLength, Axis relativedAxis = null)
        {
            Axis axis      = component;
            var  lineColor = axis.splitLine.GetColor(theme.splitLineColor);
            var  lineWidth = axis.splitLine.GetWidth(theme.lineWidth);
            var  lineType  = axis.splitLine.GetType(theme.splitLineType);

            var size = AxisHelper.GetScaleNumber(axis, axisLength, dataZoom);

            if (axis.IsTime())
            {
                size += 1;
                if (!ChartHelper.IsEquals(axis.GetLastLabelValue(), axis.context.maxValue))
                {
                    size += 1;
                }
            }

            var current = orient == Orient.Horizonal ?
                          startX :
                          startY;

            for (int i = 0; i < size; i++)
            {
                var scaleWidth = AxisHelper.GetScaleWidth(axis, axisLength, axis.IsTime() ? i : i + 1, dataZoom);

                if (axis.boundaryGap && axis.axisTick.alignWithLabel)
                {
                    current -= scaleWidth / 2;
                }

                if (axis.splitArea.show && i <= size - 1)
                {
                    if (orient == Orient.Horizonal)
                    {
                        UGL.DrawQuadrilateral(vh,
                                              new Vector2(current, startY),
                                              new Vector2(current, startY + splitLength),
                                              new Vector2(current + scaleWidth, startY + splitLength),
                                              new Vector2(current + scaleWidth, startY),
                                              axis.splitArea.GetColor(i, theme));
                    }
                    else
                    {
                        UGL.DrawQuadrilateral(vh,
                                              new Vector2(startX, current),
                                              new Vector2(startX + splitLength, current),
                                              new Vector2(startX + splitLength, current + scaleWidth),
                                              new Vector2(startX, current + scaleWidth),
                                              axis.splitArea.GetColor(i, theme));
                    }
                }
                if (axis.splitLine.show)
                {
                    if (axis.splitLine.NeedShow(i))
                    {
                        if (orient == Orient.Horizonal)
                        {
                            if (relativedAxis == null || !MathUtil.Approximately(current, GetAxisLineXOrY()))
                            {
                                ChartDrawer.DrawLineStyle(vh,
                                                          lineType,
                                                          lineWidth,
                                                          new Vector3(current, startY),
                                                          new Vector3(current, startY + splitLength),
                                                          lineColor);
                            }
                        }
                        else
                        {
                            if (relativedAxis == null || !MathUtil.Approximately(current, GetAxisLineXOrY()))
                            {
                                ChartDrawer.DrawLineStyle(vh,
                                                          lineType,
                                                          lineWidth,
                                                          new Vector3(startX, current),
                                                          new Vector3(startX + splitLength, current),
                                                          lineColor);
                            }
                        }
                    }
                }
                current += scaleWidth;
            }
        }