Re: Java question..
Re: Java question..
- Subject: Re: Java question..
- From: James Cicenia <email@hidden>
- Date: Wed, 9 Jun 2004 18:04:09 -0500
unfortunately, ChartUtilities.writeImageMap needs a PrintWriter
-James
On Jun 9, 2004, at 5:50 PM, Jonathan 'Wolf' Rentzsch wrote:
James Cicenia, email@hidden, wrote:
I am using jfreeChart for my charts... great api... however, I am
trying to do
a clickable graphic.
Here is the sample code:
final File file1 = new File("piechart100.png");
ChartUtilities.saveChartAsPNG(file1, chart, 600, 400,
info);
// write an HTML page incorporating the image with an
image
map
final File file2 = new File("piechart100.html");
final OutputStream out = new BufferedOutputStream(new
FileOutputStream(file2));
final PrintWriter writer = new PrintWriter(out);
writer.println("<HTML>");
writer.println("<HEAD><TITLE>JFreeChart Image Map Demo
2</TITLE></HEAD>");
writer.println("<BODY>");
ChartUtilities.writeImageMap(writer, "chart", info);
writer.println("<IMG SRC=\"piechart100.png\" "
+ "WIDTH=\"600\" HEIGHT=\"400\"
BORDER=\"0\"
USEMAP=\"#chart\">");
writer.println("</BODY>");
writer.println("</HTML>");
My question is how do I do the writeImageMap so that it will instead
of
being written to
a file it will write to ??? NSData???
How about substituting the BufferedOutputStream with an
ByteArrayOutputStream? Then, after calling
ChartUtilities.writeImageMap(), call
ByteArrayOutputStream.toByteArray().
Getting to an NSData is as easy as `new NSData(
ByteArrayOutputStream.toByteArray() )`.
| Jonathan 'Wolf' Rentzsch http://rentzsch.com
| Red Shed Software http://redshed.net
| "better" necessarily means "different"
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.