0
LineChartView가 있으며 xAxis에 대한 레이블을 표시하려고합니다. 내 코드는 다음과 같습니다stringForValue가 호출 되더라도 XAxis 레이블이 표시되지 않습니다.
chartView.chartDescription?.enabled = false
chartView.drawGridBackgroundEnabled = false
chartView.dragEnabled = !chartView.isFullyZoomedOut
chartView.setScaleEnabled(true)
chartView.pinchZoomEnabled = true
chartView.setViewPortOffsets(left: 20.0, top: 0.0, right: 20.0, bottom: 0.0)
chartView.legend.enabled = true
chartView.legend.textColor = legendColor
chartView.legend.form = .empty
chartView.leftAxis.enabled = false
chartView.leftAxis.spaceTop = 0.4
chartView.leftAxis.spaceBottom = 0.4
chartView.rightAxis.enabled = false
chartView.xAxis.enabled = true
chartView.xAxis.labelTextColor = UIColor.black
chartView.xAxis.valueFormatter = self
chartView.xAxis.drawGridLinesEnabled = false
chartView.xAxis.drawLabelsEnabled = true
chartView.xAxis.drawAxisLineEnabled = false
chartView.highlightPerTapEnabled = false
chartView.highlightPerDragEnabled = false
if lineChartData.entryCount > 0 {
chartView.data = lineChartData
}
chartView.noDataText = NSLocalizedString("No chart data available", comment: String())
chartView.maxVisibleCount = 12
chartView.delegate = self
및
extension ChartCell: IAxisValueFormatter {
func stringForValue(_ value: Double, axis: AxisBase?) -> String {
return "foo"
}
} 내가 stringForValue가 호출되는 것을 볼 수 디버거에서
는, 그러나 그려진 차트에 레이블이 없습니다. 나는 여기에 실종됐다.
는 거의, 나는 그것이 작동하려면 XAxis.LabelPosition.bottomInside를 사용하는 데 필요한. 감사! 아마도 UITableViewCell 내부에서 lineChartView를 사용하여 설정 한 경우 레이블 위치가 * 내부에서 작동하게 될 것이라고 생각합니다. – JonEasy