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; } } } }
public static float GetAxisPosition(GridCoord grid, Axis axis, double value, int dataCount = 0, DataZoom dataZoom = null) { var gridHeight = axis is YAxis ? grid.context.height : grid.context.width; var gridXY = axis is YAxis ? grid.context.y : grid.context.x; if (axis.IsCategory()) { if (dataCount == 0) { dataCount = axis.data.Count; } var categoryIndex = (int)value; var scaleWid = AxisHelper.GetDataWidth(axis, gridHeight, dataCount, dataZoom); float startY = gridXY + (axis.boundaryGap ? scaleWid / 2 : 0); return(startY + scaleWid * categoryIndex); } else { var yDataHig = (axis.context.minMaxRange == 0) ? 0f : (float)((value - axis.context.minValue) / axis.context.minMaxRange * gridHeight); return(gridXY + yDataHig); } }
private void DrawCandlestickSerie(VertexHelper vh, SimplifiedCandlestick serie) { if (!serie.show) { return; } if (serie.animation.HasFadeOut()) { return; } XAxis xAxis; YAxis yAxis; GridCoord grid; if (!chart.TryGetChartComponent <XAxis>(out xAxis, serie.xAxisIndex)) { return; } if (!chart.TryGetChartComponent <YAxis>(out yAxis, serie.yAxisIndex)) { return; } if (!chart.TryGetChartComponent <GridCoord>(out grid, xAxis.gridIndex)) { return; } var theme = chart.theme; var dataZoom = chart.GetDataZoomOfAxis(xAxis); var showData = serie.GetDataList(dataZoom); float categoryWidth = AxisHelper.GetDataWidth(xAxis, grid.context.width, showData.Count, dataZoom); float barWidth = serie.GetBarWidth(categoryWidth); float gap = (categoryWidth - barWidth) / 2; int maxCount = serie.maxShow > 0 ? (serie.maxShow > showData.Count ? showData.Count : serie.maxShow) : showData.Count; bool dataChanging = false; float dataChangeDuration = serie.animation.GetUpdateAnimationDuration(); double yMinValue = yAxis.context.minValue; double yMaxValue = yAxis.context.maxValue; var isYAxis = false; var itemStyle = serie.itemStyle; serie.containerIndex = grid.index; serie.containterInstanceId = grid.instanceId; for (int i = serie.minShow; i < maxCount; i++) { var serieData = showData[i]; if (serie.IsIgnoreValue(serieData)) { serie.context.dataPoints.Add(Vector3.zero); continue; } var open = serieData.GetCurrData(0, dataChangeDuration, yAxis.inverse, yMinValue, yMaxValue); var close = serieData.GetCurrData(1, dataChangeDuration, yAxis.inverse, yMinValue, yMaxValue); var lowest = serieData.GetCurrData(2, dataChangeDuration, yAxis.inverse, yMinValue, yMaxValue); var heighest = serieData.GetCurrData(3, dataChangeDuration, yAxis.inverse, yMinValue, yMaxValue); var isRise = yAxis.inverse ? close <open : close> open; var borderWidth = open == 0 ? 0f : (itemStyle.runtimeBorderWidth == 0 ? theme.serie.candlestickBorderWidth : itemStyle.runtimeBorderWidth); if (serieData.IsDataChanged()) { dataChanging = true; } float pX = grid.context.x + i * categoryWidth; float zeroY = grid.context.y + yAxis.context.offset; if (!xAxis.boundaryGap) { pX -= categoryWidth / 2; } float pY = zeroY; var barHig = 0f; double valueTotal = yMaxValue - yMinValue; var minCut = (yMinValue > 0 ? yMinValue : 0); if (valueTotal != 0) { barHig = (float)((close - open) / valueTotal * grid.context.height); pY += (float)((open - minCut) / valueTotal * grid.context.height); } serieData.context.stackHeight = barHig; float currHig = AnimationStyleHelper.CheckDataAnimation(chart, serie, i, barHig); Vector3 plb, plt, prt, prb, top; plb = new Vector3(pX + gap + borderWidth, pY + borderWidth); plt = new Vector3(pX + gap + borderWidth, pY + currHig - borderWidth); prt = new Vector3(pX + gap + barWidth - borderWidth, pY + currHig - borderWidth); prb = new Vector3(pX + gap + barWidth - borderWidth, pY + borderWidth); top = new Vector3(pX + gap + barWidth / 2, pY + currHig - borderWidth); // if (serie.clip) // { // plb = chart.ClampInGrid(grid, plb); // plt = chart.ClampInGrid(grid, plt); // prt = chart.ClampInGrid(grid, prt); // prb = chart.ClampInGrid(grid, prb); // top = chart.ClampInGrid(grid, top); // } serie.context.dataPoints.Add(top); var areaColor = isRise ? itemStyle.GetColor(theme.serie.candlestickColor) : itemStyle.GetColor0(theme.serie.candlestickColor0); var borderColor = isRise ? itemStyle.GetBorderColor(theme.serie.candlestickBorderColor) : itemStyle.GetBorderColor0(theme.serie.candlestickBorderColor0); var itemWidth = Mathf.Abs(prt.x - plb.x); var itemHeight = Mathf.Abs(plt.y - prb.y); var center = new Vector3((plb.x + prt.x) / 2, (plt.y + prb.y) / 2); var lowPos = new Vector3(center.x, zeroY + (float)((lowest - minCut) / valueTotal * grid.context.height)); var heighPos = new Vector3(center.x, zeroY + (float)((heighest - minCut) / valueTotal * grid.context.height)); var openCenterPos = new Vector3(center.x, prb.y); var closeCenterPos = new Vector3(center.x, prt.y); if (barWidth > 2f * borderWidth) { if (itemWidth > 0 && itemHeight > 0) { if (itemStyle.IsNeedCorner()) { UGL.DrawRoundRectangle(vh, center, itemWidth, itemHeight, areaColor, areaColor, 0, itemStyle.cornerRadius, isYAxis, 0.5f); } else { chart.DrawClipPolygon(vh, ref prb, ref plb, ref plt, ref prt, areaColor, areaColor, serie.clip, grid); } UGL.DrawBorder(vh, center, itemWidth, itemHeight, 2 * borderWidth, borderColor, 0, itemStyle.cornerRadius, isYAxis, 0.5f); } if (isRise) { UGL.DrawLine(vh, openCenterPos, lowPos, borderWidth, borderColor); UGL.DrawLine(vh, closeCenterPos, heighPos, borderWidth, borderColor); } else { UGL.DrawLine(vh, closeCenterPos, lowPos, borderWidth, borderColor); UGL.DrawLine(vh, openCenterPos, heighPos, borderWidth, borderColor); } } else { UGL.DrawLine(vh, openCenterPos, closeCenterPos, Mathf.Max(borderWidth, barWidth / 2), borderColor); } } if (!serie.animation.IsFinish()) { serie.animation.CheckProgress(); } if (dataChanging) { chart.RefreshPainter(serie); } }
private void DrawLineSerie(VertexHelper vh, Line serie) { if (!serie.show) { return; } if (serie.animation.HasFadeOut()) { return; } Axis axis; Axis relativedAxis; var isY = chart.GetSerieGridCoordAxis(serie, out axis, out relativedAxis); if (axis == null) { return; } if (relativedAxis == null) { return; } m_SerieGrid = chart.GetChartComponent <GridCoord>(axis.gridIndex); if (m_SerieGrid == null) { return; } if (m_EndLabel != null && !m_SerieGrid.context.endLabelList.Contains(m_EndLabel)) { m_SerieGrid.context.endLabelList.Add(m_EndLabel); } var visualMap = chart.GetVisualMapOfSerie(serie); var dataZoom = chart.GetDataZoomOfAxis(axis); var showData = serie.GetDataList(dataZoom); if (showData.Count <= 0) { return; } var axisLength = isY ? m_SerieGrid.context.height : m_SerieGrid.context.width; var scaleWid = AxisHelper.GetDataWidth(axis, axisLength, showData.Count, dataZoom); int maxCount = serie.maxShow > 0 ? (serie.maxShow > showData.Count ? showData.Count : serie.maxShow) : showData.Count; int rate = LineHelper.GetDataAverageRate(serie, m_SerieGrid, maxCount, false); var totalAverage = serie.sampleAverage > 0 ? serie.sampleAverage : DataHelper.DataAverage(ref showData, serie.sampleType, serie.minShow, maxCount, rate); var dataChanging = false; var dataChangeDuration = serie.animation.GetUpdateAnimationDuration(); var interacting = false; var lineWidth = LineHelper.GetLineWidth(ref interacting, serie, chart.theme.serie.lineWidth); axis.context.scaleWidth = scaleWid; serie.containerIndex = m_SerieGrid.index; serie.containterInstanceId = m_SerieGrid.instanceId; Serie lastSerie = null; var isStack = SeriesHelper.IsStack <Line>(chart.series, serie.stack); if (isStack) { lastSerie = SeriesHelper.GetLastStackSerie(chart.series, serie); SeriesHelper.UpdateStackDataList(chart.series, serie, dataZoom, m_StackSerieData); } var lp = Vector3.zero; for (int i = serie.minShow; i < maxCount; i += rate) { var serieData = showData[i]; var isIgnore = serie.IsIgnoreValue(serieData); if (isIgnore) { serieData.context.stackHeight = 0; serieData.context.position = Vector3.zero; if (serie.ignoreLineBreak && serie.context.dataIgnores.Count > 0) { serie.context.dataIgnores[serie.context.dataIgnores.Count - 1] = true; } } else { var np = Vector3.zero; var xValue = axis.IsCategory() ? i : serieData.GetData(0, axis.inverse); var relativedValue = DataHelper.SampleValue(ref showData, serie.sampleType, rate, serie.minShow, maxCount, totalAverage, i, dataChangeDuration, ref dataChanging, relativedAxis); serieData.context.stackHeight = GetDataPoint(isY, axis, relativedAxis, m_SerieGrid, xValue, relativedValue, i, scaleWid, isStack, ref np); serieData.context.isClip = false; if (serie.clip && !m_SerieGrid.Contains(np)) { if (m_SerieGrid.BoundaryPoint(lp, np, ref np)) { serieData.context.isClip = true; } } serie.context.dataIgnores.Add(false); serieData.context.position = np; serie.context.dataPoints.Add(np); lp = np; } } if (dataChanging || interacting) { chart.RefreshPainter(serie); } if (serie.context.dataPoints.Count <= 0) { return; } serie.animation.InitProgress(serie.context.dataPoints, isY); VisualMapHelper.AutoSetLineMinMax(visualMap, serie, isY, axis, relativedAxis); LineHelper.UpdateSerieDrawPoints(serie, chart.settings, chart.theme, visualMap, lineWidth, isY); LineHelper.DrawSerieLineArea(vh, serie, lastSerie, chart.theme, visualMap, isY, axis, relativedAxis, m_SerieGrid); LineHelper.DrawSerieLine(vh, chart.theme, serie, visualMap, m_SerieGrid, axis, relativedAxis, lineWidth); serie.context.vertCount = vh.currentVertCount; if (!serie.animation.IsFinish()) { serie.animation.CheckProgress(); serie.animation.CheckSymbol(serie.symbol.GetSize(null, chart.theme.serie.lineSymbolSize)); chart.RefreshPainter(serie); } }
private void DrawBarSerie(VertexHelper vh, SimplifiedBar serie, int colorIndex) { if (!serie.show || serie.animation.HasFadeOut()) { return; } Axis axis; Axis relativedAxis; var isY = chart.GetSerieGridCoordAxis(serie, out axis, out relativedAxis); m_SerieGrid = chart.GetChartComponent <GridCoord>(axis.gridIndex); if (axis == null) { return; } if (relativedAxis == null) { return; } if (m_SerieGrid == null) { return; } var dataZoom = chart.GetDataZoomOfAxis(axis); var showData = serie.GetDataList(dataZoom); if (showData.Count <= 0) { return; } var axisLength = isY ? m_SerieGrid.context.height : m_SerieGrid.context.width; var axisXY = isY ? m_SerieGrid.context.y : m_SerieGrid.context.x; var barCount = chart.GetSerieBarRealCount <SimplifiedBar>(); float categoryWidth = AxisHelper.GetDataWidth(axis, axisLength, showData.Count, dataZoom); float barGap = chart.GetSerieBarGap <SimplifiedBar>(); float totalBarWidth = chart.GetSerieTotalWidth <SimplifiedBar>(categoryWidth, barGap, barCount); float barWidth = serie.GetBarWidth(categoryWidth, barCount); float offset = (categoryWidth - totalBarWidth) * 0.5f; float barGapWidth = barWidth + barWidth * barGap; float gap = serie.barGap == -1 ? offset : offset + serie.index * barGapWidth; int maxCount = serie.maxShow > 0 ? (serie.maxShow > showData.Count ? showData.Count : serie.maxShow) : showData.Count; bool dataChanging = false; float dataChangeDuration = serie.animation.GetUpdateAnimationDuration(); double yMinValue = relativedAxis.context.minValue; double yMaxValue = relativedAxis.context.maxValue; var areaColor = ColorUtil.clearColor32; var areaToColor = ColorUtil.clearColor32; var interacting = false; serie.containerIndex = m_SerieGrid.index; serie.containterInstanceId = m_SerieGrid.instanceId; serie.animation.InitProgress(axisXY, axisXY + axisLength); for (int i = serie.minShow; i < maxCount; i++) { var serieData = showData[i]; if (!serieData.show || serie.IsIgnoreValue(serieData)) { serie.context.dataPoints.Add(Vector3.zero); continue; } if (serieData.IsDataChanged()) { dataChanging = true; } var highlight = serieData.context.highlight || serie.highlight; var itemStyle = SerieHelper.GetItemStyle(serie, serieData, highlight); var value = axis.IsCategory() ? i : serieData.GetData(0, axis.inverse); var relativedValue = serieData.GetCurrData(1, dataChangeDuration, relativedAxis.inverse, yMinValue, yMaxValue); var borderWidth = relativedValue == 0 ? 0 : itemStyle.runtimeBorderWidth; if (!serieData.interact.TryGetColor(ref areaColor, ref areaToColor, ref interacting)) { areaColor = SerieHelper.GetItemColor(serie, serieData, chart.theme, colorIndex, highlight); areaToColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, colorIndex, highlight); serieData.interact.SetColor(ref interacting, areaColor, areaToColor); } var pX = 0f; var pY = 0f; UpdateXYPosition(m_SerieGrid, isY, axis, relativedAxis, i, categoryWidth, barWidth, value, ref pX, ref pY); var barHig = AxisHelper.GetAxisValueLength(m_SerieGrid, relativedAxis, categoryWidth, relativedValue); var currHig = AnimationStyleHelper.CheckDataAnimation(chart, serie, i, barHig); Vector3 plb, plt, prt, prb, top; UpdateRectPosition(m_SerieGrid, isY, relativedValue, pX, pY, gap, borderWidth, barWidth, currHig, out plb, out plt, out prt, out prb, out top); serieData.context.stackHeight = barHig; serieData.context.position = top; serieData.context.rect = Rect.MinMaxRect(plb.x, plb.y, prb.x, prt.y); serie.context.dataPoints.Add(top); DrawNormalBar(vh, serie, serieData, itemStyle, colorIndex, highlight, gap, barWidth, pX, pY, plb, plt, prt, prb, false, m_SerieGrid, areaColor, areaToColor); if (serie.animation.CheckDetailBreak(top, isY)) { break; } } if (!serie.animation.IsFinish()) { serie.animation.CheckProgress(); chart.RefreshPainter(serie); } if (dataChanging || interacting) { chart.RefreshPainter(serie); } }
private void DrawLineSerie(VertexHelper vh, SimplifiedLine serie) { if (!serie.show) { return; } if (serie.animation.HasFadeOut()) { return; } Axis axis; Axis relativedAxis; var isY = chart.GetSerieGridCoordAxis(serie, out axis, out relativedAxis); m_SerieGrid = chart.GetChartComponent <GridCoord>(axis.gridIndex); if (axis == null) { return; } if (relativedAxis == null) { return; } if (m_SerieGrid == null) { return; } var dataZoom = chart.GetDataZoomOfAxis(axis); var showData = serie.GetDataList(dataZoom); if (showData.Count <= 0) { return; } var axisLength = isY ? m_SerieGrid.context.height : m_SerieGrid.context.width; var scaleWid = AxisHelper.GetDataWidth(axis, axisLength, showData.Count, dataZoom); int maxCount = serie.maxShow > 0 ? (serie.maxShow > showData.Count ? showData.Count : serie.maxShow) : showData.Count; int rate = LineHelper.GetDataAverageRate(serie, m_SerieGrid, maxCount, false); var totalAverage = serie.sampleAverage > 0 ? serie.sampleAverage : DataHelper.DataAverage(ref showData, serie.sampleType, serie.minShow, maxCount, rate); var dataChanging = false; var dataChangeDuration = serie.animation.GetUpdateAnimationDuration(); var interacting = false; var lineWidth = LineHelper.GetLineWidth(ref interacting, serie, chart.theme.serie.lineWidth); axis.context.scaleWidth = scaleWid; serie.containerIndex = m_SerieGrid.index; serie.containterInstanceId = m_SerieGrid.instanceId; for (int i = serie.minShow; i < maxCount; i += rate) { var serieData = showData[i]; var isIgnore = serie.IsIgnoreValue(serieData); if (isIgnore) { serieData.context.stackHeight = 0; serieData.context.position = Vector3.zero; if (serie.ignoreLineBreak && serie.context.dataIgnores.Count > 0) { serie.context.dataIgnores[serie.context.dataIgnores.Count - 1] = true; } } else { var np = Vector3.zero; var xValue = axis.IsCategory() ? i : serieData.GetData(0, axis.inverse); var relativedValue = DataHelper.SampleValue(ref showData, serie.sampleType, rate, serie.minShow, maxCount, totalAverage, i, dataChangeDuration, ref dataChanging, relativedAxis); serieData.context.stackHeight = GetDataPoint(isY, axis, relativedAxis, m_SerieGrid, xValue, relativedValue, i, scaleWid, false, ref np); serieData.context.position = np; serie.context.dataPoints.Add(np); serie.context.dataIgnores.Add(false); } } if (dataChanging || interacting) { chart.RefreshPainter(serie); } if (serie.context.dataPoints.Count <= 0) { return; } serie.animation.InitProgress(serie.context.dataPoints, isY); LineHelper.UpdateSerieDrawPoints(serie, chart.settings, chart.theme, null, lineWidth, isY); LineHelper.DrawSerieLineArea(vh, serie, null, chart.theme, null, isY, axis, relativedAxis, m_SerieGrid); LineHelper.DrawSerieLine(vh, chart.theme, serie, null, m_SerieGrid, axis, relativedAxis, lineWidth); serie.context.vertCount = vh.currentVertCount; if (!serie.animation.IsFinish()) { serie.animation.CheckProgress(); chart.RefreshPainter(serie); } }
private void DrawBarSerie(VertexHelper vh, Bar serie, int colorIndex) { if (!serie.show || serie.animation.HasFadeOut()) { return; } Axis axis; Axis relativedAxis; var isY = chart.GetSerieGridCoordAxis(serie, out axis, out relativedAxis); m_SerieGrid = chart.GetChartComponent <GridCoord>(axis.gridIndex); if (axis == null) { return; } if (relativedAxis == null) { return; } if (m_SerieGrid == null) { return; } var dataZoom = chart.GetDataZoomOfAxis(axis); var showData = serie.GetDataList(dataZoom); if (showData.Count <= 0) { return; } var axisLength = isY ? m_SerieGrid.context.height : m_SerieGrid.context.width; var relativedAxisLength = isY ? m_SerieGrid.context.width : m_SerieGrid.context.height; var axisXY = isY ? m_SerieGrid.context.y : m_SerieGrid.context.x; var isStack = SeriesHelper.IsStack <Bar>(chart.series, serie.stack); if (isStack) { SeriesHelper.UpdateStackDataList(chart.series, serie, dataZoom, m_StackSerieData); } var barCount = chart.GetSerieBarRealCount <Bar>(); float categoryWidth = AxisHelper.GetDataWidth(axis, axisLength, showData.Count, dataZoom); float barGap = chart.GetSerieBarGap <Bar>(); float totalBarWidth = chart.GetSerieTotalWidth <Bar>(categoryWidth, barGap, barCount); float barWidth = serie.GetBarWidth(categoryWidth, barCount); float offset = (categoryWidth - totalBarWidth) * 0.5f; var serieReadIndex = chart.GetSerieIndexIfStack <Bar>(serie); float gap = serie.barGap == -1 ? offset : offset + chart.GetSerieTotalGap <Bar>(categoryWidth, barGap, serieReadIndex); int maxCount = serie.maxShow > 0 ? (serie.maxShow > showData.Count ? showData.Count : serie.maxShow) : showData.Count; var isPercentStack = SeriesHelper.IsPercentStack <Bar>(chart.series, serie.stack); bool dataChanging = false; float dataChangeDuration = serie.animation.GetUpdateAnimationDuration(); double yMinValue = relativedAxis.context.minValue; double yMaxValue = relativedAxis.context.maxValue; var areaColor = ColorUtil.clearColor32; var areaToColor = ColorUtil.clearColor32; var interacting = false; serie.containerIndex = m_SerieGrid.index; serie.containterInstanceId = m_SerieGrid.instanceId; serie.animation.InitProgress(axisXY, axisXY + axisLength); for (int i = serie.minShow; i < maxCount; i++) { var serieData = showData[i]; serieData.index = i; if (!serieData.show || serie.IsIgnoreValue(serieData)) { serie.context.dataPoints.Add(Vector3.zero); continue; } if (serieData.IsDataChanged()) { dataChanging = true; } var highlight = serieData.context.highlight || serie.highlight; var itemStyle = SerieHelper.GetItemStyle(serie, serieData, highlight); var value = axis.IsCategory() ? i : serieData.GetData(0, axis.inverse); var relativedValue = serieData.GetCurrData(1, dataChangeDuration, relativedAxis.inverse, yMinValue, yMaxValue); var borderWidth = relativedValue == 0 ? 0 : itemStyle.runtimeBorderWidth; var borderGap = relativedValue == 0 ? 0 : itemStyle.borderGap; var borderGapAndWidth = borderWidth + borderGap; if (!serieData.interact.TryGetColor(ref areaColor, ref areaToColor, ref interacting)) { areaColor = SerieHelper.GetItemColor(serie, serieData, chart.theme, colorIndex, highlight); areaToColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, colorIndex, highlight); serieData.interact.SetColor(ref interacting, areaColor, areaToColor); } var pX = 0f; var pY = 0f; UpdateXYPosition(m_SerieGrid, isY, axis, relativedAxis, i, categoryWidth, barWidth, isStack, value, ref pX, ref pY); var barHig = 0f; if (isPercentStack) { var valueTotal = chart.GetSerieSameStackTotalValue <Bar>(serie.stack, i); barHig = valueTotal != 0 ? (float)(relativedValue / valueTotal * relativedAxisLength) : 0; } else { barHig = AxisHelper.GetAxisValueLength(m_SerieGrid, relativedAxis, categoryWidth, relativedValue); } float currHig = AnimationStyleHelper.CheckDataAnimation(chart, serie, i, barHig); Vector3 plb, plt, prt, prb, top; UpdateRectPosition(m_SerieGrid, isY, relativedValue, pX, pY, gap, borderWidth, barWidth, currHig, out plb, out plt, out prt, out prb, out top); serieData.context.stackHeight = barHig; serieData.context.position = top; serieData.context.rect = Rect.MinMaxRect(plb.x + borderGapAndWidth, plb.y + borderGapAndWidth, prt.x - borderGapAndWidth, prt.y - borderGapAndWidth); serieData.context.backgroundRect = isY ? Rect.MinMaxRect(m_SerieGrid.context.x, plb.y, m_SerieGrid.context.x + relativedAxisLength, prt.y) : Rect.MinMaxRect(plb.x, m_SerieGrid.context.y, prb.x, m_SerieGrid.context.y + relativedAxisLength); if (!serie.clip || (serie.clip && m_SerieGrid.Contains(top))) { serie.context.dataPoints.Add(top); } else { continue; } if (serie.show && currHig != 0 && !serie.placeHolder) { switch (serie.barType) { case BarType.Normal: case BarType.Capsule: DrawNormalBar(vh, serie, serieData, itemStyle, colorIndex, highlight, gap, barWidth, pX, pY, plb, plt, prt, prb, isY, m_SerieGrid, axis, areaColor, areaToColor, relativedValue); break; case BarType.Zebra: DrawZebraBar(vh, serie, serieData, itemStyle, colorIndex, highlight, gap, barWidth, pX, pY, plb, plt, prt, prb, isY, m_SerieGrid, axis, areaColor, areaToColor); break; } } if (serie.animation.CheckDetailBreak(top, isY)) { break; } } if (!serie.animation.IsFinish()) { serie.animation.CheckProgress(); chart.RefreshPainter(serie); } if (dataChanging || interacting) { chart.RefreshPainter(serie); } }