I have the following code set up to create a basic bar chart and I would like the chart to appear in my UIView called chartView that I created in the center of my view controller. When I run the app the bar chart appears in the bottom right corner of the screen.
func setChart(data:[(String,Double)]) {
let chartConfig = BarsChartConfig(
valsAxisConfig: ChartAxisConfig(from: 0, to: 250, by: 20)
)
let frame = chartView.frame
let chart = BarsChart(
frame: frame,
chartConfig: chartConfig,
xTitle: "X axis",
yTitle: "Y axis",
bars: data,
color: UIColor.red,
barWidth: 20
)
chartView.addSubview(chart.view)
self.chart = chart
}
I have the following code set up to create a basic bar chart and I would like the chart to appear in my UIView called
chartView
that I created in the center of my view controller. When I run the app the bar chart appears in the bottom right corner of the screen.