gpt4 book ai didi

swift - 使用最新的 ioscharts 显示条形图时出现问题

转载 作者:可可西里 更新时间:2023-11-01 02:17:26 24 4
gpt4 key购买 nike

我在 2 个月后将 ios-charts 更新为最新代码。当我运行代码时,我看到了很多不同之处。

这是在更新库之前:

enter image description here

更新后:

enter image description here

这是生成图表的代码:

    chart.infoTextColor = UIColor.blackColor()

chart.backgroundColor = UIColor.whiteColor()
chart.descriptionText = ""
chart.noDataText = "Loading..."
chart.rightAxis.enabled = false
chart.xAxis.wordWrapEnabled = true

chart.legend.position = .BelowChartCenter;
chart.legend.form = .Circle;
chart.legend.formSize = 10.0;
chart.legend.formToTextSpace = 10.0;
chart.legend.xEntrySpace = 4.0;
chart.legend.yEntrySpace = 2.0
chart.legend.stackSpace = 5.0
chart.legend.textColor = UIColor.blueColor()

chart.xAxis.gridColor = UIColor.blueColor()
// chart.xAxis.axisLineColor = UIColor.blueColor()

chart.gridBackgroundColor = UIColor.whiteColor()
chart.borderColor = UIColor.redColor()

// chart.xAxis.labelHeight = 18
// chart.xAxis.labelWidth = 18
chart.xAxis.labelPosition = .Bottom;
chart.xAxis.drawGridLinesEnabled = false;

chart.rightAxis.drawGridLinesEnabled = false;

//zooming..
chart.pinchZoomEnabled = false
chart.doubleTapToZoomEnabled = false
chart.scaleXEnabled = false
chart.scaleYEnabled = false

//new..
chart.leftAxis.labelPosition = .InsideChart
chartDataSet.barSpace = 0.38

最佳答案

最新版本已弃用 startAtZeroEnabled,这似乎是您的情况。

请尝试设置 customAxisMin 以获得预期范围。例如customAxisMin = 0

记得在调用chartView.data = yourData之前设置,否则需要专门调用chartView.notifyDataSetChanged()

关于swift - 使用最新的 ioscharts 显示条形图时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35798915/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com