|
How to scale images in a chart? |
Posted by Eva on Sep-04-2012 23:50 |
|
Hi Peter,
I need to add png images to may gantt chart that need to be scaled to a smaller size. I was thinking to use setDataSymbol2(imageFilename) method on a dataSet, but this method doesn?t supply the size. How can this be done without editing the images itself?
I need to add the images to the chart and the legend.
(I use Java)
Thank you,
Eva |
Re: How to scale images in a chart? |
Posted by Peter Kwan on Sep-05-2012 11:26 |
|
Hi Eva,
You may try to use a DrawArea object to dynamically generate the resized symbol, then use the DrawArea object as symbol. It is like:
DrawArea d = new DrawArea();
//if you need to set search path for the file, you would need to call d.setSearchPath first
d.loadPNG(imageFilename);
d.resize(32, 32);
myDataSet.setDataSymbol3(d);
Hope this can help.
Regards
Peter Kwan |
Re: How to scale images in a chart? |
Posted by Eva on Sep-06-2012 02:38 |
|
Thank you Peter for your response.
I have been trying to test your suggestion, but I?m having a little problem:
The loadPNG(imageFilename) returns false.
I already use a call in my app to set the path as:
chart.setSearchPath3(servletContext);
And I seem to get an image a proper image to be displayed on my title using ?<*img=? + imageFilename.
Just for testing I use even the same imageFilename.
So, I defined a draw area as follows:
DrawArea d = new DrawArea();
boolean result = d.loadPNG(imageFilename);
I get the result= false. I assume I need a true value before I continue.
Please advise,
Eva |
Re: How to scale images in a chart? |
Posted by Peter Kwan on Sep-06-2012 16:27 |
|
Hi Eva,
The chart.setSearchPath only applies to the chart object, not to the DrawArea object (which is a separate object not derived from the chart). So you would need to d.setSearchPath:
DrawArea d = new DrawArea();
d.setSearchPath3(servletContext);
boolean result = d.loadPNG(imageFilename);
Please let me know if this can solve the problem.
Regards
Peter Kwan |
Re: How to scale images in a chart? |
Posted by Eva on Sep-06-2012 23:23 |
|
Thank you, Peter. This worked!
FYI ? Earlier I did try setting a path with the d.setSearchPath(url) (but not with d.setSearchPath3(servletContext)), since I didn?t have the ServletContext available anymore.
I tested the ?url + imageFilename? string, and the image was easily retrieved when put in the IE url.
Thanks again! Great support as always!
Eva |
|