private void DrawCoordinate(VertexHelper vh)
        {
            #region draw tick and splitline
            if (m_YAxis.show)
            {
                for (int i = 0; i < m_YAxis.GetScaleNumber(); i++)
                {
                    float pX = 0;
                    float pY = coordinateY + i * m_YAxis.GetScaleWidth(coordinateHig);
                    if (m_YAxis.boundaryGap && m_YAxis.axisTick.alignWithLabel)
                    {
                        pY -= m_YAxis.GetScaleWidth(coordinateHig) / 2;
                    }

                    if (m_YAxis.axisTick.show)
                    {
                        pX += zeroX - m_YAxis.axisTick.length - 2;
                        ChartHelper.DrawLine(vh, new Vector3(zeroX, pY), new Vector3(pX, pY),
                                             m_Coordinate.tickness, m_ThemeInfo.axisLineColor);
                    }
                    if (m_YAxis.showSplitLine)
                    {
                        DrawSplitLine(vh, true, m_YAxis.splitLineType, new Vector3(coordinateX, pY),
                                      new Vector3(coordinateX + coordinateWid, pY), m_ThemeInfo.axisSplitLineColor);
                    }
                }
            }
            if (m_XAxis.show)
            {
                for (int i = 0; i < m_XAxis.GetScaleNumber(); i++)
                {
                    float pX = coordinateX + i * m_XAxis.GetScaleWidth(coordinateWid);
                    float pY = 0;
                    if (m_XAxis.boundaryGap && m_XAxis.axisTick.alignWithLabel)
                    {
                        pX -= m_XAxis.GetScaleWidth(coordinateWid) / 2;
                    }
                    if (m_XAxis.axisTick.show)
                    {
                        pY += zeroY - m_XAxis.axisTick.length - 2;
                        ChartHelper.DrawLine(vh, new Vector3(pX, zeroY), new Vector3(pX, pY),
                                             m_Coordinate.tickness, m_ThemeInfo.axisLineColor);
                    }
                    if (m_XAxis.showSplitLine)
                    {
                        DrawSplitLine(vh, false, m_XAxis.splitLineType, new Vector3(pX, coordinateY),
                                      new Vector3(pX, coordinateY + coordinateHig), m_ThemeInfo.axisSplitLineColor);
                    }
                }
            }
            #endregion

            #region draw x,y axis
            if (m_YAxis.show)
            {
                if (m_YAxis.type == Axis.AxisType.Value)
                {
                    ChartHelper.DrawLine(vh, new Vector3(coordinateX, coordinateY - m_Coordinate.tickness),
                                         new Vector3(coordinateX, coordinateY + coordinateHig + m_Coordinate.tickness),
                                         m_Coordinate.tickness, m_ThemeInfo.axisLineColor);
                }
                else
                {
                    ChartHelper.DrawLine(vh, new Vector3(zeroX, coordinateY - m_Coordinate.tickness),
                                         new Vector3(zeroX, coordinateY + coordinateHig + m_Coordinate.tickness),
                                         m_Coordinate.tickness, m_ThemeInfo.axisLineColor);
                }
            }
            if (m_XAxis.show)
            {
                if (m_XAxis.type == Axis.AxisType.Value)
                {
                    ChartHelper.DrawLine(vh, new Vector3(coordinateX - m_Coordinate.tickness, coordinateY),
                                         new Vector3(coordinateX + coordinateWid + m_Coordinate.tickness, coordinateY),
                                         m_Coordinate.tickness, m_ThemeInfo.axisLineColor);
                }
                else
                {
                    ChartHelper.DrawLine(vh, new Vector3(coordinateX - m_Coordinate.tickness, zeroY),
                                         new Vector3(coordinateX + coordinateWid + m_Coordinate.tickness, zeroY),
                                         m_Coordinate.tickness, m_ThemeInfo.axisLineColor);
                }
            }
            #endregion
        }
Exemplo n.º 2
0
        private void DrawCoordinate(VertexHelper vh)
        {
            #region draw tick and splitline
            if (m_YAxis.show)
            {
                var scaleWidth = m_YAxis.GetScaleWidth(coordinateHig, m_DataZoom);
                var size = m_YAxis.GetScaleNumber(m_DataZoom);
                for (int i = 0; i < size; i++)
                {
                    float pX = 0;
                    float pY = coordinateY + i * scaleWidth;
                    if (m_YAxis.boundaryGap && m_YAxis.axisTick.alignWithLabel)
                    {
                        pY -= scaleWidth / 2;
                    }
                    if (m_YAxis.splitArea.show && i < size - 1)
                    {
                        ChartHelper.DrawPolygon(vh, new Vector2(coordinateX, pY),
                            new Vector2(coordinateX + coordinateWid, pY),
                            new Vector2(coordinateX + coordinateWid, pY + scaleWidth),
                            new Vector2(coordinateX, pY + scaleWidth),
                            m_YAxis.splitArea.getColor(i));
                    }
                    if (m_YAxis.axisTick.show)
                    {
                        pX += zeroX - (m_YAxis.axisTick.inside ? -m_YAxis.axisTick.length :
                            m_YAxis.axisTick.length);
                        ChartHelper.DrawLine(vh, new Vector3(zeroX, pY), new Vector3(pX, pY),
                            m_Coordinate.tickness, m_ThemeInfo.axisLineColor);
                    }
                    if (m_YAxis.showSplitLine)
                    {
                        DrawSplitLine(vh, true, m_YAxis.splitLineType, new Vector3(coordinateX, pY),
                            new Vector3(coordinateX + coordinateWid, pY), m_ThemeInfo.axisSplitLineColor);
                    }
                }
            }
            if (m_XAxis.show)
            {
                var scaleWidth = m_XAxis.GetScaleWidth(coordinateWid, m_DataZoom);
                var size = m_XAxis.GetScaleNumber(m_DataZoom);
                for (int i = 0; i < size; i++)
                {
                    float pX = coordinateX + i * scaleWidth;
                    float pY = 0;
                    if (m_XAxis.boundaryGap && m_XAxis.axisTick.alignWithLabel)
                    {
                        pX -= scaleWidth / 2;
                    }
                    if (m_XAxis.splitArea.show && i < size - 1)
                    {
                        ChartHelper.DrawPolygon(vh, new Vector2(pX, coordinateY),
                            new Vector2(pX, coordinateY + coordinateHig),
                            new Vector2(pX + scaleWidth, coordinateY + coordinateHig),
                            new Vector2(pX + scaleWidth, coordinateY),
                            m_XAxis.splitArea.getColor(i));
                    }
                    if (m_XAxis.axisTick.show)
                    {
                        pY += zeroY + (m_XAxis.axisTick.inside ? m_XAxis.axisTick.length :
                            -m_XAxis.axisTick.length);
                        ChartHelper.DrawLine(vh, new Vector3(pX, zeroY), new Vector3(pX, pY),
                            m_Coordinate.tickness, m_ThemeInfo.axisLineColor);
                    }
                    if (m_XAxis.showSplitLine)
                    {
                        DrawSplitLine(vh, false, m_XAxis.splitLineType, new Vector3(pX, coordinateY),
                            new Vector3(pX, coordinateY + coordinateHig), m_ThemeInfo.axisSplitLineColor);
                    }
                }
            }
            #endregion

            DrawXAxisLine(vh);
            DrawYAxisLine(vh);
        }