diff --git a/CHANGELOG.md b/CHANGELOG.md index e5848dd105347a4854db65732a9479155df2fe3c..608735bdf824094c68744c3bc1f2fd5b2b103a8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ - 优化瀑布图WaterfallChart的滑动耗时 - 优化设置虚线耗时 - 优化性能:1.去掉多余pathValueToPixel方法调用2.缓存文本值 +- 修复barchart文本位置不对的问题 ## 3.0.3-rc.4 - 修复markerView不显示的问题 diff --git a/library/src/main/ets/components/renderer/BarChartRenderer.ets b/library/src/main/ets/components/renderer/BarChartRenderer.ets index ee3fe66c600c641e92e5d213f4293dc421206176..2c5d5e7f2385723afe44412d3b5ff4bcdbf19944 100644 --- a/library/src/main/ets/components/renderer/BarChartRenderer.ets +++ b/library/src/main/ets/components/renderer/BarChartRenderer.ets @@ -289,7 +289,6 @@ export default class BarChartRenderer extends BarLineScatterCandleBubbleRenderer let posOffset: number = 0; let negOffset: number = 0; let drawValueAboveBar: boolean = this.mChart.isDrawValueAboveBarEnabled(); - let valueTextHeight: number = Utils.getLabelTextSize(this.mValuePaint, "8", this.textSizeCache).height; for (let i = 0; i < barData.getDataSetCount(); i++) { let dataSet: IBarDataSet = dataSets.get(i); @@ -304,6 +303,7 @@ export default class BarChartRenderer extends BarLineScatterCandleBubbleRenderer // calculate the correct offset depending on the draw position of // the value + let valueTextHeight: number = Utils.getLabelTextSize(this.mValuePaint, "8", this.textSizeCache).height; posOffset = (drawValueAboveBar ? -valueOffsetPlus : valueTextHeight + valueOffsetPlus); negOffset = (drawValueAboveBar ? valueTextHeight + valueOffsetPlus : -valueOffsetPlus);