npm install fusioncharts npm install fusionmaps
bower install fusioncharts bower install fusionmaps
connect_error) {
exit("There was an error with your connection: ".$dbhandle->connect_error);
}
?> Extract files from the downloaded FusionCharts Suite XT and keep the fusioncharts.js and fusioncharts.charts.js file inside a folder and keep that folder inside the directory called modules inside the drupal folder. e.g. C:\xampp\htdocs\drupal\modules\lib drupal_add_js('modules/lib/fusioncharts.js');
drupal_add_js('modules/lib/fusioncharts.charts.js');
drupal_add_js('themes/fusioncharts.theme.fint.js'); Download the fusioncharts php wrapper and keep the fusioncharts.php file inside modules/php folder. $strQuery = "SELECT DISTINCT revenue_type, revenue_value,revenue_budget, expenditure_type, expenditure_value,expenditure_budget FROM financial_records";
$result = $dbhandle->query($strQuery) or exit("Error code ({$dbhandle->errno}): {$dbhandle->error}"); Achieve the required json format using php,to render the chart. if ($result) {
//Creating the chart object
$arrData1 = array(
"chart" => array(
"paletteColors" => "#23B7B7,#ED3132,#3CDAE0",
"bgColor" => "#EAEAEA",
"showLabels"=>"0",
"showBorder" => "0",
"use3DLighting" => "0",
"showShadow" => "0",
"enableSmartLabels" => "0",
"startingAngle" => "0",
"showPercentValues" => "1",
"showPercentInTooltip" => "0",
"decimals" => "1",
"captionFontSize" => "14",
"subcaptionFontSize" => "14",
"subcaptionFontBold" => "0",
"toolTipColor" => "#ffffff",
"toolTipBorderThickness" => "0",
"toolTipBgColor" => "#000000",
"toolTipBgAlpha" => "80",
"toolTipBorderRadius" => "2",
"toolTipPadding" => "5",
"showHoverEffect" => "1",
"showLegend" => "1",
"legendBgColor" => "#ffffff",
"legendBorderAlpha" => "0",
"legendShadow" => "0",
"legendItemFontSize" => "10",
"legendItemFontColor" => "#666666",
"useDataPlotColorForLabels" => "1",
"theme"=>"fint"
)
);
//creating the data array
$arrData1["data"]=array();
while($row = mysqli_fetch_array($result)) {
array_push($arrData1["data"], array(
"label" => $row["expenditure_type"],
"value"=>$row["expenditure_value"]
)
);
}
//encoding the array in json format
$jsonEncodedData_chart1 = json_encode($arrData1);
$expenditureChart = new FusionCharts("pie2d", "chart2" , "100%", "300", "chart-container2", "json", $jsonEncodedData_chart1);
//rendering the chart
$expenditureChart->render();
// closing db connection
$dbhandle->close();
}
?> Finally define the div where the chart will render. i.e. Keep this code inside Block body.Chart will render here!
To create pie charts and generate statistical data, you’ll find this list of the best…
To implement FusionCharts in a dynamically resizing flexbox layout, ensure that the chart's dimensions are…
At FusionCharts, we believe in empowering developers and businesses with cutting-edge data visualization tools that…
Ever had a data set that seemed more complicated than a Rubik's cube? You’re not…
We’ve all seen them in textbooks or presentations—those overlapping circles that simplify complex information into…
We’re excited to announce the upcoming release of FusionCharts v4.1—a groundbreaking step forward in the…