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

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.

Answered
1
2

Hi all,

I would like to ask how to modify the label of the OHLC Chart in Android.
For example, in the attached screenshot, how to change the label “Highest” to “High” ? Thanks.

Version
1.2.1
Images
  • You must to post comments
Best Answer
2
1

Hi Ray,

To achieve that you need to create custom SeriesInfoProvider, override getSeriesTooltipInternal method and return
Custom tooltip inside in it. Please take a look at our documentation below:

https://www.scichart.com/documentation/android/v1.x/webframe.html#Common%20Features%20and%20Tooltip%20Customization.html

Please take a look at the custom series info provider and custom tooltip code below, which demonstrates how to do that:

private static class CustomOhlcSeriesInfoProvider extends DefaultOhlcSeriesInfoProvider {
    @Override
    protected ISeriesTooltip getSeriesTooltipInternal(Context context, OhlcSeriesInfo seriesInfo) {
        return new CustomOhlcSeriesTooltip(context, seriesInfo);
    }

    private static class CustomOhlcSeriesTooltip extends OhlcSeriesTooltip {
        public CustomOhlcSeriesTooltip(Context context, OhlcSeriesInfo seriesInfo) {
            super(context, seriesInfo);
        }

        @Override
        protected boolean internalUpdate(OhlcSeriesInfo seriesInfo) {
            final StringBuilder sb = new StringBuilder();
            sb.append(String.format("Open CHANGED: %s", seriesInfo.getFormattedOpenValue()));
            sb.append(StringUtil.NEW_LINE);
            sb.append(String.format("High CHANGED: %s", seriesInfo.getFormattedHighValue()));
            sb.append(StringUtil.NEW_LINE);
            sb.append(String.format("Low CHANGED: %s", seriesInfo.getFormattedLowValue()));
            sb.append(StringUtil.NEW_LINE);
            sb.append(String.format("Close CHANGED: %s", seriesInfo.getFormattedCloseValue()));

            setText(sb.toString());
            setSeriesColor(0xFFBBAAAC);

            return true;
        }
    }
}

all you need to do, is to set SeriesInfoProvider to your OHLC series like so:

  candlestickRenderableSeries.setSeriesInfoProvider(new CustomOhlcSeriesInfoProvider());

Hope this helps.
Best regards.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.