公告
财富商城
积分规则
提问
发文
2019-07-31 12:38发布
趁早两清
I am using the iOS-Charts framework and have the following chart:
I would like to change the position of the numbers (labels) to appear within the circle. Is it possible to achieve this?
Inside LineChartRenderer.swift, increased the value of y when text is being drawn, I increase it by 30 in this example:
if dataSet.isDrawValuesEnabled { ChartUtils.drawText( context: context, text: formatter.stringForValue( e.y, entry: e, dataSetIndex: i, viewPortHandler: viewPortHandler), point: CGPoint( x: pt.x, y: pt.y - CGFloat(valOffset) - valueFont.lineHeight + 30), align: .center, attributes: [NSFontAttributeName: valueFont, NSForegroundColorAttributeName: dataSet.valueTextColorAt(j)]) }
Result:
最多设置5个标签!
Inside LineChartRenderer.swift, increased the value of y when text is being drawn, I increase it by 30 in this example:
Result: