## com.fusioncharts
Class FusionChartsHelper

    java.lang.Object
      com.fusioncharts.FusionChartsHelper

    public class FusionChartsHelper

extends java.lang.Object

Contains methods to add no cache string to a url,getting colors for the charts.
This class can be used to create chart xml given the swf filename and other
parameters.
In order to use this class in your jsps,import this class and
call the appropriate method directly as follows:
FusionChartsHelper.addCacheToDataURL(...);
In order to use this class for colors call the method as shown:
FusionChartsHelper helper = new FusionChartsHelper();
String bgColor = helper.getFCColor();

Author:
  InfoSoft Global (P) Ltd.

Field Summary
`(package private) java.lang.String[]` `arr_FCColors`
`(package private) int` `FC_ColorCounter`
`protected java.lang.String` `UTFBOMString`

Constructor Summary
`FusionChartsHelper()`

Method Summary
`static java.lang.String` `addCacheToDataURL(java.lang.String strDataURL)` Adds additional string to the url to and encodes the parameters, so as to disable caching of data.
`static int` `boolToNum(java.lang.Boolean bool)` Converts a Boolean value to int value
`static java.lang.String` `createChart(java.lang.String chartSWF, java.lang.String strURL, java.lang.String strXML, java.lang.String chartId, int chartWidth, int chartHeight, boolean debugMode, boolean registerWithJS)` Deprecated.
`static java.lang.String` `createChart(java.lang.String chartSWF, java.lang.String strURL, java.lang.String strData, java.lang.String dataFormat, java.lang.String chartId, java.lang.String chartWidth, java.lang.String chartHeight, boolean debugMode, boolean registerWithJS)` New method to handle all data formats supported by FusionCharts JS API version >= 3.2.

`static java.lang.String`

`createChart(java.lang.String chartSWF, java.lang.String strURL, java.lang.String strData, java.lang.String dataFormat, java.lang.String chartId, java.lang.String chartWidth, java.lang.String chartHeight, boolean debugMode, boolean registerWithJS, java.lang.String bgColor, java.lang.String scaleMode, java.lang.String lang, java.lang.String detectFlashVersion, java.lang.String autoInstallRedirect, java.lang.String windowMode)`
New method to handle 1.

`static java.lang.String` `createChartHTML(java.lang.String chartSWF, java.lang.String strURL, java.lang.String strXML, java.lang.String chartId, java.lang.String chartWidth, java.lang.String chartHeight, boolean debugMode)` Creates the object tag required to embed a chart.

`static java.lang.String`

`createChartHTML(java.lang.String chartSWF, java.lang.String strURL, java.lang.String strXML, java.lang.String chartId, java.lang.String chartWidth, java.lang.String chartHeight, boolean debugMode, java.lang.String bgColor, java.lang.String scaleMode, java.lang.String lang, java.lang.String windowMode)`
Handles all the parameters including bgColor, scaleMode, lang and wmode Creates the object tag required to embed a chart.

`static java.lang.String` `createChartWithJSON(java.lang.String chartSWF, java.lang.String strURL, java.lang.String strData, java.lang.String chartId, java.lang.String chartWidth, java.lang.String chartHeight, boolean debugMode, boolean registerWithJS)`

`static java.lang.String`

`createChartWithJSON(java.lang.String chartSWF, java.lang.String strURL, java.lang.String strData, java.lang.String chartId, java.lang.String chartWidth, java.lang.String chartHeight, boolean debugMode, boolean registerWithJS, java.lang.String bgColor, java.lang.String scaleMode, java.lang.String lang, java.lang.String detectFlashVersion, java.lang.String autoInstallRedirect, java.lang.String windowMode)`

`static java.lang.String` `createChartWithXML(java.lang.String chartSWF, java.lang.String strURL, java.lang.String strData, java.lang.String chartId, java.lang.String chartWidth, java.lang.String chartHeight, boolean debugMode, boolean registerWithJS)`

`static java.lang.String`

`createChartWithXML(java.lang.String chartSWF, java.lang.String strURL, java.lang.String strData, java.lang.String chartId, java.lang.String chartWidth, java.lang.String chartHeight, boolean debugMode, boolean registerWithJS, java.lang.String bgColor, java.lang.String scaleMode, java.lang.String lang, java.lang.String detectFlashVersion, java.lang.String autoInstallRedirect, java.lang.String windowMode)`

`static java.lang.String` `encodeDataURL(java.lang.String strDataURL, boolean addNoCacheStr)` Encodes the dataURL before it's served to FusionCharts.
`java.lang.String` `getFCColor()` Returns a color from the array.
`static java.lang.String` `obtainUTFBOMAsString()` Returns UTF8 BOM as a string.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### FC_ColorCounter

    int FC_ColorCounter

### UTFBOMString

    protected java.lang.String UTFBOMString

### arr_FCColors

    java.lang.String[] arr_FCColors

Constructor Detail

### FusionChartsHelper

    public FusionChartsHelper()

Method Detail

### addCacheToDataURL

    public static java.lang.String addCacheToDataURL(java.lang.String strDataURL)

  Adds additional string to the url to and encodes the parameters,
  so as to disable caching of data.

  Parameters:
    `strDataURL` - - dataURL to be fed to chart
  Returns:
    cachedURL - URL with the additional string added

### boolToNum

    public static int boolToNum(java.lang.Boolean bool)

  Converts a Boolean value to int value

  Parameters:
    `bool` - Boolean value which needs to be converted to int value
  Returns:
    int value correspoding to the boolean : 1 for true and 0 for false

### createChart

    @Deprecated
    public static java.lang.String createChart(java.lang.String chartSWF,
                                                          java.lang.String strURL,
                                                          java.lang.String strXML,
                                                          java.lang.String chartId,
                                                          int chartWidth,
                                                          int chartHeight,
                                                          boolean debugMode,
                                                          boolean registerWithJS)

  Deprecated.

  Creates the JavaScript + HTML code required to embed a chart.
  Uses the javascript FusionCharts class to create the chart by supplying
  the required parameters to it.
  Note: Only one of the parameters strURL or strXML has to be not null for this
  method to work. If both the parameters are provided then strURL is used for further processing.

  Parameters:
    `chartSWF` - - SWF File Name (and Path) of the chart which you intend to plot
    `strURL` - - If you intend to use dataUrl method for this chart, pass the URL as this parameter. Else, set it to "" (in case of dataXML method)
    `strXML` - - If you intend to use dataXML method for this chart, pass the XML data as this parameter. Else, set it to "" (in case of dataURL method)
    `chartId` - - Id for the chart, using which it will be recognized in the HTML page. Each chart on the page needs to have a unique Id.
    `chartWidth` - - Intended width for the chart (in pixels)
    `chartHeight` - - Intended height for the chart (in pixels)
    `debugMode` - - Whether to start the chart in debug mode
    `registerWithJS` - - Whether to ask chart to register itself with JavaScript
  Returns:
    - String - Returns the html + javascript code for embedding the chart.

### createChart

    public static java.lang.String createChart(java.lang.String chartSWF,
                                               java.lang.String strURL,
                                               java.lang.String strData,
                                               java.lang.String dataFormat,
                                               java.lang.String chartId,
                                               java.lang.String chartWidth,
                                               java.lang.String chartHeight,
                                               boolean debugMode,
                                               boolean registerWithJS)

  New method to handle all data formats supported by FusionCharts JS API version >= 3.2. Uses the new format of FusionCharts constructor. Creates the JavaScript + HTML code required to embed a chart.
  Uses the javascript FusionCharts class to create the chart by supplying
  the required parameters to it.
  Note: Only one of the parameters strURL or strData has to be not null for this
  method to work. If both the parameters are provided then strURL is used for further processing.

  Parameters:
    `chartSWF` - - SWF File Name (and Path) of the chart which you intend to plot
    `strURL` - - If you intend to use dataURL method for this chart, pass the Url as this parameter. Else, set it to "" (in case of dataString method)
    `strData` - - If you intend to use dataString method for this chart, pass the XML/JSON data as this parameter. Else, set it to "" (in case of dataUrl method)
    `dataFormat` - - Format of the data provided.
    `chartId` - - Id for the chart, using which it will be recognized in the HTML page. Each chart on the page needs to have a unique Id.
    `chartWidth` - - Intended width for the chart (in pixels)
    `chartHeight` - - Intended height for the chart (in pixels)
    `debugMode` - - Whether to start the chart in debug mode
    `registerWithJS` - - Whether to ask chart to register itself with JavaScript
  Returns:
    - String - Returns the html + javascript code for embedding the chart.

### createChart

    public static java.lang.String createChart(java.lang.String chartSWF,
                                               java.lang.String strURL,
                                               java.lang.String strData,
                                               java.lang.String dataFormat,
                                               java.lang.String chartId,
                                               java.lang.String chartWidth,
                                               java.lang.String chartHeight,
                                               boolean debugMode,
                                               boolean registerWithJS,
                                               java.lang.String bgColor,
                                               java.lang.String scaleMode,
                                               java.lang.String lang,
                                               java.lang.String detectFlashVersion,
                                               java.lang.String autoInstallRedirect,
                                               java.lang.String windowMode)

  New method to handle 1. all data formats supported by FusionCharts JS API version >= 3.2 2. all parameters accepted by FusionCharts. Uses the new format of FusionCharts constructor. Creates the JavaScript + HTML code required to embed a chart.
  Uses the javascript FusionCharts class to create the chart by supplying
  the required parameters to it.
  Note: Only one of the parameters strURL or strData has to be not null for this
  method to work. If both the parameters are provided then strURL is used for further processing.

  Parameters:
    `chartSWF` - - SWF File Name (and Path) of the chart which you intend to plot
    `strURL` - - If you intend to use dataUrl method for this chart, pass the Url as value for this parameter. Else, set it to "" (in case of dataString method)
    `strData` -
    `dataFormat` -
    `chartId` - - Id for the chart, using which it will be recognized in the HTML page. Each chart on the page needs to have a unique Id.
    `chartWidth` - - Intended width for the chart (in pixels)
    `chartHeight` - - Intended height for the chart (in pixels)
    `debugMode` - - Whether to start the chart in debug mode
    `registerWithJS` - - Whether to ask chart to register itself with JavaScript
    `bgColor` - - Background color of the Flash movie (here chart) which comes below the chart and is visible if chart's background color is set to transparent or translucent using bgAlpha.
    `scaleMode` - - "noScale" - recommended/default, "exactFit" - scales the chart to fit the container exactly with width and height (causes distortion in some cases), "noBorder" - constrained scale. (not recommended at all), "showAll" - (not recommended)
    `lang` - - Language, as of now its only value is "EN" for english
    `detectFlashVersion` - - Checks the Flash Player version and if version is less than 8 and autoInstallRedirect is set on then asks the user to install Flash Player from Adobe site
    `autoInstallRedirect` - - If set on, the user would be redirected to Adobe site if Flash player 8 is not installed.
    `wMode` - - Can accept values: "window"/"opaque"/ "transparent".
  Returns:
    - String - Returns the html + javascript code for embedding the chart.

### createChartHTML

    public static java.lang.String createChartHTML(java.lang.String chartSWF,
                                                   java.lang.String strURL,
                                                   java.lang.String strXML,
                                                   java.lang.String chartId,
                                                   java.lang.String chartWidth,
                                                   java.lang.String chartHeight,
                                                   boolean debugMode)

  Creates the object tag required to embed a chart. Generates the object tag to embed the swf directly into the html page.
  Note: Only one of the parameters strURL or strXML has to be not null for this
  method to work. If both the parameters are provided then strURL is used for further processing.

  Parameters:
    `chartSWF` - - SWF File Name (and Path) of the chart which you intend to plot
    `strURL` - - If you intend to use dataUrl method for this chart, pass the URL as this parameter. Else, set it to "" (in case of dataString method)
    `strXML` - - If you intend to use dataXML method for this chart, pass the XML data as this parameter. Else, set it to "" (in case of dataURL method)
    `chartId` - - Id for the chart, using which it will be recognized in the HTML page. Each chart on the page needs to have a unique Id.
    `chartWidth` - - Intended width for the chart (in pixels)
    `chartHeight` - - Intended height for the chart (in pixels)
    `debugMode` - - Whether to start the chart in debug mode
  Returns:
    - String - Returns the html code for embedding the chart.

### createChartHTML

    public static java.lang.String createChartHTML(java.lang.String chartSWF,
                                                   java.lang.String strURL,
                                                   java.lang.String strXML,
                                                   java.lang.String chartId,
                                                   java.lang.String chartWidth,
                                                   java.lang.String chartHeight,
                                                   boolean debugMode,
                                                   java.lang.String bgColor,
                                                   java.lang.String scaleMode,
                                                   java.lang.String lang,
                                                   java.lang.String windowMode)

  Handles all the parameters including bgColor, scaleMode, lang and wmode Creates the object tag required to embed a chart. Generates the object tag to embed the swf directly into the html page.
  Note: Only one of the parameters strURL or strXML has to be not null for this
  method to work. If both the parameters are provided then strURL is used for further processing.

  Parameters:
    `chartSWF` - - SWF File Name (and Path) of the chart which you intend to plot
    `strURL` - - If you intend to use dataUrl method for this chart, pass the Url as value for this parameter. Else, set it to "" (in case of dataString method)
    `strXML` - - If you intend to use dataString method for this chart, pass the XML data as this parameter. Else, set it to "" (in case of dataURL method)
    `chartId` - - Id for the chart, using which it will be recognized in the HTML page. Each chart on the page needs to have a unique Id.
    `chartWidth` - - Intended width for the chart (in pixels)
    `chartHeight` - - Intended height for the chart (in pixels)
    `debugMode` - - Whether to start the chart in debug mode
    `bgColor` - - Background color of the Flash movie (here chart) which comes below the chart and is visible if chart's background color is set to transparent or translucent using bgAlpha.
    `scaleMode` - - "noScale" - recommended/default, "exactFit" - scales the chart to fit the container exactly with width and height (causes distortion in some cases), "noBorder" - constrained scale. (not recommended at all), "showAll" - (not recommended)
    `lang` - - Language, as of now its only value is "EN" for english
    `wMode` - - Can accept values: "window"/"opaque"/ "transparent".
  Returns:
    - String - Returns the html code for embedding the chart.

### createChartWithJSON

    public static java.lang.String createChartWithJSON(java.lang.String chartSWF,
                                                       java.lang.String strURL,
                                                       java.lang.String strData,
                                                       java.lang.String chartId,
                                                       java.lang.String chartWidth,
                                                       java.lang.String chartHeight,
                                                       boolean debugMode,
                                                       boolean registerWithJS)

  Parameters:
    `chartSWF` - - SWF File Name (and Path) of the chart which you intend to plot
    `strURL` - - If you intend to use dataUrl method for this chart, pass the Url to the JSON as value for this parameter. Else, set it to "" (in case of dataString method)
    `strData` - - If you intend to use dataString method for this chart, pass the JSON data as the value for this parameter. Else, set it to "" (in case of dataUrl method)
    `chartId` - - Id for the chart, using which it will be recognized in the HTML page. Each chart on the page needs to have a unique Id.
    `chartWidth` - - Intended width for the chart (in pixels)
    `chartHeight` - - Intended height for the chart (in pixels)
    `debugMode` - - Whether to start the chart in debug mode
    `registerWithJS` - - Whether to ask chart to register itself with JavaScript
  Returns:
    - String - Returns the html + javascript code for embedding the chart.

### createChartWithJSON

    public static java.lang.String createChartWithJSON(java.lang.String chartSWF,
                                                       java.lang.String strURL,
                                                       java.lang.String strData,
                                                       java.lang.String chartId,
                                                       java.lang.String chartWidth,
                                                       java.lang.String chartHeight,
                                                       boolean debugMode,
                                                       boolean registerWithJS,
                                                       java.lang.String bgColor,
                                                       java.lang.String scaleMode,
                                                       java.lang.String lang,
                                                       java.lang.String detectFlashVersion,
                                                       java.lang.String autoInstallRedirect,
                                                       java.lang.String windowMode)

  Parameters:
    `chartSWF` - - SWF File Name (and Path) of the chart which you intend to plot
    `strURL` - - If you intend to use dataUrl method for this chart, pass the Url as value for this parameter. Else, set it to "" (in case of dataString method)
    `strData` - - If you intend to use dataString method for this chart, pass the JSON data as the value for this parameter. Else, set it to "" (in case of dataUrl method)
    `chartId` - - Id for the chart, using which it will be recognized in the HTML page. Each chart on the page needs to have a unique Id.
    `chartWidth` - - Intended width for the chart (in pixels)
    `chartHeight` - - Intended height for the chart (in pixels)
    `debugMode` - - Whether to start the chart in debug mode
    `registerWithJS` - - Whether to ask chart to register itself with JavaScript
    `bgColor` - - Background color of the Flash movie (here chart) which comes below the chart and is visible if chart's background color is set to transparent or translucent using bgAlpha.
    `scaleMode` - - "noScale" - recommended/default, "exactFit" - scales the chart to fit the container exactly with width and height (causes distortion in some cases), "noBorder" - constrained scale. (not recommended at all), "showAll" - (not recommended)
    `lang` - - Language, as of now its only value is "EN" for english
    `detectFlashVersion` - - Checks the Flash Player version and if version is less than 8 and autoInstallRedirect is set on then asks the user to install Flash Player from Adobe site
    `autoInstallRedirect` - - If set on, the user would be redirected to Adobe site if Flash player 8 is not installed.
    `windowMode` - - Can accept values: "window"/"opaque"/ "transparent".
  Returns:
    - String - Returns the html + javascript code for embedding the chart.

### createChartWithXML

    public static java.lang.String createChartWithXML(java.lang.String chartSWF,
                                                      java.lang.String strURL,
                                                      java.lang.String strData,
                                                      java.lang.String chartId,
                                                      java.lang.String chartWidth,
                                                      java.lang.String chartHeight,
                                                      boolean debugMode,
                                                      boolean registerWithJS)

  Parameters:
    `chartSWF` - - SWF File Name (and Path) of the chart which you intend to plot
    `strURL` - - If you intend to use dataUrl method for this chart, pass the Url as value for this parameter. Else, set it to "" (in case of dataString method)
    `strData` - - If you intend to use dataUrl method for this chart, pass the Url to the JSON as value for this parameter. Else, set it to "" (in case of dataString method)
    `chartId` - - Id for the chart, using which it will be recognized in the HTML page. Each chart on the page needs to have a unique Id.
    `chartWidth` - - Intended width for the chart (in pixels)
    `chartHeight` - - Intended height for the chart (in pixels)
    `debugMode` - - Whether to start the chart in debug mode
    `registerWithJS` - - Whether to ask chart to register itself with JavaScript
  Returns:
    - String - Returns the html + javascript code for embedding the chart.

### createChartWithXML

    public static java.lang.String createChartWithXML(java.lang.String chartSWF,
                                                      java.lang.String strURL,
                                                      java.lang.String strData,
                                                      java.lang.String chartId,
                                                      java.lang.String chartWidth,
                                                      java.lang.String chartHeight,
                                                      boolean debugMode,
                                                      boolean registerWithJS,
                                                      java.lang.String bgColor,
                                                      java.lang.String scaleMode,
                                                      java.lang.String lang,
                                                      java.lang.String detectFlashVersion,
                                                      java.lang.String autoInstallRedirect,
                                                      java.lang.String windowMode)

  Parameters:
    `chartSWF` - - SWF File Name (and Path) of the chart which you intend to plot
    `strURL` - - If you intend to use dataUrl method for this chart, pass the Url as value for this parameter. Else, set it to "" (in case of dataString method)
    `strData` - - If you intend to use dataString method for this chart, pass the XML data as the value for this parameter. Else, set it to "" (in case of dataUrl method)
    `chartId` - - Id for the chart, using which it will be recognized in the HTML page. Each chart on the page needs to have a unique Id.
    `chartWidth` - - Intended width for the chart (in pixels)
    `chartHeight` - - Intended height for the chart (in pixels)
    `debugMode` - - Whether to start the chart in debug mode
    `registerWithJS` - - Whether to ask chart to register itself with JavaScript
    `bgColor` - - Background color of the Flash movie (here chart) which comes below the chart and is visible if chart's background color is set to transparent or translucent using bgAlpha.
    `scaleMode` - - "noScale" - recommended/default, "exactFit" - scales the chart to fit the container exactly with width and height (causes distortion in some cases), "noBorder" - constrained scale. (not recommended at all), "showAll" - (not recommended)
    `lang` - - Language, as of now its only value is "EN" for english
    `detectFlashVersion` - - Checks the Flash Player version and if version is less than 8 and autoInstallRedirect is set on then asks the user to install Flash Player from Adobe site
    `autoInstallRedirect` - - If set on, the user would be redirected to Adobe site if Flash player 8 is not installed.
    `windowMode` - - Can accept values: "window"/"opaque"/ "transparent".
  Returns:
    - String - Returns the html + javascript code for embedding the chart.

### encodeDataURL

    public static java.lang.String encodeDataURL(java.lang.String strDataURL,
                                                 boolean addNoCacheStr)

  Encodes the dataURL before it's served to FusionCharts. If you have parameters in your dataUrl, you necessarily need to encode it.

  Parameters:
    `strDataURL` - - dataURL to be fed to chart
    `addNoCacheStr` - - Whether to add additional string to URL to disable caching of data
  Returns:
    String - the encoded URL

### obtainUTFBOMAsString

    public static java.lang.String obtainUTFBOMAsString()

  Returns UTF8 BOM as a string.

  Returns:
    String - UTF8 BOM

### getFCColor

    public java.lang.String getFCColor()

  Returns a color from the array.