Pre loader

How to put a background image on a chart in scichart android?

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

1
0

Is it possible to put a background image on a chart? I hope you can give me a hint thanks in advance.

I attach an image for the purpose of my query.

Version
V1 Sdk
Images
  • You must to post comments
1
0

Hi Julio,

You can use our ThemeManager API and create you custom theme for chart. We have an example which shows how to do this.
You can use one of existing themes as parent theme and override only required values.

Or you just can set background for entire chart ( including area which is used for axes) by simple calling setBackground()/setBackgroundResource() on chart instance:

 surface.setBackgroundResource(R.drawable.background);

If you need to set background only for area where renderable series are drawn ( exclude area for axes ) you can call setBackground()/setBackgroundResource() for renderable series area:

// get view for renderable series area and set background for it
surface.getRenderableSeriesArea().getView().setBackgroundResource(R.drawable.background);

Is this suitable for your needs?

Best regards,
Yura

  • Julio Olivos
    Thanks for the quick response, with “surface.setBackgroundResource (R.drawable.background);” This is all ok, but with “surface.getRenderableSeriesArea () .getView () .setBackgroundResource (R.drawable.background);” The image is superimposed on the series, so only the image is visible. What could you do in this case?
  • Yura Khariton
    I think this could be caused by our default render surface implementation which uses GLSurfaceView as a base class. It has some problem with drawing when it overlaps with other Android Views. Can you try to set another IRenderSurface implementation for your chart? For example RenderSurface or GLTextureView. You just need to call setRenderSurface on chart instance – chart.setRenderSurface(new RenderSurface(context)). I think this should help.
  • You must to post comments
0
0

Hi Julio,

There is an alternative solution for setting renderable series area background which I completely forgot about. SciChartSurface has a bunch of properties which should do the trick – setRenderableSeriesAreaFillStyle and setRenderableSeriesAreaBorderStyle. They should work with default render surface implementation:

surface.setRenderableSeriesAreaFillStyle(new TextureBrushStyle(background));

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