Add background image to charts
Set the background of charts to an image
Open the script editor for a widget, and copy in the following code:
widget.on('render', function(sender,event){ // URL to the background Image var imageLink = 'http://siliconangle.com/files/2014/12/BlackWhite-Logo.jpg' // Set the chart background as the image sender.queryResult.chart.plotBackgroundImage = imageLink; })
Change the imageLink variable to the path of your image, and hit save. Reload the web page and you should see an image as the background of your widget.
This functionality works only with the following chart types: scatter, pie, column, bar, line, area, & polar
-
While there is no standard setting that lets you choose between stretched or centered you can use the below renderer
to add an html element on the chart, and within that you would specify the size and location of your image.
-
Hi,
I'm using this and love it! - Now I want the image to depend on the filter that I'm using.
I do have all image URL's stored in the EC - but I haven't found a way yet to use the URL from the EC (based on a widget filter) instead of the fixed script URL.
Does anyone have an idea how I can achieve this?
-
Hi Jordy,
Have a look on this, maybe it could help you:
-
Thanks again for your tip Cleberson - we found a way!
We now however struggle with the same as what Tyler Shaw struggledwith:
- Image export returns an empty image - not even data
- PDF export shows the image in the preview but not in the actual PDF.
Does anyone have a solution for this?
Please sign in to leave a comment.
Comments
10 comments