Exemplo n.º 1
0
function renderChartHTML($chartSWF, $strURL, $strXML, $chartId, $chartWidth, $chartHeight, $debugMode = false, $registerWithJS = false, $setTransparent = "")
{
    $strFlashVars = "&chartWidth=" . $chartWidth . "&chartHeight=" . $chartHeight . "&debugMode=" . boolToNum($debugMode);
    if ($strXML == "") {
        $strFlashVars .= "&dataURL=" . $strURL;
    } else {
        $strFlashVars .= "&dataXML=" . $strXML;
    }
    $nregisterWithJS = boolToNum($registerWithJS);
    if ($setTransparent != "") {
        $nsetTransparent = $setTransparent == false ? "opaque" : "transparent";
    } else {
        $nsetTransparent = "window";
    }
    $HTML_chart = <<<HTMLCHART
\t<!-- START Code Block for Chart {$chartId} -->
\t<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="{$chartWidth}" height="{$chartHeight}" id="{$chartId}">
\t\t<param name="allowScriptAccess" value="always" />
\t\t<param name="movie" value="{$chartSWF}"/>\t\t
\t\t<param name="FlashVars" value="{$strFlashVars}&registerWithJS={$nregisterWithJS}" />
\t\t<param name="quality" value="high" />
\t\t<param name="wmode" value="transparent" />
\t\t<embed src="{$chartSWF}" FlashVars="{$strFlashVars}&registerWithJS={$nregisterWithJS}" quality="high" width="{$chartWidth}" height="{$chartHeight}" name="{$chartId}" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="{$nsetTransparent}" />
\t</object>
\t<!-- END Code Block for Chart {$chartId} -->
HTMLCHART;
    return $HTML_chart;
}
Exemplo n.º 2
0
function renderChartHTML($chartSWF, $strURL, $strXML, $chartId, $chartWidth, $chartHeight, $debugMode)
{
    // Generate the FlashVars string based on whether dataURL has been provided
    // or dataXML.
    $strFlashVars = "&chartWidth=" . $chartWidth . "&chartHeight=" . $chartHeight . "&debugMode=" . boolToNum($debugMode);
    if ($strXML == "") {
        // DataURL Mode
        $strFlashVars .= "&dataURL=" . $strURL;
    } else {
        //DataXML Mode
        $strFlashVars .= "&dataXML=" . $strXML;
    }
    $HTML_chart = <<<HTMLCHART
\t<!-- START Code Block for Chart {$chartId} -->
\t<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="{$chartWidth}" height="{$chartHeight}" id="{$chartId}">
\t\t<param name="allowScriptAccess" value="always" />
\t\t<param name="movie" value="{$chartSWF}"/>\t\t
\t\t<param name="FlashVars" value="{$strFlashVars}" />
\t\t<param name="quality" value="high" />
        <param name="wmode" value="opaque" />
\t\t<embed src="{$chartSWF}" FlashVars="{$strFlashVars}" quality="high" width="{$chartWidth}" height="{$chartHeight}" wmode="opaque" name="{$chartId}" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
\t</object>
\t<!-- END Code Block for Chart {$chartId} -->
HTMLCHART;
    return $HTML_chart;
}
Exemplo n.º 3
0
    /** 
     * renderChartHTML renders FusionCharts using HTML embedding method.
     *
     * This function does NOT embed the chart using JavaScript class. Instead, it uses
     * direct HTML embedding using OBJECT/EMBED HTML tags.
     *
     * @param	chartSWF				String  - SWF File Name (and Path) of the chart which you intend to plot
     * @param	dataUrl				String  - If you intend to use dataUrl method (XML as Url only, JSON not supported), pass the URL 
     *												as this parameter. Otherwise, set it to "" (in case of dataStr method)
     * @param	dataStr				String  - If you intend to use dataStr method (embedded XML), pass the XML (JSON not supported) 
     *														data as this parameter. Otherwise, set it to "" (in case of dataUrl method)
     * @param	chartId				String  - 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.
     * @param	chartWidth			String  - Intended width for the chart  (in pixels WITHOUT px suffix or in percent)
     * @param	chartHeight			String  - Intended height for the chart (in pixels WITHOUT px suffix or in percent)
     * @param	debugMode			Boolean - Whether to start the chart in debug mode
     * @param	registerWithJS		Boolean - Whether to ask chart to register itself with JavaScript
     * @param	allowTransparent	Boolean - Whether to allow the chart to have transparent background. Additionally this set the chart to get rendered in opaque mode
     *
     * @return	Chart HTML code to be added into web page as String
     */
    function renderChartHTML($chartSWF, $dataUrl, $dataStr, $chartId, $chartWidth, $chartHeight, $debugMode = false, $registerWithJS = false, $allowTransparent = "")
    {
        // detect ssl and rename http:// with https://
        if ($this->FC_DetectSSL()) {
            $this->FC_SetConfiguration("pluginspage", str_replace("http://", "https://", $this->FC_GetConfiguration("pluginspage")));
            $this->FC_SetConfiguration("codebase", str_replace("http://", "https://", $this->FC_GetConfiguration("codebase")));
        }
        // replace all " in XML with '
        $dataStr = @str_replace('"', "'", $dataStr);
        // set wmode
        $wmode = $this->FC_GetConfiguration("forcedwmode", "constants");
        if ($wmode == "") {
            $wmode = $allowTransparent ? "transparent" : "opaque";
        }
        // refer to global configuration storage
        $this->FC_SetConfigurations(array("movie" => $chartSWF, "src" => $chartSWF, "dataXML" => $dataStr, "dataURL" => $dataUrl, "width" => $chartWidth, "height" => $chartHeight, "chartWidth" => $chartWidth, "chartHeight" => $chartHeight, "DOMId" => $chartId, "id" => $chartId, "debugMode" => boolToNum($debugMode), "wmode" => $wmode));
        // Generate the FlashVars string based on whether dataUrl has been provided
        // or dataXML.
        $strFlashVars = $this->FC_Transform($this->FC_GetConfiguration("fvars"), "&{key}={value}");
        $this->FC_SetConfiguration("flashvars", $strFlashVars);
        $strObjectNode = "<object " . $this->FC_Transform(FC_GetConfiguration("object"), " {key}=\"{value}\"") . " >\n";
        $strObjectParamsNode = $this->FC_Transform(FC_GetConfiguration("objparams"), "\t<param name=\"{key}\" value=\"{value}\">\n");
        $strEmbedNode = "<embed " . $this->FC_Transform(FC_GetConfiguration("embed"), " {key}=\"{value}\"") . " />\n";
        $HTML_chart = <<<HTMLCHART
<!-- START Code Block for Chart {$chartId} -->
{$strObjectNode}
{$strObjectParamsNode}
{$strEmbedNode}
</object>
<!-- END Code Block for Chart {$chartId} -->
HTMLCHART;
        $this->FC_INITIALIZE();
        return $HTML_chart;
    }
Exemplo n.º 4
0
    function renderChart($chartSWF, $strURL, $strXML, $chartId, $chartWidth, $chartHeight, $debugMode = false, $registerWithJS = false, $setTransparent = "")
    {
        //First we create a new DIV for each chart. We specify the name of DIV as "chartId"Div.
        //DIV names are case-sensitive.
        // The Steps in the script block below are:
        //
        //  1)In the DIV the text "Chart" is shown to users before the chart has started loading
        //    (if there is a lag in relaying SWF from server). This text is also shown to users
        //    who do not have Flash Player installed. You can configure it as per your needs.
        //
        //  2) The chart is rendered using FusionCharts Class. Each chart's instance (JavaScript) Id
        //     is named as chart_"chartId".
        //
        //  3) Check whether we've to provide data using dataXML method or dataURL method
        //     save the data for usage below
        if ($strXML == "") {
            $tempData = "//Set the dataURL of the chart\n\t\tchart_{$chartId}.setDataURL(\"{$strURL}\")";
        } else {
            $tempData = "//Provide entire XML data using dataXML method\n\t\tchart_{$chartId}.setDataXML(\"{$strXML}\")";
        }
        // Set up necessary variables for the RENDERCAHRT
        $chartIdDiv = $chartId . "Div";
        $ndebugMode = boolToNum($debugMode);
        $nregisterWithJS = boolToNum($registerWithJS);
        $nsetTransparent = $setTransparent ? "true" : "false";
        // create a string for outputting by the caller
        $render_chart = <<<RENDERCHART

\t<!-- START Script Block for Chart {$chartId} -->
\t<div id="{$chartIdDiv}" align="center">
\t\tChart.
\t</div>
\t<script type="text/javascript">\t
\t\t//Instantiate the Chart\t
\t\tvar chart_{$chartId} = new FusionCharts("{$chartSWF}", "{$chartId}", "{$chartWidth}", "{$chartHeight}", "{$ndebugMode}", "{$nregisterWithJS}");
      chart_{$chartId}.setTransparent("{$nsetTransparent}");
    
\t\t{$tempData}
\t\t//Finally, render the chart.
\t\tchart_{$chartId}.render("{$chartIdDiv}");
\t</script>\t
\t<!-- END Script Block for Chart {$chartId} -->
RENDERCHART;
        return $render_chart;
    }
Exemplo n.º 5
0
function renderChartHTML($chartSWF, $strURL, $strXML, $chartId, $chartWidth, $chartHeight, $debugMode=false,$registerWithJS=false, $setTransparent="") {
    // Generate the FlashVars string based on whether dataURL has been provided
    // or dataXML.
    $strFlashVars = "&chartWidth=" . $chartWidth . "&chartHeight=" . $chartHeight . "&debugMode=" . boolToNum($debugMode);
    if ($strXML=="")
        // DataURL Mode
        $strFlashVars .= "&dataURL=" . $strURL;
    else
        //DataXML Mode
        $strFlashVars .= "&dataXML=" . $strXML;
    
    $nregisterWithJS = boolToNum($registerWithJS);
    if($setTransparent!=""){
      $nsetTransparent=($setTransparent==false?"opaque":"transparent");
    }else{
      $nsetTransparent="window";
    }
$HTML_chart = <<<HTMLCHART
	<!-- START Code Block for Chart $chartId -->
	<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="$chartWidth" height="$chartHeight" id="$chartId">
		<param name="allowScriptAccess" value="always" />
		<param name="movie" value="$chartSWF"/>		
		<param name="FlashVars" value="$strFlashVars&registerWithJS=$nregisterWithJS" />
		<param name="quality" value="high" />
		<param name="wmode" value="$nsetTransparent" />
		<embed src="$chartSWF" FlashVars="$strFlashVars&registerWithJS=$nregisterWithJS" quality="high" width="$chartWidth" height="$chartHeight" name="$chartId" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="$nsetTransparent" />
	</object>
	<!-- END Code Block for Chart $chartId -->
HTMLCHART;

  return $HTML_chart;
}