Pre loader

Screenshot problem

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

Answered Closed
1
0

Hello, we are developing a finance application that contains sciChart. Our main chart and optionally RSI, MACD etc. There are indicators. I want the user to screenshot and share the graph and the indicators, but I’m having trouble doing this. Although I tried more than one way for this, I encountered different problems in all of them.
First of all, I take a screenshot with the createBitmap and Canvas method of the Layout where my graphics are located, but the graphic contents are not visible in the screenshot content.
As the second method, I tried the exportToBitmap method in sciChart, but here I only take a screenshot of 1 chart, I cannot take a screenshot of a graph + RSI + MACD at the same time. As another problem, the opening, closing, high, etc. of the parity on the chart. The texts containing the data are not visible in the screenshot.

Below I will share the screenshots I took with both the first method and the second method, the image on the phone at that moment, and the codes I used.
What I wanted to use was to take a screenshot of more than one graph and the data on it at the same time as in the first method. How can I do that?

Method 1

Bitmap bitmap = Bitmap.createBitmap(view.getWidth(),
            view.getHeight(), Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    view.draw(canvas);

Method 2

surface.exportToBitmap()
Version
4.4.0.4739
Images
  • You must to post comments
Best Answer
1
0

Hi Devrim

You’re using the right approach for screenshotting a single surface, but you may get a blank screen with this method if you try to export a parent ViewGroup.

Here’s an excerpt from our Android Chart Documentation:

Export ViewGroup which contains ScichartSurface

By default SciChartSurface can be used with different IRenderSurface
implementations. Some of them (e.g. RenderSurfaceGL which uses OpenGL
for rendering of its content) won’t be visible when you call draw() on
parent ViewGroup. So if you need to export ViewGroup which contains
SciChartSurface then you need to switch to Canvas based RenderSurface
before export:

 // Assume a surface has been created and configured somewhere
   surface.setRenderSurface(new RenderSurface(getContext()));
  

Try this approach in combination with ViewGroup.draw()

Don’t forget to set the RenderSurface back to the OpenGL renderer after calling viewGroup.draw() using code like this:

surface.setRenderSurface(new GLTextureView(getContext()));

More info can be found in our Renderer Plugins and Screenshot Export documentation pages.

Best regards
Andrew

  • You must to post comments
1
0

Hi Andrew,

Thank you very much for your answer. I did not pay attention to the relevant title in the documents. The piece of code you posted solved my problem.

Good work

  • You must to post comments
Showing 2 results

Try SciChart Today

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

Start TrialCase Studies