ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Background Image Auto Stretching
Posted by Robert on Jun-06-2012 08:05
Hi,

I have a chart which user can resize and change background image. The problem is that I
cannot get the background image to stretch and automatically fit the size of the chart.

I have looked at both BaseChart.setBgImage and BaseChart.setWallpaper functions. But
none of them seems to have the option to do so.

Am I missing something or is this not supported by ChartDirector?

Regards

Robert

  Re: Background Image Auto Stretching
Posted by Peter Kwan on Jun-07-2012 00:47
Hi Robert,

Instead of using setWallpaper, you may use CDML to add an image anywhere you like in the chart background, and resize it to any size you like. For your case, the code may look like (in C#/Java):

c.addText(0, 0, "<*img=/path/to/background.png,width=" + c.getWidth() + ",height=" + c.getHeight() + "*>").setZOrder(Chart.ChartBackZ);

Hope this can help.

Regards
Peter Kwan

  Re: Background Image Auto Stretching
Posted by Robert on Jun-07-2012 05:42
That works perfectly.
Thanks a lot!

  Re: Background Image Auto Stretching
Posted by Robert on Jun-07-2012 05:47
It will be even better if the BaseChart.setBgImage function can have an extra alignment
option for auto fit. Just a suggestion :-)