I'd like to save a full-sized image of my entire chart.
I usually show a maximum of 15 X values (barChartView.setVisibleXRange(minXRange: 3, maxXRange: 15)
), so users must scroll to view all data.
I currently save the image like so:
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)
This works - the whole chart is saved as an image, however it seems to effectively be just a screenshot of the chart as it appears on my device (i.e. with a lot of data it seems pretty squashed up).
Is there a way to save a bigger image of the entire chart with all data (e.g. to emulate the size when 15 values are shown)?