ios - iOS 图表 - 将完整图表另存为图像
问题描述
我想保存整个图表的全尺寸图像。
我通常最多显示 15 个 X 值 ( barChartView.setVisibleXRange(minXRange: 3, maxXRange: 15)
),因此用户必须滚动才能查看所有数据。
我目前像这样保存图像:
let number = Double(chartValues.count)
barChartView.setVisibleXRange(minXRange: number, maxXRange: number) // Show full chart
barChartView.xAxis.labelRotationAngle = 90 // Rotate labels for image
barChartView.drawMarkers = false // Hide any shown markers
barChartView.highlightValues(nil) // Unhighlight all bars
barChartView.notifyDataSetChanged()
UIImageWriteToSavedPhotosAlbum(barChartView.getChartImage(transparent: false)!, nil, nil, nil)
这行得通——整个图表被保存为图像,但它似乎实际上只是图表的屏幕截图,因为它出现在我的设备上(即,有很多数据,它似乎被压扁了)。
有没有办法用所有数据保存整个图表的更大图像(例如,在显示 15 个值时模拟大小)?
解决方案
推荐阅读
- ruby-on-rails - VS Code 如何在 Rails 上调试 ruby 并同时做出反应?
- swift - touchesBegan 未在 UITextField 上调用
- c - 那个静态分析警告是误报吗?我无法安静下来
- linux - 如何从文件中添加对话框菜单项?
- r - 如何在 R 中安装不同的 Swirl 课程
- javascript - 在图像周围动态创建一个或多个边框
- html - Svg 图标仅显示一半大小
- android - 如何在 android studio 中使用 Safetynet recaptcha api?
- javascript - 使用 JavaScript 根据滚动位置应用 CSS 参数
- c - 为什么我在 Valgrind 中收到此代码的“内存错误”?