Pre loader

Tooltip with rounded corners

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

Hello,
is it possible to modify the corner radius of tooltips in SciChart Android?

Version
2.0.0.1884
  • You must to post comments
0
0

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

  • You must to post comments
0
0

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

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies