private void DrawXAxisIndicator(VertexHelper vh, Tooltip tooltip, GridCoord grid) { var xAxes = chart.GetChartComponents <XAxis>(); var lineType = tooltip.lineStyle.GetType(chart.theme.tooltip.lineType); var lineWidth = tooltip.lineStyle.GetWidth(chart.theme.tooltip.lineWidth); foreach (var component in xAxes) { var xAxis = component as XAxis; if (xAxis.gridIndex == grid.index) { if (double.IsInfinity(xAxis.context.pointerValue)) { continue; } var dataZoom = chart.GetDataZoomOfAxis(xAxis); int dataCount = chart.series.Count > 0 ? chart.series[0].GetDataList(dataZoom).Count : 0; float splitWidth = AxisHelper.GetDataWidth(xAxis, grid.context.width, dataCount, dataZoom); switch (tooltip.type) { case Tooltip.Type.Corss: case Tooltip.Type.Line: float pX = grid.context.x; pX += xAxis.IsCategory() ? (float)(xAxis.context.pointerValue * splitWidth + (xAxis.boundaryGap ? splitWidth / 2 : 0)) : xAxis.GetDistance(xAxis.context.axisTooltipValue, grid.context.width); Vector2 sp = new Vector2(pX, grid.context.y); Vector2 ep = new Vector2(pX, grid.context.y + grid.context.height); var lineColor = TooltipHelper.GetLineColor(tooltip, chart.theme); ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, sp, ep, lineColor); if (tooltip.type == Tooltip.Type.Corss) { sp = new Vector2(grid.context.x, chart.pointerPos.y); ep = new Vector2(grid.context.x + grid.context.width, chart.pointerPos.y); ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, sp, ep, lineColor); } break; case Tooltip.Type.Shadow: if (xAxis.IsCategory() && !double.IsInfinity(xAxis.context.pointerValue)) { float tooltipSplitWid = splitWidth < 1 ? 1 : splitWidth; pX = (float)(grid.context.x + splitWidth * xAxis.context.pointerValue - (xAxis.boundaryGap ? 0 : splitWidth / 2)); float pY = grid.context.y + grid.context.height; Vector3 p1 = new Vector3(pX, grid.context.y); Vector3 p2 = new Vector3(pX, pY); Vector3 p3 = new Vector3(pX + tooltipSplitWid, pY); Vector3 p4 = new Vector3(pX + tooltipSplitWid, grid.context.y); UGL.DrawQuadrilateral(vh, p1, p2, p3, p4, chart.theme.tooltip.areaColor); } break; } } } }
protected override void DrawBackground(VertexHelper vh) { Vector3 p1 = new Vector3(chartX, chartY + chartHeight); Vector3 p2 = new Vector3(chartX + chartWidth, chartY + chartHeight); Vector3 p3 = new Vector3(chartX + chartWidth, chartY); Vector3 p4 = new Vector3(chartX, chartY); var backgroundColor = ThemeHelper.GetBackgroundColor(m_Theme, m_Background); UGL.DrawQuadrilateral(vh, p1, p2, p3, p4, backgroundColor); }
private void DrawPolygonRadar(VertexHelper vh, RadarCoord radar) { float insideRadius = 0, outsideRadius = 0; float block = radar.context.radius / radar.splitNumber; int indicatorNum = radar.indicatorList.Count; Vector3 p1, p2, p3, p4; Vector3 p = radar.context.center; float angle = 2 * Mathf.PI / indicatorNum; var lineColor = radar.axisLine.GetColor(chart.theme.axis.splitLineColor); var lineWidth = radar.axisLine.GetWidth(chart.theme.axis.lineWidth); var lineType = radar.axisLine.GetType(chart.theme.axis.lineType); var splitLineColor = radar.splitLine.GetColor(chart.theme.axis.splitLineColor); var splitLineWidth = radar.splitLine.GetWidth(chart.theme.axis.splitLineWidth); var splitLineType = radar.splitLine.GetType(chart.theme.axis.splitLineType); for (int i = 0; i < radar.splitNumber; i++) { var color = radar.splitArea.GetColor(i, chart.theme.axis); outsideRadius = insideRadius + block; p1 = new Vector3(p.x + insideRadius * Mathf.Sin(0), p.y + insideRadius * Mathf.Cos(0)); p2 = new Vector3(p.x + outsideRadius * Mathf.Sin(0), p.y + outsideRadius * Mathf.Cos(0)); for (int j = 0; j <= indicatorNum; j++) { float currAngle = j * angle; p3 = new Vector3(p.x + outsideRadius * Mathf.Sin(currAngle), p.y + outsideRadius * Mathf.Cos(currAngle)); p4 = new Vector3(p.x + insideRadius * Mathf.Sin(currAngle), p.y + insideRadius * Mathf.Cos(currAngle)); if (radar.splitArea.show) { UGL.DrawQuadrilateral(vh, p1, p2, p3, p4, color); } if (radar.splitLine.NeedShow(i)) { ChartDrawer.DrawLineStyle(vh, splitLineType, splitLineWidth, p2, p3, splitLineColor); } p1 = p4; p2 = p3; } insideRadius = outsideRadius; } if (radar.axisLine.show) { for (int j = 0; j <= indicatorNum; j++) { float currAngle = j * angle; p3 = new Vector3(p.x + outsideRadius * Mathf.Sin(currAngle), p.y + outsideRadius * Mathf.Cos(currAngle)); ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, p, p3, lineColor); } } }
private void DrawCoord(VertexHelper vh) { var grid = component; if (grid.show && !ChartHelper.IsClearColor(grid.backgroundColor)) { var p1 = new Vector2(grid.context.x, grid.context.y); var p2 = new Vector2(grid.context.x, grid.context.y + grid.context.height); var p3 = new Vector2(grid.context.x + grid.context.width, grid.context.y + grid.context.height); var p4 = new Vector2(grid.context.x + grid.context.width, grid.context.y); UGL.DrawQuadrilateral(vh, p1, p2, p3, p4, grid.backgroundColor); } }
public void DrawLabelBackground(VertexHelper vh, Serie serie, SerieData serieData) { if (serieData == null || serieData.labelObject == null) { return; } var serieLabel = SerieHelper.GetSerieLabel(serie, serieData); if (!serieLabel.show) { return; } var invert = serieLabel.autoOffset && serie.type == SerieType.Line && SerieHelper.IsDownPoint(serie, serieData.index) && !serie.areaStyle.show; var centerPos = Vector3.zero; if (serie.type == SerieType.Pie) { centerPos = SerieLabelHelper.GetRealLabelPosition(serieData, serieLabel); } else { centerPos = serieData.labelPosition + serieLabel.offset * (invert ? -1 : 1); } var labelHalfWid = serieData.labelObject.GetLabelWidth() / 2; var labelHalfHig = serieData.GetLabelHeight() / 2; var p1 = new Vector3(centerPos.x - labelHalfWid, centerPos.y + labelHalfHig); var p2 = new Vector3(centerPos.x + labelHalfWid, centerPos.y + labelHalfHig); var p3 = new Vector3(centerPos.x + labelHalfWid, centerPos.y - labelHalfHig); var p4 = new Vector3(centerPos.x - labelHalfWid, centerPos.y - labelHalfHig); if (serieLabel.textStyle.rotate > 0) { p1 = ChartHelper.RotateRound(p1, centerPos, Vector3.forward, serieLabel.textStyle.rotate); p2 = ChartHelper.RotateRound(p2, centerPos, Vector3.forward, serieLabel.textStyle.rotate); p3 = ChartHelper.RotateRound(p3, centerPos, Vector3.forward, serieLabel.textStyle.rotate); p4 = ChartHelper.RotateRound(p4, centerPos, Vector3.forward, serieLabel.textStyle.rotate); } UGL.DrawQuadrilateral(vh, p1, p2, p3, p4, serieLabel.textStyle.backgroundColor); if (serieLabel.border) { UGL.DrawBorder(vh, centerPos, serieData.GetLabelWidth(), serieData.GetLabelHeight(), serieLabel.borderWidth, serieLabel.borderColor, serieLabel.textStyle.rotate); } }
protected virtual void DrawBackground(VertexHelper vh) { var background = GetChartComponent <Background>(); if (background != null && background.show) { return; } Vector3 p1 = new Vector3(chartX, chartY + chartHeight); Vector3 p2 = new Vector3(chartX + chartWidth, chartY + chartHeight); Vector3 p3 = new Vector3(chartX + chartWidth, chartY); Vector3 p4 = new Vector3(chartX, chartY); UGL.DrawQuadrilateral(vh, p1, p2, p3, p4, theme.backgroundColor); }
public override void DrawBase(VertexHelper vh) { if (!component.show) { return; } if (component.image != null) { return; } var p1 = new Vector3(chart.chartX, chart.chartY + chart.chartHeight); var p2 = new Vector3(chart.chartX + chart.chartWidth, chart.chartY + chart.chartHeight); var p3 = new Vector3(chart.chartX + chart.chartWidth, chart.chartY); var p4 = new Vector3(chart.chartX, chart.chartY); var backgroundColor = chart.theme.GetBackgroundColor(component); UGL.DrawQuadrilateral(vh, p1, p2, p3, p4, backgroundColor); }
public void DrawClipPolygon(VertexHelper vh, Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4, Color32 startColor, Color32 toColor, bool clip, GridCoord grid) { ClampInChart(ref p1); ClampInChart(ref p2); ClampInChart(ref p3); ClampInChart(ref p4); if (clip) { p1 = ClampInGrid(grid, p1); p2 = ClampInGrid(grid, p2); p3 = ClampInGrid(grid, p3); p4 = ClampInGrid(grid, p4); } if (!clip || (clip && (grid.Contains(p1) && grid.Contains(p2) && grid.Contains(p3) && grid.Contains(p4)))) { UGL.DrawQuadrilateral(vh, p1, p2, p3, p4, startColor, toColor); } }
private void DrawCoord(VertexHelper vh, GridCoord grid) { if (!grid.show) { return; } if (!ChartHelper.IsClearColor(grid.backgroundColor)) { var p1 = new Vector2(grid.context.x, grid.context.y); var p2 = new Vector2(grid.context.x, grid.context.y + grid.context.height); var p3 = new Vector2(grid.context.x + grid.context.width, grid.context.y + grid.context.height); var p4 = new Vector2(grid.context.x + grid.context.width, grid.context.y); UGL.DrawQuadrilateral(vh, p1, p2, p3, p4, grid.backgroundColor); } if (grid.showBorder) { var borderWidth = grid.borderWidth == 0 ? chart.theme.axis.lineWidth * 2 : grid.borderWidth; var borderColor = ChartHelper.IsClearColor(grid.borderColor) ? chart.theme.axis.lineColor : grid.borderColor; UGL.DrawBorder(vh, grid.context.center, grid.context.width - borderWidth, grid.context.height - borderWidth, borderWidth, borderColor); } }
private void DrawVerticalDataZoomSlider(VertexHelper vh, DataZoom dataZoom) { if (!dataZoom.enable || !dataZoom.supportSlider) { return; } var p1 = new Vector3(dataZoom.context.x, dataZoom.context.y); var p2 = new Vector3(dataZoom.context.x, dataZoom.context.y + dataZoom.context.height); var p3 = new Vector3(dataZoom.context.x + dataZoom.context.width, dataZoom.context.y + dataZoom.context.height); var p4 = new Vector3(dataZoom.context.x + dataZoom.context.width, dataZoom.context.y); var lineColor = dataZoom.lineStyle.GetColor(chart.theme.dataZoom.dataLineColor); var lineWidth = dataZoom.lineStyle.GetWidth(chart.theme.dataZoom.dataLineWidth); var borderWidth = dataZoom.borderWidth == 0 ? chart.theme.dataZoom.borderWidth : dataZoom.borderWidth; var borderColor = dataZoom.GetBorderColor(chart.theme.dataZoom.borderColor); var backgroundColor = dataZoom.GetBackgroundColor(chart.theme.dataZoom.backgroundColor); var areaColor = dataZoom.areaStyle.GetColor(chart.theme.dataZoom.dataAreaColor); UGL.DrawQuadrilateral(vh, p1, p2, p3, p4, backgroundColor); var centerPos = new Vector3(dataZoom.context.x + dataZoom.context.width / 2, dataZoom.context.y + dataZoom.context.height / 2); UGL.DrawBorder(vh, centerPos, dataZoom.context.width, dataZoom.context.height, borderWidth, borderColor); if (dataZoom.showDataShadow && chart.series.Count > 0) { Serie serie = chart.series[0]; Axis axis = chart.GetChartComponent <YAxis>(0); var showData = serie.GetDataList(null); float scaleWid = dataZoom.context.height / (showData.Count - 1); Vector3 lp = Vector3.zero; Vector3 np = Vector3.zero; double minValue = 0; double maxValue = 0; SeriesHelper.GetYMinMaxValue(chart.series, null, 0, chart.IsAllAxisValue(), axis.inverse, out minValue, out maxValue); AxisHelper.AdjustMinMaxValue(axis, ref minValue, ref maxValue, true); int rate = 1; var sampleDist = serie.sampleDist < 2 ? 2 : serie.sampleDist; var maxCount = showData.Count; if (sampleDist > 0) { rate = (int)((maxCount - serie.minShow) / (dataZoom.context.height / sampleDist)); } if (rate < 1) { rate = 1; } var totalAverage = serie.sampleAverage > 0 ? serie.sampleAverage : DataHelper.DataAverage(ref showData, serie.sampleType, serie.minShow, maxCount, rate); var dataChanging = false; for (int i = 0; i < maxCount; i += rate) { double value = DataHelper.SampleValue(ref showData, serie.sampleType, rate, serie.minShow, maxCount, totalAverage, i, serie.animation.GetUpdateAnimationDuration(), ref dataChanging, axis); float pY = dataZoom.context.y + i * scaleWid; float dataHig = (maxValue - minValue) == 0 ? 0 : (float)((value - minValue) / (maxValue - minValue) * dataZoom.context.width); np = new Vector3(chart.chartX + chart.chartWidth - dataZoom.right - dataHig, pY); if (i > 0) { UGL.DrawLine(vh, lp, np, lineWidth, lineColor); Vector3 alp = new Vector3(lp.x, lp.y - lineWidth); Vector3 anp = new Vector3(np.x, np.y - lineWidth); Vector3 tnp = new Vector3(np.x, chart.chartY + dataZoom.bottom + lineWidth); Vector3 tlp = new Vector3(lp.x, chart.chartY + dataZoom.bottom + lineWidth); UGL.DrawQuadrilateral(vh, alp, anp, tnp, tlp, areaColor); } lp = np; } if (dataChanging) { chart.RefreshTopPainter(); } } switch (dataZoom.rangeMode) { case DataZoom.RangeMode.Percent: var start = dataZoom.context.y + dataZoom.context.height * dataZoom.start / 100; var end = dataZoom.context.y + dataZoom.context.height * dataZoom.end / 100; var fillerColor = dataZoom.GetFillerColor(chart.theme.dataZoom.fillerColor); p1 = new Vector2(dataZoom.context.x, start); p2 = new Vector2(dataZoom.context.x + dataZoom.context.width, start); p3 = new Vector2(dataZoom.context.x + dataZoom.context.width, end); p4 = new Vector2(dataZoom.context.x, end); UGL.DrawQuadrilateral(vh, p1, p2, p3, p4, fillerColor); UGL.DrawLine(vh, p1, p2, lineWidth, fillerColor); UGL.DrawLine(vh, p3, p4, lineWidth, fillerColor); break; } }
private void DrawRectLiquid(VertexHelper vh, Serie serie, Vessel vessel) { var cenPos = vessel.runtimeCenterPos; var serieData = serie.GetSerieData(0); if (serieData == null) { return; } var dataChangeDuration = serie.animation.GetUpdateAnimationDuration(); var value = serieData.GetCurrData(1, dataChangeDuration); if (serie.runtimeCheckValue != value) { serie.runtimeCheckValue = value; m_UpdateLabelText = true; } if (serieData.labelPosition != cenPos) { serieData.labelPosition = cenPos; m_UpdateLabelText = true; } if (value <= 0) { return; } var colorIndex = chart.m_LegendRealShowName.IndexOf(serie.name); var realHig = (value - serie.min) / (serie.max - serie.min) * vessel.runtimeHeight; serie.animation.InitProgress(1, 0, (float)realHig); var hig = serie.animation.IsFinish() ? realHig : serie.animation.GetCurrDetail(); var color = SerieHelper.GetItemColor(serie, serieData, chart.theme, colorIndex, false); var toColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, colorIndex, false); var isNeedGradient = !ChartHelper.IsValueEqualsColor(color, toColor); var isFull = hig >= vessel.runtimeHeight; if (hig >= vessel.runtimeHeight) { hig = vessel.runtimeHeight; } if (isFull && !isNeedGradient) { UGL.DrawRectangle(vh, cenPos, vessel.runtimeWidth / 2, vessel.runtimeHeight / 2, toColor); } else { var startY = (float)(cenPos.y - vessel.runtimeHeight / 2 + hig); var waveStartPos = new Vector3(cenPos.x - vessel.runtimeWidth / 2, startY); var waveEndPos = new Vector3(cenPos.x + vessel.runtimeWidth / 2, startY); var startX = waveStartPos.x; var endX = waveEndPos.x; var step = vessel.smoothness; if (step < 0.5f) { step = 0.5f; } var lup = waveStartPos; var ldp = new Vector3(startX, vessel.runtimeCenterPos.y - vessel.runtimeHeight / 2); var nup = Vector3.zero; var ndp = Vector3.zero; var angle = 0f; var isStarted = false; var isEnded = false; var waveHeight = isFull ? 0 : serie.waveHeight; serie.runtimeWaveSpeed += serie.waveSpeed * Time.deltaTime; while (startX < endX) { startX += step; if (startX > endX) { startX = endX; } if (startX > waveStartPos.x && !isStarted) { startX = waveStartPos.x; isStarted = true; } if (startX > waveEndPos.x && !isEnded) { startX = waveEndPos.x; isEnded = true; } var py = Mathf.Sqrt(Mathf.Pow(vessel.runtimeHeight, 2) - Mathf.Pow(Mathf.Abs(cenPos.x - startX), 2)); if (startX < waveStartPos.x || startX > waveEndPos.x) { nup = new Vector3(startX, cenPos.y + py); } else { var py2 = waveHeight * Mathf.Sin(1 / serie.waveLength * angle + serie.runtimeWaveSpeed + serie.waveOffset); var nupY = waveStartPos.y + py2; nup = new Vector3(startX, nupY); angle += step; } ndp = new Vector3(startX, cenPos.y - vessel.runtimeHeight / 2); if (nup.y > cenPos.y + vessel.runtimeHeight / 2) { nup.y = cenPos.y + vessel.runtimeHeight / 2; } if (nup.y < cenPos.y - vessel.runtimeHeight / 2) { nup.y = cenPos.y - vessel.runtimeHeight / 2; } if (!ChartHelper.IsValueEqualsColor(color, toColor)) { var colorMin = cenPos.y - vessel.runtimeHeight; var colorMax = startY + serie.waveHeight; var tcolor1 = Color32.Lerp(color, toColor, 1 - (lup.y - colorMin) / (colorMax - colorMin)); var tcolor2 = Color32.Lerp(color, toColor, 1 - (ldp.y - colorMin) / (colorMax - colorMin)); UGL.DrawQuadrilateral(vh, lup, nup, ndp, ldp, tcolor1, tcolor2); } else { UGL.DrawQuadrilateral(vh, lup, nup, ndp, ldp, color); } lup = nup; ldp = ndp; } } if (serie.waveSpeed != 0 && Application.isPlaying && !isFull) { chart.RefreshPainter(serie); } if (!serie.animation.IsFinish()) { serie.animation.CheckProgress(realHig); chart.m_IsPlayingAnimation = true; chart.RefreshPainter(serie); } }
private void DrawLiquid(VertexHelper vh, Serie serie) { if (!serie.show) { return; } if (serie.animation.HasFadeOut()) { return; } var vessel = chart.GetVessel(serie.vesselIndex); if (vessel == null) { return; } var cenPos = vessel.runtimeCenterPos; var radius = vessel.runtimeInnerRadius; var serieData = serie.GetSerieData(0); if (serieData == null) { return; } var dataChangeDuration = serie.animation.GetUpdateAnimationDuration(); var value = serieData.GetCurrData(1, dataChangeDuration); if (serie.runtimeCheckValue != value) { serie.runtimeCheckValue = value; m_UpdateLabelText = true; } if (serieData.labelPosition != cenPos) { serieData.labelPosition = cenPos; m_UpdateLabelText = true; } if (value == 0) { return; } var colorIndex = chart.m_LegendRealShowName.IndexOf(serie.name); var realHig = (value - serie.min) / (serie.max - serie.min) * radius * 2; serie.animation.InitProgress(1, 0, realHig); var hig = serie.animation.IsFinish() ? realHig : serie.animation.GetCurrDetail(); var a = Mathf.Abs(radius - hig + (hig > radius ? serie.waveHeight : -serie.waveHeight)); var diff = Mathf.Sqrt(radius * radius - Mathf.Pow(a, 2)); var color = SerieHelper.GetItemColor(serie, serieData, chart.theme, colorIndex, false); var toColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, colorIndex, false); var isNeedGradient = !ChartHelper.IsValueEqualsColor(color, toColor); var isFull = hig >= 2 * radius; if (hig >= 2 * radius) { hig = 2 * radius; } if (isFull && !isNeedGradient) { UGL.DrawCricle(vh, cenPos, radius, toColor, chart.settings.cicleSmoothness); } else { var startY = cenPos.y - radius + hig; var waveStartPos = new Vector3(cenPos.x - diff, startY); var waveEndPos = new Vector3(cenPos.x + diff, startY); var startX = hig > radius ? cenPos.x - radius : waveStartPos.x; var endX = hig > radius ? cenPos.x + radius : waveEndPos.x; var step = vessel.smoothness; if (step < 0.5f) { step = 0.5f; } var lup = hig > radius ? new Vector3(cenPos.x - radius, cenPos.y) : waveStartPos; var ldp = lup; var nup = Vector3.zero; var ndp = Vector3.zero; var angle = 0f; serie.runtimeWaveSpeed += serie.waveSpeed * Time.deltaTime; var isStarted = false; var isEnded = false; var waveHeight = isFull ? 0 : serie.waveHeight; while (startX < endX) { startX += step; if (startX > endX) { startX = endX; } if (startX > waveStartPos.x && !isStarted) { startX = waveStartPos.x; isStarted = true; } if (startX > waveEndPos.x && !isEnded) { startX = waveEndPos.x; isEnded = true; } var py = Mathf.Sqrt(Mathf.Pow(radius, 2) - Mathf.Pow(Mathf.Abs(cenPos.x - startX), 2)); if (startX < waveStartPos.x || startX > waveEndPos.x) { nup = new Vector3(startX, cenPos.y + py); } else { var py2 = waveHeight * Mathf.Sin(1 / serie.waveLength * angle + serie.runtimeWaveSpeed + serie.waveOffset); var nupY = waveStartPos.y + py2; if (nupY > cenPos.y + py) { nupY = cenPos.y + py; } else if (nupY < cenPos.y - py) { nupY = cenPos.y - py; } nup = new Vector3(startX, nupY); angle += step; } ndp = new Vector3(startX, cenPos.y - py); if (!ChartHelper.IsValueEqualsColor(color, toColor)) { var colorMin = cenPos.y - radius; var colorMax = startY + serie.waveHeight; var tcolor1 = Color32.Lerp(color, toColor, 1 - (lup.y - colorMin) / (colorMax - colorMin)); var tcolor2 = Color32.Lerp(color, toColor, 1 - (ldp.y - colorMin) / (colorMax - colorMin)); UGL.DrawQuadrilateral(vh, lup, nup, ndp, ldp, tcolor1, tcolor2); } else { UGL.DrawQuadrilateral(vh, lup, nup, ndp, ldp, color); } lup = nup; ldp = ndp; } } if (serie.waveSpeed != 0 && Application.isPlaying && !isFull) { chart.RefreshPainter(serie); } if (!serie.animation.IsFinish()) { serie.animation.CheckProgress(realHig); chart.m_IsPlayingAnimation = true; chart.RefreshPainter(serie); } }
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; } }