in

Software FX Community

Discuss and find help for all Software FX products.

Newbie Question To Using Templates in 6.5

Last post 12-12-2007 1:25 PM by Java1Guy. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 10-03-2007 1:02 PM

    Newbie Question To Using Templates in 6.5

    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 exception
    java.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 

    Filed under:
  • 10-03-2007 4:36 PM In reply to

    • GabrielA
    • Top 25 Contributor
    • Joined on 02-22-2007
    • Boca Raton, FL

    Re: Newbie Question To Using Templates in 6.5

    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 

     

    Filed under: ,
  • 10-03-2007 5:50 PM In reply to

    Re: Newbie Question To Using Templates in 6.5

    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?

  • 10-04-2007 10:19 AM In reply to

    • GabrielA
    • Top 25 Contributor
    • Joined on 02-22-2007
    • Boca Raton, FL

    Re: Newbie Question To Using Templates in 6.5

    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:


    Filed under: ,
  • 10-04-2007 11:17 AM In reply to

    Re: Newbie Question To Using Templates in 6.5

    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

  • 10-04-2007 12:20 PM In reply to

    • GabrielA
    • Top 25 Contributor
    • Joined on 02-22-2007
    • Boca Raton, FL

    Re: Newbie Question To Using Templates in 6.5

    Thanks for the info. Let me do some testing in the Mac and I'll get back to you. 

    Filed under: , ,
  • 10-04-2007 2:29 PM In reply to

    Re: Newbie Question To Using Templates in 6.5

    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? 

  • 10-05-2007 10:17 AM In reply to

    • GabrielA
    • Top 25 Contributor
    • Joined on 02-22-2007
    • Boca Raton, FL

    Re: Newbie Question To Using Templates in 6.5

    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.

    Filed under: , ,
  • 10-09-2007 10:32 AM In reply to

    • GabrielA
    • Top 25 Contributor
    • Joined on 02-22-2007
    • Boca Raton, FL

    Re: Newbie Question To Using Templates in 6.5

    Answer

    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.

    Filed under: ,
  • 12-12-2007 1:25 PM In reply to

    Re: Newbie Question To Using Templates in 6.5

     Just curious if there's any news on this -- I'm having exactly the same problem...

     Thanks,

    Mark
     

    Filed under: , ,
Page 1 of 1 (10 items)
Copyright 2008 Software FX, Inc.