最佳答案
在 LineChartRenderer.swift 中,在绘制文本时增加了 y 的值,在这个例子中我增加了 30:
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)])
}
结果:
关于swift - 将标签的位置更改为在数据集圆圈内,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44910889/