Class ChartGraphicFactory

  • All Implemented Interfaces:
    ExternalGraphicFactory

    public class ChartGraphicFactory
    extends Object
    implements ExternalGraphicFactory
    Parses Google charts like requests into various kinds of charts.

    Underlying implementation is based on Eastwood charts and JFreeChart

    And example of a valid symbolizer use in SLD is:

     <ExternalGraphic>
       <OnlineResource xlink:href="http://chart?cht=p&amp;chl=male|female&amp;chd=t:${100 * male / (male + female)},${100 * female / (male + female)}&amp;chs=200x100&amp;chf=bg,s,FFFFFF00"/>
       <Format>application/chart</Format>
     </ExternalGraphic>
     
    This request will generate a pie chart representing the percentages of female and male population using attribute features and CQL expression to buid the percentage value to be used.

    For details on the URL format documentation refer to the online Google charts API.

    Also mind Eastwood does not implement all of the Google charts API, for example, Venn diagram and spider diagrams are not supported. Check on the Eastwood project pages for details.

    Since:
    2.5.6
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String FORMAT  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Icon getIcon​(Feature feature, Expression urlExpression, String format, int size)
      Turns the specified URL into an Icon, eventually using the Feature attributes to evaluate CQL expressions embedded in the url.
      The size parameter defines the size of the image (so that vector based symbols can be drawn at the specified size directly), or may be zero or negative if the size was not specified (in that case the "natural" size of the image will be used, which is the size in pixels for raster images, and 16 for any format that does not have a specific size, according to the SLD spec).
      null will be returned if this factory cannot handle the provided url.
    • Constructor Detail

      • ChartGraphicFactory

        public ChartGraphicFactory()
    • Method Detail

      • getIcon

        public Icon getIcon​(Feature feature,
                            Expression urlExpression,
                            String format,
                            int size)
                     throws Exception
        Description copied from interface: ExternalGraphicFactory
        Turns the specified URL into an Icon, eventually using the Feature attributes to evaluate CQL expressions embedded in the url.
        The size parameter defines the size of the image (so that vector based symbols can be drawn at the specified size directly), or may be zero or negative if the size was not specified (in that case the "natural" size of the image will be used, which is the size in pixels for raster images, and 16 for any format that does not have a specific size, according to the SLD spec).
        null will be returned if this factory cannot handle the provided url.
        Specified by:
        getIcon in interface ExternalGraphicFactory
        Throws:
        Exception