SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

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.