开源代码位置: http://c3js.org/
下载:https://github.com/masayuki0812/c3/releases/tag/0.4.10
linux下运行的问题:
1.不能直接运行sample中的内容,需要修改引用文件位置
2.修改 simple.html的例子,不能直接修改<div id="chart"><div>,否则无法展示,可以通过以下修改实现(标注为红色的部分):
<?php
$host=isset($_SERVER['HTTP_HOST'])?($_SERVER['HTTP_HOST']):"";
echo $host;
echo "<link type='text/css' rel='stylesheet' href='http://123.56.111.132/lib/c3/c3.css'>\n";
echo "<script type='text/javascript' src='http://123.56.111.132/lib/c3/d3.v3.min.js'></script>\n";
echo "<script type='text/javascript' src='http://123.56.111.132/lib/c3/c3.js'></script>\n";
?>
<div id="chartx">loading-chart</div>
<script>
var chart = c3.generate({
bindto: '#chartx',
data: {
columns: [
['pv-num', 30, 200, 100, 400, 150, 250],
['ip-num', 50, 20, 10, 40, 15, 25]
],
onclick: function (d, element) { console.log("onclick", d, element); },
onmouseover: function (d) { console.log("onmouseover", d); },
onmouseout: function (d) { console.log("onmouseout", d); },
}
});
</script>