Closed imaaronath closed 3 years ago
Can you post some minimal, reproducible code? A Screenshot?
On a side note, can you change the title of the post to something more findable for others?
Thanks, Will
GroupedBarDataSet(dataPoints: [GroupedBarDataPoint(value: 20, description: "Q1", group: GroupingData(title: "A", colour: ColourStyle(colour: .red))),GroupedBarDataPoint(value: 40, description: "Q2", group: GroupingData(title: "A", colour: ColourStyle(colour: .red)))], setTitle: "Halo")])
I think the issue is to many labels in the y axis.
ChartStyle(...
yAxisNumberOfLabels: 3
...
I'm sorry , I don't understand bcs my code
let data = GroupedBarDataSets(dataSets: [ GroupedBarDataSet(dataPoints: [GroupedBarDataPoint(value: 20, description: "Q1", group: GroupingData(title: "A", colour: ColourStyle(colour: .red))),GroupedBarDataPoint(value: 40, description: "Q2", group: GroupingData(title: "A", colour: ColourStyle(colour: .red)))], setTitle: "Halo")]) let group = [GroupingData(title: "A", colour: ColourStyle(colour: .red)),GroupingData(title: "B", colour: ColourStyle(colour: .blue)),GroupingData(title: "C", colour: ColourStyle(colour: .green))] let metadata = ChartMetadata(title: "US vs NON US", titleFont: .headline, titleColour: .black) let barStyle = BarStyle(barWidth: 0.95, colourFrom: .barStyle)
Before 2.6.4 everything is alright
Please see : https://guides.github.com/features/mastering-markdown/#GitHub-flavored-markdown for how to format code when you post it.
Please post all of the GroupedBarChartData
.
var finalData:GroupedBarChartData = data()
GroupedBarChart(chartData: finalData, groupSpacing: 25)
.touchOverlay(chartData: finalData)
.xAxisGrid(chartData: finalData)
.yAxisGrid(chartData: finalData)
.xAxisLabels(chartData: finalData)
.yAxisLabels(chartData: finalData)
.infoBox(chartData: finalData)
.floatingInfoBox(chartData: finalData)
.headerBox(chartData: finalData)
.legends(chartData: finalData)
static func data() -> GroupedBarChartData {
let data = GroupedBarDataSets(dataSets: [
GroupedBarDataSet(dataPoints: [
GroupedBarDataPoint(value: 20, description: "Q1", group: GroupingData(title: "A", colour:
ColourStyle(colour: .red))),
GroupedBarDataPoint(value: 40, description: "Q2", group: GroupingData(title: "A", colour:
ColourStyle(colour: .red)))],
setTitle: "Hello")
])
let group = [GroupingData(title: "A", colour: ColourStyle(colour: .red)),
GroupingData(title: "B", colour: ColourStyle(colour: .blue)),
GroupingData(title: "C", colour: ColourStyle(colour: .green))]
return GroupedBarChartData(dataSets: data, groups: group)
}
Edited to format the code properly. - Will
GroupedBarChartData(dataSets: data, groups: groups, chartStyle: BarChartStyle(yAxisNumberOfLabels: 3))
It's work thank you so much
Hi willdale , can you check the xAxislabels from GroupedBarChart ? In my app xAxis making bug like floating on the middle