jkirby Posted October 3, 2007 Report Share Posted October 3, 2007 OK .. I have built a horizontal gauge with designer (Community Edition) and call it via JSP: <%com.softwarefx.chartfx.gauge.HorizontalGauge.initWeb(pageContext,request,response);com.softwarefx.chartfx.gauge.HorizontalGauge gauge = new com.softwarefx.chartfx.gauge.HorizontalGauge();gauge.importGauge(com.softwarefx.chartfx.gauge.FileFormat.XML, application.getRealPath("smallChart.hgfx"));gauge.renderToStream();%> smallChart.hgfx is located in my context root. First I get this error message in my Glassfish server log: StandardWrapperValve[jsp]: PWC1406: Servlet.service() for servlet jsp threw exceptionjava.lang.IllegalStateException: PWC3991: getOutputStream() has already been called for this response at org.apache.coyote.tomcat5.CoyoteResponse.getWriter(CoyoteResponse.java:700) at org.apache.coyote.tomcat5.CoyoteResponseFacade.getWriter(CoyoteResponseFacade.java:210) at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:135) Here is my template: <?xml version="1.0" encoding="UTF-8"?><HorizontalGauge> <WIDTH>300</WIDTH> <HEIGHT>113</HEIGHT> <BORDER> <VISIBLE>true</VISIBLE> <COLOR>#ff003333</COLOR> <GLARE>false</GLARE> <STYLE>LinearBorder03</STYLE> </BORDER> <INNERGAUGES> <ITEM type="ChartFX.WebForms.Gauge.InnerDigitalPanel"> <LAYOUT> <ALIGNMENT>BottomCenter</ALIGNMENT> <ANCHORPOINT> <X>0.75</X> <Y>1.1</Y> </ANCHORPOINT> <TARGET>AnchorPoint</TARGET> </LAYOUT> <INNERGAUGE> <BORDER> <VISIBLE>false</VISIBLE> </BORDER> <APPEARANCE> <COLOR>#ffff0000</COLOR> <LAYOUT> <ALIGNMENT>BottomCenter</ALIGNMENT> <ANCHORPOINT> <Y>0.37</Y> </ANCHORPOINT> <TARGET>AnchorPoint</TARGET> </LAYOUT> <SIZE>0.25</SIZE> <STYLE>FourteenSegments01</STYLE> </APPEARANCE> <VALUE>50.0</VALUE> </INNERGAUGE> <LINKTOMAINVALUE>true</LINKTOMAINVALUE> <SIZE> <WIDTH>0.5</WIDTH> <HEIGHT>0.5</HEIGHT> </SIZE> </ITEM> </INNERGAUGES> <TITLES> <ITEM> <LAYOUT> <ALIGNMENT>TopCenter</ALIGNMENT> <ANCHORPOINT> <X>0.5</X> <Y>0.03</Y> </ANCHORPOINT> <TARGET>AnchorPoint</TARGET> </LAYOUT> <VERTICALPOSITION>AboveIndicators</VERTICALPOSITION> <FONT type="ChartFX.WebForms.Gauge.GaugeFont"> <FAMILYNAME>SansSerif</FAMILYNAME> <FONTSTYLE>Bold</FONTSTYLE> </FONT> <TEXT>CPU</TEXT> </ITEM> </TITLES> <SCALES> <ITEM> <INDEX>0</INDEX> <INDICATORS> <ITEM type="ChartFX.WebForms.Gauge.Filler"> <COLOR>#ff006600</COLOR> <INDEX>0</INDEX> <FORMAT> <FORMATTYPE>Percentage</FORMATTYPE> </FORMAT> <STYLE>Repeater01</STYLE> </ITEM> </INDICATORS> </ITEM> </SCALES></HorizontalGauge> How can I get this to go away? I also get this error running the example Combination.jsp but that gauge does appear. So my main question is can I define the complete L&F/behavior in the template then just render it to a stream? A good code example would be useful :-) regards, .j Quote Link to comment Share on other sites More sharing options...
GabrielA Posted October 3, 2007 Report Share Posted October 3, 2007 The exception is not related to the template. Some server are really picky about the handling of the output stream, and I guess GlassFish is one of them. When you call renderToStream, Chart FX gets the output stream to push the image, but If you have blank line at the end JSP file for example, the compiled JSP will try to output that blank line to the output stream as well, and since ChartFX took it, you get the exception. Some serves will just throw a warning, but you'll get the image. There are 2 things to try: 1) remove all extra lines and characters, ie: <%com.softwarefx.chartfx.gauge.HorizontalGauge.initWeb(pageContext,request,response); com.softwarefx.chartfx.gauge.HorizontalGauge gauge = new com.softwarefx.chartfx.gauge.HorizontalGauge(); gauge.importGauge(com.softwarefx.chartfx.gauge.FileFormat.XML, application.getRealPath("smallChart.hgfx")); gauge.renderToStream();%> Be sure the file ends at %>, or 2) Call gauge.renderToControl(), which will create a image in the temp folder and will return the image tag to the browser. I'll take a look to the samples on Glasfish, and I'll adjust them accordingly Quote Link to comment Share on other sites More sharing options...
jkirby Posted October 3, 2007 Author Report Share Posted October 3, 2007 Thanks ... The space trick worked on the template but still throws outstream() exception. My other question is on the demos (and my code) the ticker labels (e.g number > two digits) get "super-imposed" on each other. The same affect happens with title text. How does one get the labels to display properly? Quote Link to comment Share on other sites More sharing options...
GabrielA Posted October 4, 2007 Report Share Posted October 4, 2007 Can you post an image showing the issue? Please tell me a little bit more about your setup: OS, Java version, etc. I'm trying your example and this is what I get: Quote Link to comment Share on other sites More sharing options...
jkirby Posted October 4, 2007 Author Report Share Posted October 4, 2007 I removed the title but the tickers are being overlayed if the value is > 1 in length I'm on Mac OSX (10.4.10) JDK 1.5 on FireFox 2.x Quote Link to comment Share on other sites More sharing options...
GabrielA Posted October 4, 2007 Report Share Posted October 4, 2007 Thanks for the info. Let me do some testing in the Mac and I'll get back to you. Quote Link to comment Share on other sites More sharing options...
jkirby Posted October 4, 2007 Author Report Share Posted October 4, 2007 This is definitely a Mac issue because I moved it (same gauge) to a Solaris 10 (x86) on Glassfish and the rendering is fine. Probably a Mac JDK issue? Quote Link to comment Share on other sites More sharing options...
GabrielA Posted October 5, 2007 Report Share Posted October 5, 2007 Yes, it is definetively a Mac JDK issue, we are working on it right now. I'll let you know as soon as i have more info. Quote Link to comment Share on other sites More sharing options...
GabrielA Posted October 9, 2007 Report Share Posted October 9, 2007 Hi, we were able to identify the issue. It is a specific issue in the Mac JDK with fractional size fonts (Radar #4402021) which was fixed in the lastest update, but still seems to be present when the font size in less than 1. Chart FX Gauges for Java internally uses size from 0 to 1 for font scalling, and this causing the failure. The developer team is looking for a work around, hopefully they will have something for the end of this week or next week. I'll will keep you informed. Quote Link to comment Share on other sites More sharing options...
Java1Guy Posted December 12, 2007 Report Share Posted December 12, 2007 Just curious if there's any news on this -- I'm having exactly the same problem... Thanks, Mark Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.