Hello,
is it possible to modify the corner radius of tooltips in SciChart Android?
- Anna Lazar asked 6 years ago
- last edited 2 years ago
- You must login to post comments
Hi Anna,
Yes, it is possible but it requires some code customization.
First of all I would suggest you to take a look on our example which shows how to customize tooltips. i would suggest to take a look on on FirstCustomXySeriesTooltip/SecondCustomXySeriesTooltip classes which represent tooltip View ( by default tooltip in SciChart Android use TextView as a base class so you have access to all its methods and properties ).
To provide round corners you just need to create a drawable resource with rounded corners and set it as background for tooltip:
protected void internalUpdate(XySeriesInfo seriesInfo) {
final SpannableStringBuilder sb = new SpannableStringBuilder();
sb.append(MODIFIER_NAME).append(StringUtil.NEW_LINE);
if (seriesInfo.seriesName != null) {
sb.append(seriesInfo.seriesName).append(StringUtil.NEW_LINE);
}
sb.append("X: ").append(seriesInfo.getFormattedXValue());
sb.append(" Y: ").append(seriesInfo.getFormattedYValue());
setText(sb);
setBackgroundResource(R.drawable.backgroundWithCornersDrawable); // set drawable with corners
setTooltipTextColor(ColorUtil.White);
}
Hope this will help you!
Best regards,
Yura
- Yura Khariton answered 6 years ago
- You must login to post comments
Hi Anna,
Yes, it is possible but it requires some code customization.
First of all I would suggest you to take a look on our example which shows how to customize tooltips. i would suggest to take a look on on FirstCustomXySeriesTooltip/SecondCustomXySeriesTooltip classes which represent tooltip View ( by default tooltip in SciChart Android use TextView as a base class so you have access to all its methods and properties ).
To provide round corners you just need to create a drawable resource with rounded corners and set it as background for tooltip:
protected void internalUpdate(XySeriesInfo seriesInfo) {
final SpannableStringBuilder sb = new SpannableStringBuilder();
sb.append(MODIFIER_NAME).append(StringUtil.NEW_LINE);
if (seriesInfo.seriesName != null) {
sb.append(seriesInfo.seriesName).append(StringUtil.NEW_LINE);
}
sb.append("X: ").append(seriesInfo.getFormattedXValue());
sb.append(" Y: ").append(seriesInfo.getFormattedYValue());
setText(sb);
setBackgroundResource(R.drawable.backgroundWithCornersDrawable); // set drawable with corners
setTooltipTextColor(ColorUtil.White);
}
Hope this will help you!
Best regards,
Yura
- Yura Khariton answered 6 years ago
- You must login to post comments
Please login first to submit.