Esempio n. 1
0
 function ShowChartFC($xml, $scroll = FALSE, $drilldown = FALSE)
 {
     global $ReportLanguage;
     $typ = $this->ChartType;
     // Chart type (1/2/3/4/...)
     $id = $this->ID;
     // Chart ID
     $parms = $this->Parms;
     // "bgcolor=FFFFFF|..."
     $trends = $this->Trends;
     // Trend lines
     $data = $this->Data;
     $series = $this->Series;
     $width = $this->ChartWidth;
     $height = $this->ChartHeight;
     $align = $this->ChartAlign;
     if (empty($typ)) {
         $typ = 1;
     }
     // Get chart path / swf
     $fcfchart = $this->IsFCFChart();
     $showgrid = $this->UseGridComponent;
     if ($typ > 8 && $typ != 104 && $typ != 22 && $typ != 101) {
         $showgrid = FALSE;
     }
     $charttype = "";
     switch ($typ) {
         // Single Series
         case 1:
             $charttype = $scroll ? "scrollcolumn2d" : "column2d";
             break;
             // Column 2D
         // Column 2D
         case 2:
             $charttype = "pie2d";
             break;
             // Pie 2D
         // Pie 2D
         case 3:
             $charttype = "bar2d";
             break;
             // Bar 2D
         // Bar 2D
         case 4:
             $charttype = $scroll ? "scrollline2d" : "line";
             break;
             // Line 2D
         // Line 2D
         case 5:
             $charttype = "column3d";
             break;
             // Column 3D
         // Column 3D
         case 6:
             $charttype = "pie3d";
             break;
             // Pie 3D
         // Pie 3D
         case 7:
             $charttype = $scroll ? "scrollarea2d" : "area2d";
             break;
             // Area 2D
         // Area 2D
         case 8:
             $charttype = "doughnut2d";
             break;
             // Doughnut 2D
             // Multi Series
         // Doughnut 2D
         // Multi Series
         case 9:
             $charttype = $scroll ? "scrollcolumn2d" : "mscolumn2d";
             break;
             // Multi-series Column 2D
         // Multi-series Column 2D
         case 10:
             $charttype = "mscolumn3d";
             break;
             // Multi-series Column 3D
         // Multi-series Column 3D
         case 11:
             $charttype = $scroll ? "scrollline2d" : "msline";
             break;
             // Multi-series Line 2D
         // Multi-series Line 2D
         case 12:
             $charttype = $scroll ? "scrollarea2d" : "msarea";
             break;
             // Multi-series Area 2D
         // Multi-series Area 2D
         case 13:
             $charttype = "msbar2d";
             break;
             // Multi-series Bar 2D
             // Stacked
         // Multi-series Bar 2D
         // Stacked
         case 14:
             $charttype = $scroll ? "scrollstackedcolumn2d" : ($charttype = "stackedcolumn2d");
             break;
             // Stacked Column 2D
         // Stacked Column 2D
         case 15:
             $charttype = "stackedcolumn3d";
             break;
             // Stacked Column 3D
         // Stacked Column 3D
         case 16:
             $charttype = "stackedarea2d";
             break;
             // Stacked Area 2D
         // Stacked Area 2D
         case 17:
             $charttype = "stackedbar2d";
             break;
             // Stacked Bar 2D
             // Combination
         // Stacked Bar 2D
         // Combination
         case 18:
             $charttype = $scroll ? "scrollcombidy2d" : "mscombidy2d";
             break;
             // Multi-series Column 2D Line Dual Y Chart
         // Multi-series Column 2D Line Dual Y Chart
         case 19:
             $charttype = "mscolumn3dlinedy";
             break;
             // Multi-series Column 3D Line Dual Y Chart
             // Financial
         // Multi-series Column 3D Line Dual Y Chart
         // Financial
         case 20:
             $charttype = EWR_FUSIONCHARTS_FREE ? EWR_FUSIONCHARTS_FREE_CHART_PATH . "FCF_Candlestick.swf" : "candlestick";
             break;
             // Candlestick
             // Other
         // Candlestick
         // Other
         case 21:
             $charttype = EWR_FUSIONCHARTS_FREE ? EWR_FUSIONCHARTS_FREE_CHART_PATH . "FCF_Gantt.swf" : "gantt";
             break;
             // Gantt
         // Gantt
         case 22:
             $charttype = EWR_FUSIONCHARTS_FREE ? EWR_FUSIONCHARTS_FREE_CHART_PATH . "FCF_Funnel.swf" : "funnel";
             break;
             // Funnel
             // Additional FusionCharts
         // Funnel
         // Additional FusionCharts
         case 101:
             $charttype = "doughnut3d";
             break;
             // Doughnut 3D
         // Doughnut 3D
         case 102:
             $charttype = "msbar3d";
             break;
             // Multi-series Bar 3D
         // Multi-series Bar 3D
         case 103:
             $charttype = "stackedbar3d";
             break;
             // Stacked Bar 3D
         // Stacked Bar 3D
         case 104:
             $charttype = "msbar3d";
             break;
             // Bar 3D (using Multi-series Bar 3D for single series)
             // Default
         // Bar 3D (using Multi-series Bar 3D for single series)
         // Default
         default:
             $charttype = "column2d";
             // Default = Column 2D
     }
     // Set width, height and align
     if (is_numeric($width) && is_numeric($height)) {
         $wrkwidth = $width;
         $wrkheight = $height;
     } else {
         // Default
         $wrkwidth = EWR_CHART_WIDTH;
         $wrkheight = EWR_CHART_HEIGHT;
     }
     // Output JavaScript for FC
     $chartxml = $xml;
     if ($chartxml == "") {
         $chartxml = $fcfchart ? "<graph/>" : "";
     }
     // Empty chart
     $chartid = "chart_" . $id;
     if ($drilldown) {
         $chartid .= "_" . ewr_Random();
     }
     if ($fcfchart && ewr_IsMobile()) {
         $wrk = "<div>" . $ReportLanguage->Phrase("BrowserNoFlashSupport") . "</div>";
     } else {
         $wrk = "<script type=\"text/javascript\">\n";
         $wrk .= "var chartoptions = { \"width\": " . $wrkwidth . ", \"height\": " . $wrkheight . ",\n" . "\t\"id\": \"" . $chartid . "\", \"type\": \"" . $charttype . "\" };\n";
         $wrk .= "var chartxml = \"" . ewr_EscapeJs($chartxml) . "\";\n";
         if ($fcfchart) {
             $wrk .= "var cht_{$id} = new FusionChartsFree(chartoptions.type, chartoptions.id, chartoptions.width, chartoptions.height);\n";
             $wrk .= "cht_{$id}.addParam(\"wmode\", \"transparent\");\n";
             $wrk .= "cht_{$id}.setDataXML(chartxml);\n";
         } else {
             $wrk .= "var cht_{$id} = new FusionCharts(chartoptions);\n";
             $wrk .= "cht_{$id}.setXMLData(chartxml);\n";
             $wrk .= $drilldown ? "ewrDrillCharts[ewrDrillCharts.length] = cht_{$id}.id;\n" : "ewrExportCharts[ewrExportCharts.length] = cht_{$id}.id;\n";
             // Export chart
         }
         $wrk .= "var f = " . CurrentPage()->PageObjName . ".Chart_Rendering;\n";
         $wrk .= "if (typeof f == \"function\") f(cht_{$id}, 'chart_{$id}');\n";
         $wrk .= "cht_{$id}.render(\"div_" . $id . "\");\n";
         $wrk .= "f = " . CurrentPage()->PageObjName . ".Chart_Rendered;\n";
         $wrk .= "if (typeof f == \"function\") f(cht_{$id}, 'chart_{$id}');\n";
         // Grid component
         if ($showgrid && $chartxml != "") {
             // Load Bar2D XML for Bar3D
             if ($typ == 104) {
                 $this->SetChartParm("type", "3", FALSE);
                 // Reset to 2D
                 $this->XmlDoc = new DOMDocument("1.0", "utf-8");
                 $chartxml = $this->ChartXml();
                 $this->SetChartParm("type", "104", FALSE);
                 // Restore chart type
             }
             // Remove clickurl first
             $doc = new DOMDocument();
             $doc->loadXML($chartxml);
             $doc->documentElement->setAttribute("clickurl", "");
             $chartgridxml = $doc->saveXML();
             $gridid = $id . "_grid";
             $chartid = "chart_" . $gridid;
             if ($drilldown) {
                 $chartid .= "_" . ewr_Random();
             }
             $wrkgridheight = $this->ChartGridHeight;
             $wrk .= "chartxml = \"" . ewr_EscapeJs($chartgridxml) . "\";\n";
             $wrk .= "chartoptions = { \"width\": " . $wrkwidth . ", \"height\": " . $wrkgridheight . ",\n" . "\t\"id\": \"" . $chartid . "\", \"type\": \"ssgrid\" };\n";
             $wrk .= "var cht_{$gridid} = new FusionCharts(chartoptions);\n";
             $wrk .= "cht_{$gridid}.setXMLData(chartxml);\n";
             $wrk .= $drilldown ? "ewrDrillCharts[ewrDrillCharts.length] = cht_{$gridid}.id;\n" : "ewrExportCharts[ewrExportCharts.length] = cht_{$gridid}.id;\n";
             // Export chart
             // Set Grid specific parameters
             if ($this->ChartGridConfig) {
                 $wrk .= "cht_{$gridid}.configure(" . $this->ChartGridConfig . ");\n";
             }
             $wrk .= "cht_{$gridid}.render(\"div_" . $gridid . "\");\n";
         }
         // Debug mode
         if (!$fcfchart && EWR_DEBUG_ENABLED) {
             $wrk .= "FusionCharts[\"debugger\"].enable(true, function(message) { console.log(message); });\n";
         }
         $wrk .= "</script>\n";
     }
     // Show XML for debug
     if (EWR_DEBUG_ENABLED) {
         $wrk .= "<p>(Chart XML): " . ewr_HtmlEncode($chartxml) . "</p>";
     }
     return $wrk;
 }
Esempio n. 2
0
"); // Optional theme
}
ewr_GetCss("colorbox/colorbox.css");
<?php 
    if (!@$gbDrillDownInPanel) {
        ?>
ewr_GetCss("<?php 
        echo ewr_CssFile(EWR_PROJECT_STYLESHEET_FILENAME);
        ?>
");
<?php 
    }
    ?>
</script>
<?php 
    if (ewr_IsMobile()) {
        ?>
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php 
    }
} else {
    ?>
<style type="text/css">
<?php 
    $cssfile = @$gsExport == "pdf" ? EWR_PDF_STYLESHEET_FILENAME == "" ? EWR_PROJECT_STYLESHEET_FILENAME : EWR_PDF_STYLESHEET_FILENAME : EWR_PROJECT_STYLESHEET_FILENAME;
    echo file_get_contents($cssfile);
    ?>
</style>
<?php 
}
?>