You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I have the following HorizontalBarChart :
Everything works fine, my only problem is when I have only one bar:
Any idea of how to get rid of these 2 limit-labels?
Thank you very much!
The text was updated successfully, but these errors were encountered:
Probably not the best way to do it, but it works:
Actually, xAxis.entryCount (used to draw the labels) is set to 3 when xAxis.labelCount equals 1, so basically I've overloaded the drawLabels() function of my XAxisRenderer and added the following condition to draw the labels : xAxis.entryCount == xAxis.labelCount || i == 1, so that indexes 0 and 2 are not drawn when there is only one bar. Here is the concerned part of the function:
if viewPortHandler.isInBoundsY(position.y) {
if let label = xAxis.valueFormatter?.stringForValue(xAxis.entries[i], axis: xAxis) {
if xAxis.entryCount == xAxis.labelCount || i == 1 {
drawLabel(
context: context,
formattedLabel: label,
x: pos,
y: position.y,
attributes: [NSFontAttributeName: labelFont, NSForegroundColorAttributeName: labelTextColor],
anchor: anchor,
angleRadians: 0)
}
}
}
}
Hi, I have the following HorizontalBarChart :
Everything works fine, my only problem is when I have only one bar:
Any idea of how to get rid of these 2 limit-labels?
Thank you very much!
The text was updated successfully, but these errors were encountered: