如何把酒吧的价值里面栏上的iOS版雨燕图表Horizo ntalBarChartView?

问题描述 投票:0回答:1

我试图把酒吧的价值里面栏上我的Horizo​​ntalBarChartView,因为有些值在屏幕的右侧裁剪,但我没有发现在网络上搜索解决方案。另外,我还要把标签贴在图表的左侧,但我不知道如何这一点,我不能在同一个问题问两两件事。

这是我的设置表的代码:

func setupChart() {
    self.chartViewHorizontal.fitBars                   = true
    self.chartViewHorizontal.legend.enabled            = false
    self.chartViewHorizontal.isUserInteractionEnabled  = false
    self.chartViewHorizontal.animate(yAxisDuration: 1.5)

    self.chartViewHorizontal.rightAxis.enabled = false

    self.chartViewHorizontal.leftAxis.labelCount      = 5
    self.chartViewHorizontal.leftAxis.labelFont       = UIFont.boldSystemFont(ofSize: 10.0)
    self.chartViewHorizontal.leftAxis.valueFormatter  = CustomAxisValueFormatter()

    self.chartViewHorizontal.xAxis.drawGridLinesEnabled    = false
    self.chartViewHorizontal.xAxis.enabled                 = false
}

结果是:

enter image description here

我要这个:

enter image description here

我'使用此lib目录下:https://github.com/danielgindi/Charts

ios swift charts ios-charts
1个回答
1
投票

尝试设置以下属性假你chartview

self.chartViewHorizontal.drawValueAboveBarEnabled = false

这将帮助你进去BarChart你的价值标签。

对于你的第二个问题,把你的x轴标签的ChartView的左侧,你可以使用以下属性来设置它放在左侧。

self.chartViewHorizontal.xAxis.labelPosition = .bottom

尝试上述财产,你会实现你的要求。

© www.soinside.com 2019 - 2024. All rights reserved.