答案 0 :(得分:0)
我建议Raphael.js,它是图表插件gRaphael
答案 1 :(得分:0)
我推荐pChart,您可以用它创建非常棒的图表。纯PHP,没别的。
答案 2 :(得分:0)
我推荐Google Chart Tools,很容易生成语法,看起来很棒!
答案 3 :(得分:-1)
这是一个非常简单的 PHP 函数,可生成漂亮的折线图,它使用 Google Charts API ,这是免费的:
function GenerateLineAreaChartHtmlCode($valuesArray, $values_count, $title, $hAxisLabels, $yUnit, $xUnit, $bk_color, $b_reverse_sort = false)
{
if (count($valuesArray) == 0)
return "";
$chart_function_name_id = rand(100, 100000);
$chart_html_code = "<script type=\"text/javascript\" src=\"https://www.google.com/jsapi\"></script>
<script type=\"text/javascript\">
google.load(\"visualization\", \"1\", {packages:[\"corechart\"]});
google.setOnLoadCallback(drawChart$chart_function_name_id);
function drawChart$chart_function_name_id() {
var data = new google.visualization.DataTable();
data.addColumn('string', '$xUnit');
data.addColumn('number', '$yUnit');
data.addRows([";
if ($b_reverse_sort)
krsort($valuesArray, SORT_NUMERIC);
else
ksort($valuesArray, SORT_NUMERIC);
if ($values_count == 0)
$values_count = count($valuesArray);
for ($curPointN = 0; $curPointN <= $values_count; $curPointN ++)
{
$cur_point_value = $valuesArray[$curPointN];
if ($cur_point_value == "")
$cur_point_value = 0;
$chart_html_code .= "['$curPointN $xUnit', $cur_point_value],";
}
$chart_name = "chart_div" . rand(100, 100000);
$chart_html_code .= "]);
var chart = new google.visualization.AreaChart(document.getElementById('$chart_name'));
chart.draw(data, {width: 700, height: 300, title: '$title', backgroundColor: '$bk_color', fontName: 'Antic', fontSize: 12,
hAxis: {title: '$hAxisLabels', titleTextStyle: {color: '#FF0000'} },
vAxis: {}
});
}
</script><div id=\"$chart_name\"></div>";
return $chart_html_code;
}