だから私はGoogleチャートAPIを使用していますが、APIに渡されたHTMLエンティティをデータでデコードすると、チャートが表示され、タイトルにはまだデコードされていないHTMLエンティティが含まれており、シンボルの代わりに‡のようなものが表示されますそれが表しています ..
以下は例です..データがチャートでデコードされていることを確認するにはどうすればよいです か
<?php
session_start();
// disable any caching by the browser
header('Expires: Mon, 14 Oct 2002 05:00:00 GMT'); // Date in the past
header('Last-Modified: ' . gmdate("D, d M Y H:i:s") . ' GMT'); // always modified
header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP 1.1
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache'); // HTTP 1.0
require_once('../config.php');
require_once '../_includes/auxiliary_functions.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Charts</title>
<link rel="stylesheet" title="Style CSS" href="report_assets/style.css" type="text/css" media="all" />
<link rel="stylesheet" title="Style CSS" href="report_assets/cwcalendar.css" type="text/css" media="all" />
<link rel="stylesheet" title="Style CSS" href="report_assets/colorbox.css" type="text/css" media="all" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="../_js/jquery-1.6.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../_js/timer.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<?php
$data = $_GET['data'];
$title = $_GET['title'];
$data = strip_tags(DecodeSpecialChars(html_entity_decode($data)));
?>
<script type="text/javascript">
function htmlEntities(str) {
return String(str).replace(/‡/g, '‡;');
}
</script>
<script type="text/javascript">
google.load('visualization', '1', {packages: ['corechart']});
//set callback
google.setOnLoadCallback (createChart);
//callback function
function createChart() {
//create data table object
var dataTable = new google.visualization.DataTable();
//create data table object
var dataTableMulticolumn = new google.visualization.DataTable();
//define columns for first example
dataTable.addColumn('string','Question');
dataTable.addColumn('number', 'Answers');
//define rows of data for first example
dataTable.addRows([<?php echo strip_tags(DecodeSpecialChars(html_entity_decode($data))); ?>]);
//instantiate our chart objects
var chart = new google.visualization.PieChart (document.getElementById('Chart'));
//define options for visualization
var options = {width: 1550, height: 900,legendFontSize:14,fontSize:25,is3D: true, title: "<?php echo $title; ?>"};
//draw our chart charts
chart.draw(dataTable, options);
//register callbacks
google.visualization.events.addListener(eventsChart, 'onmouseover', showDetails);
google.visualization.events.addListener(eventsChart, 'onmouseout', hideDetails);
}
function showDetails(e) {
switch (e['row']) {
case 0: document.getElementById('details0').style.visibility='visible';
break;
case 1: document.getElementById('details1').style.visibility='visible';
break;
case 2: document.getElementById('details2').style.visibility='visible';
break;
case 3: document.getElementById('details3').style.visibility='visible';
break;
}
}
function hideDetails(e) {
switch (e['row']) {
case 0: document.getElementById('details0').style.visibility='hidden';
break;
case 1: document.getElementById('details1').style.visibility='hidden';
break;
case 2: document.getElementById('details2').style.visibility='hidden';
break;
case 3: document.getElementById('details3').style.visibility='hidden';
break;
}
}
</script>
<?php
echo "<div class='charts'>";
echo "<div id='Chart'></div>";
echo "</div>";
?>