使用组合图来解决Xaxis标签对齐问题的Charts库

时间:2019-01-25 14:54:47

标签: ios swift

enter image description here现在,当我尝试设置动态数据时,我已将组合图与Charts库一起使用,然后此处遇到的Xaxis值对齐问题将附加所有属性,因为我已经在代码中设置了但无法正常工作。

func initialChartSetup() 
  {
    let xAxisValue = chartView.xAxis
    xAxisValue.valueFormatter = axisFormatDelegate
    xAxisValue.labelPosition = XAxis.LabelPosition.bottom
    xAxisValue.drawGridLinesEnabled = false
    xAxisValue.granularityEnabled = true
    xAxisValue.granularity = 1
    xAxisValue.spaceMin = 0.5
    xAxisValue.spaceMax = 0.5
    xAxisValue.forceLabelsEnabled = true
    xAxisValue.labelTextColor = UIColor.white

     xAxisValue.labelCount = 6

    chartView.leftAxis.axisMinimum = 0
    chartView.leftAxis.labelTextColor = UIColor.white
    chartView.leftAxis.gridColor = NSUIColor.clear

    chartView.rightAxis.drawLabelsEnabled = false

    chartView.legend.enabled = false

    chartView.doubleTapToZoomEnabled = false
    chartView.pinchZoomEnabled = false
}

0 个答案:

没有答案