Hi,
I’m trying to convert Java code to swift and I need the AnnotationLabel’s setAxisLabelStyle equivalent.
AnnotationLabel annotationLabel = new AnnotationLabel(getContext());
annotationLabel.setLabelPlacement(LabelPlacement.Axis);
annotationLabel.setAxisLabelStyle(new Action1<AnnotationLabel>()
{
@Override
public void execute(AnnotationLabel annotationLabel)
{
annotationLabel.setFontStyle(new FontStyle(37.0f, Color.BLUE));
annotationLabel.setBackgroundResource(R.drawable.current_price);
}
});
How can i apply this code in swift?
- Emre Gökberk asked 4 years ago
- You must login to post comments
Hi,
We can add drawable resource to annotationlabel on android.
But how can we add a background image to annotationlabel in swift? There is no customView property?
- Emre Gökberk answered 4 years ago
- You must login to post comments
Hi, there.
If I understand your issue correctly in Swift you can create SCIAnnotationLabel and then set fontStyle and backgroundBrush properties like this:
let annotationLabel = SCIAnnotationLabel()
annotationLabel.fontStyle = SCIFontStyle(fontSize: 22, andTextColor: .black)
annotationLabel.backgroundBrush = SCISolidBrushStyle(color: .blue)
Please see the iOS Chart Annotations are Easy! example and Annotations APIs as a reference.
Let us know if that helped.
- Andriy P answered 4 years ago
- You must login to post comments
Please login first to submit.