ios - 如果 bar 值为 0.0,如何隐藏 markerView。在使用 iOS 图表的条形图中
问题描述
我正在使用 iOS 图表在水龙头上添加标记。我只想在值不为零时打开标记。我们可以使用 iOS 图表库来做到这一点吗?
解决方案
首先设置 barChartView 的委托,然后在 chartValueSelected 函数中编写这段代码
func chartValueSelected(_ chartView: ChartViewBase, entry: ChartDataEntry, highlight: Highlight){
if entry.y == 0.0{
barChartView.highlightValue(nil, callDelegate: false)
}
}
无论您需要隐藏标记,只需添加此代码
barChartView.highlightValue(nil, callDelegate: false)
推荐阅读
- haskell - 如果一个字母只使用一次,检查一个字符串 Haskell
- php - 在 PHP 中使用标签作为 ID 回显值
- c - 如何从堆内存数组INSIDE STRUCT中写入?
- c - 如何查找 char* [] 数组的长度
- android - Dagger 2 在活动中注入 DialogUtils 类
- pdf - 使用非常大的 libredraw 输出大小从 pdf 中删除“水印”
- c# - 如何使用 Windows 7 在 Unity3D 上使用 .Net 4.X
- python - 在 pandas Dataframe 或 numpy 数组中查找值的先前实例的快速方法?
- serial-port - 使用 Phonegap cordova 插件在 Android 串行端口上进行 TX/RX
- javascript - 使用上一页的 css 并应用到当前页