private void DrawBarBackground(VertexHelper vh, Serie serie, SerieData serieData, ItemStyle itemStyle, int colorIndex, bool highlight, float pX, float pY, float space, float barWidth, bool isYAxis, Grid grid) { var color = SerieHelper.GetItemBackgroundColor(serie, serieData, m_Theme, colorIndex, highlight, false); if (ChartHelper.IsClearColor(color)) { return; } if (isYAxis) { var axis = m_YAxes[serie.yAxisIndex]; var axisWidth = axis.axisLine.GetWidth(m_Theme.axis.lineWidth); Vector3 plt = new Vector3(grid.runtimeX + axisWidth, pY + space + barWidth); Vector3 prt = new Vector3(grid.runtimeX + axisWidth + grid.runtimeWidth, pY + space + barWidth); Vector3 prb = new Vector3(grid.runtimeX + axisWidth + grid.runtimeWidth, pY + space); Vector3 plb = new Vector3(grid.runtimeX + axisWidth, pY + space); if (serie.barType == BarType.Capsule) { var radius = barWidth / 2; var diff = Vector3.right * radius; var pcl = (plt + plb) / 2 + diff; var pcr = (prt + prb) / 2 - diff; Internal_CheckClipAndDrawPolygon(vh, plb + diff, plt + diff, prt - diff, prb - diff, color, color, serie.clip, grid); UGL.DrawSector(vh, pcl, radius, color, 180, 360); UGL.DrawSector(vh, pcr, radius, color, 0, 180); if (itemStyle.NeedShowBorder()) { var borderWidth = itemStyle.borderWidth; var borderColor = itemStyle.borderColor; var smoothness = settings.cicleSmoothness; var inRadius = radius - borderWidth; var outRadius = radius; var p1 = plb + diff + Vector3.up * borderWidth / 2; var p2 = prb - diff + Vector3.up * borderWidth / 2; var p3 = plt + diff - Vector3.up * borderWidth / 2; var p4 = prt - diff - Vector3.up * borderWidth / 2; UGL.DrawLine(vh, p1, p2, borderWidth / 2, borderColor); UGL.DrawLine(vh, p3, p4, borderWidth / 2, borderColor); UGL.DrawDoughnut(vh, pcl, inRadius, outRadius, borderColor, ChartConst.clearColor32, 180, 360, smoothness); UGL.DrawDoughnut(vh, pcr, inRadius, outRadius, borderColor, ChartConst.clearColor32, 0, 180, smoothness); } } else { Internal_CheckClipAndDrawPolygon(vh, ref plb, ref plt, ref prt, ref prb, color, color, serie.clip, grid); } } else { var axis = m_XAxes[serie.xAxisIndex]; var axisWidth = axis.axisLine.GetWidth(m_Theme.axis.lineWidth); Vector3 plb = new Vector3(pX + space, grid.runtimeY + axisWidth); Vector3 plt = new Vector3(pX + space, grid.runtimeY + grid.runtimeHeight + axisWidth); Vector3 prt = new Vector3(pX + space + barWidth, grid.runtimeY + grid.runtimeHeight + axisWidth); Vector3 prb = new Vector3(pX + space + barWidth, grid.runtimeY + axisWidth); if (serie.barType == BarType.Capsule) { var radius = barWidth / 2; var diff = Vector3.up * radius; var pct = (plt + prt) / 2 - diff; var pcb = (plb + prb) / 2 + diff; Internal_CheckClipAndDrawPolygon(vh, prb + diff, plb + diff, plt - diff, prt - diff, color, color, serie.clip, grid); UGL.DrawSector(vh, pct, radius, color, 270, 450); UGL.DrawSector(vh, pcb, radius, color, 90, 270); if (itemStyle.NeedShowBorder()) { var borderWidth = itemStyle.borderWidth; var borderColor = itemStyle.borderColor; var smoothness = settings.cicleSmoothness; var inRadius = radius - borderWidth; var outRadius = radius; var p1 = plb + diff + Vector3.right * borderWidth / 2; var p2 = plt - diff + Vector3.right * borderWidth / 2; var p3 = prb + diff - Vector3.right * borderWidth / 2; var p4 = prt - diff - Vector3.right * borderWidth / 2; UGL.DrawLine(vh, p1, p2, borderWidth / 2, borderColor); UGL.DrawLine(vh, p3, p4, borderWidth / 2, borderColor); UGL.DrawDoughnut(vh, pct, inRadius, outRadius, borderColor, ChartConst.clearColor32, 270, 450, smoothness); UGL.DrawDoughnut(vh, pcb, inRadius, outRadius, borderColor, ChartConst.clearColor32, 90, 270, smoothness); } } else { Internal_CheckClipAndDrawPolygon(vh, ref prb, ref plb, ref plt, ref prt, color, color, serie.clip, grid); } } }
private void DrawBarBackground(VertexHelper vh, Serie serie, SerieData serieData, ItemStyle itemStyle, int colorIndex, bool highlight, float pX, float pY, float space, float barWidth, bool isYAxis) { Color color = SerieHelper.GetItemBackgroundColor(serie, serieData, m_ThemeInfo, colorIndex, highlight, false); if (color == Color.clear) { return; } if (isYAxis) { var axis = m_YAxises[serie.axisIndex]; var axisWidth = axis.axisLine.width; Vector3 plt = new Vector3(coordinateX + axisWidth, pY + space + barWidth); Vector3 prt = new Vector3(coordinateX + axisWidth + coordinateWidth, pY + space + barWidth); Vector3 prb = new Vector3(coordinateX + axisWidth + coordinateWidth, pY + space); Vector3 plb = new Vector3(coordinateX + axisWidth, pY + space); if (serie.barType == BarType.Capsule) { var radius = barWidth / 2; var diff = Vector3.right * radius; var pcl = (plt + plb) / 2 + diff; var pcr = (prt + prb) / 2 - diff; CheckClipAndDrawPolygon(vh, plb + diff, plt + diff, prt - diff, prb - diff, color, color, serie.clip); ChartDrawer.DrawSector(vh, pcl, radius, color, 180, 360); ChartDrawer.DrawSector(vh, pcr, radius, color, 0, 180); if (itemStyle.NeedShowBorder()) { var borderWidth = itemStyle.borderWidth; var borderColor = itemStyle.borderColor; var smoothness = m_Settings.cicleSmoothness; var inRadius = radius - borderWidth; var outRadius = radius; var p1 = plb + diff + Vector3.up * borderWidth / 2; var p2 = prb - diff + Vector3.up * borderWidth / 2; var p3 = plt + diff - Vector3.up * borderWidth / 2; var p4 = prt - diff - Vector3.up * borderWidth / 2; ChartDrawer.DrawLine(vh, p1, p2, borderWidth / 2, borderColor); ChartDrawer.DrawLine(vh, p3, p4, borderWidth / 2, borderColor); ChartDrawer.DrawDoughnut(vh, pcl, inRadius, outRadius, borderColor, Color.clear, 180, 360, smoothness); ChartDrawer.DrawDoughnut(vh, pcr, inRadius, outRadius, borderColor, Color.clear, 0, 180, smoothness); } } else { CheckClipAndDrawPolygon(vh, ref plb, ref plt, ref prt, ref prb, color, color, serie.clip); } } else { var axis = m_XAxises[serie.axisIndex]; var axisWidth = axis.axisLine.width; Vector3 plb = new Vector3(pX + space, coordinateY + axisWidth); Vector3 plt = new Vector3(pX + space, coordinateY + coordinateHeight + axisWidth); Vector3 prt = new Vector3(pX + space + barWidth, coordinateY + coordinateHeight + axisWidth); Vector3 prb = new Vector3(pX + space + barWidth, coordinateY + axisWidth); if (serie.barType == BarType.Capsule) { var radius = barWidth / 2; var diff = Vector3.up * radius; var pct = (plt + prt) / 2 - diff; var pcb = (plb + prb) / 2 + diff; CheckClipAndDrawPolygon(vh, prb + diff, plb + diff, plt - diff, prt - diff, color, color, serie.clip); ChartDrawer.DrawSector(vh, pct, radius, color, 270, 450); ChartDrawer.DrawSector(vh, pcb, radius, color, 90, 270); if (itemStyle.NeedShowBorder()) { var borderWidth = itemStyle.borderWidth; var borderColor = itemStyle.borderColor; var smoothness = m_Settings.cicleSmoothness; var inRadius = radius - borderWidth; var outRadius = radius; var p1 = plb + diff + Vector3.right * borderWidth / 2; var p2 = plt - diff + Vector3.right * borderWidth / 2; var p3 = prb + diff - Vector3.right * borderWidth / 2; var p4 = prt - diff - Vector3.right * borderWidth / 2; ChartDrawer.DrawLine(vh, p1, p2, borderWidth / 2, borderColor); ChartDrawer.DrawLine(vh, p3, p4, borderWidth / 2, borderColor); ChartDrawer.DrawDoughnut(vh, pct, inRadius, outRadius, borderColor, Color.clear, 270, 450, smoothness); ChartDrawer.DrawDoughnut(vh, pcb, inRadius, outRadius, borderColor, Color.clear, 90, 270, smoothness); } } else { CheckClipAndDrawPolygon(vh, ref prb, ref plb, ref plt, ref prt, color, color, serie.clip); } } }