I have a bar chart built using Daniel Gindi iOS-charts. It represents history data over a period of time. The issue I am having is that the data is being plotted from left-to-right (new data -> old data). I need it to be plotted as right-to-left (old data -> new data). I know that I can reverse the order I input data into BarChartData
, but then I have the issue of the chart still being left aligned. It needs to be right aligned. I found a discussion here talking about the issue of inverting the x-axis and how it could be resolved (currently not an included feature of the framework), however I can't figure out what actually needs to be done. Here are examples of what I need:
This is what my chart currently looks like:
This is what I needs it to look like:
My Questions
Is there a way to invert the x-axis?
or
Is there a way to right align the chart?
Here is some of my code and attempts to resolve the issue:
class ViewController: UIViewController {
@IBOutlet weak var barChartView: BarChartView!
//...
func plotChart() {
// Create history data
//...
barChartView.data = chartData // 'chartData' is the BarChartData() containing all of the history information
// No efect
barChartView.legend.direction = .RightToLeft
// Chart breaks
barChartView.leftAxis.axisMinValue = 30
barChartView.leftAxis.axisMaxValue = 0
// Breaks the ability to zoom
barChartView.setVisibleXRangeMinimum(CGFloat(40))
barChartView.setVisibleXRangeMaximum(CGFloat(1))
}
}