ios - X 轴 Action 奇怪 - iOS 图表

标签 ios swift charts tableview ios-charts

我正在使用Charts library在 iOS 上,但我在使用 TableView 中的一张图表时遇到了问题。 X 轴看起来很奇怪,而且我的数据分辨率下降了。这是它目前的样子:

enter image description here

我的数据通常在 900 到 1100 之间。

我这样配置图表:

let dataSet = LineChartDataSet(values: entries, label: "")
dataSet.drawCirclesEnabled = false
dataSet.lineWidth = 2
dataSet.mode = .horizontalBezier
dataSet.colors = UIColor.gray
dataSet.drawValuesEnabled = false

let lineChartData = LineChartData(dataSets: [dataSet])
self.chartEntries.append(lineChartData)

关于为什么我的 X 轴看起来像这样,有什么想法吗?我的其他图表看起来不错。

最佳答案

该图表看起来不错,因为它试图将值 1000 左右的数据压缩到一个非常小的空间中。如果您查看MPAndroidChart lib wiki ,您可以看到您可以调整每个轴的最小和最大范围,因此您可以有效地放大到更接近您的值以更好地查看分布:

setAxisMaximum(float max): Set a custom maximum value for this axis. If set, this value will not be calculated automatically depending on the provided data.

setAxisMinimum(float min): Set a custom minimum value for this axis. If set, this value will not be calculated automatically depending on the provided data.

它看起来像:

graph.yAxis.axisMinimum = 900
graph.yAxis.axisMaximum = 1100

关于ios - X 轴 Action 奇怪 - iOS 图表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55065216/

相关文章:

ios - 如何更新现有应用程序在 Appstore 上的可用地区?

javascript - ExtJS - 堆积条形图条件着色

swift - 如何在 swift 中为 UIVIew 制作曲线顶部?

ios - 我的音效循环的代码是什么

arrays - Swift 空数组没有名为 .insert 的成员

javascript - 更改 nvd3 图表中的边距和填充

java - Java 中的 3D 散点图和 3D 图形可视化

ios - 应用程序因 EXC_BREAKPOINT 错误而崩溃

ios - 具有倍增效果的 Swift UIView

c# - UITableView reloadData 重复单元格