一个简单的例子。

1.html代码

 <div id="pie"  style="width: 250px;float:left">
<h3>饼图</h3>
<canvas style="float:left" ></canvas>
<div class="legend"></div>
</div>

说明:canvas标记用来作图。div.legend用来放置图例。整体区域使用#pie标记。

2.js代码

<script>
$.ajax({
url:"_get_json.php?a=getTeaNumbyDep_json",
dataType:"json",
success:function(data){
//console.info(data);
pie("#pie",data,"#legend");
bar("#bar",data);
}
});
</script>

说明:这部分代码是和上面的html代码写在一起的。jquery的ajax方法访问了一个_get_json.php页面,并以json的格式返回数据。pie是一个单独的封装的js方法,bar也是。

3.用于获取数据的php代码

$sql ="select dep_name as label,count(tea_code) as value from sims_teacher,sims_department where sims_teacher.dep_code=sims_department.dep_code group by sims_teacher.dep_code";
$rs = $this->db->getAll($sql);
echo json_encode($rs);

说明:这里编写了一条sql语句,并执行,把结果以json格式返回。为了方便我使用数据,为选出的两个字段分别使用了label,value这两个别名,主要的原因是chart.js中绘制饼图时需要的数据格式就如此(这里有详细说明)。而绘制柱状图时,又需要另一种数据格式(晕死,又要重新写)。

4.用来画图的两个js函数pie,bar

var colors = ["#F38630","#E0E4CC","#69D2E7"];

function pie(obj_id,pieData,obj_legent=null)
{
if(pieData.length==null || pieData.length == 0)
return;
for(var i=0;i<pieData.length;i++)
{
pieData[i].color=colors[i%colors.length];
pieData[i].fillColor=colors[i%colors.length]; }
var t = obj_id +" canvas";
console.info(t)
var ctx = $("#pie canvas")[0].getContext("2d");
myChart = new Chart(ctx).Pie(pieData, {
responsive : true,
scaleFontColor : "#00F",
tooltipTemplate: "<%if (label){%><%=label%>: <%}%><%= value %>人",
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%><li><span style=\"background-color:<%=segments[i].fillColor%>\"></span><%if(segments[i].label){%><%=segments[i].label%>:<%=segments[i].value%><%}%></li><%}%></ul>"
});
if(obj_legent)
{
var legend = myChart.generateLegend();
$(obj_id +" div.legend").empty();
$(obj_id +" div.legend").append(legend);
}
}
function bar(obj_id,Data,obj_legent=null)
{
if(Data.length==null || Data.length == 0)
return;
var barData={};
barData.labels=[];
barData.datasets=[];
var temData={};
temData.data=[];
temData.fillColor= "rgba(151,187,205,0.5)";
temData.strokeColor = "rgba(151,187,205,0.8)";
temData.highlightFill="rgba(151,187,205,0.75)",
temData.highlightStroke= "rgba(151,187,205,1)"; for(var i=0;i<Data.length;i++)
{
barData.labels.push(Data[i].label);
temData.data.push(Data[i].value);
}
barData.datasets.push(temData); //封装一个规定格式的barData。
console.info(barData);
var t = obj_id +" canvas";
var ctx = $(t).get(0).getContext("2d");
myChart = new Chart(ctx).Bar(barData, { //重点在这里
responsive : true
});
if(obj_legent)
{
var legend = myChart.generateLegend();
$(obj_id +" div.legend").empty();
$(obj_id +" div.legend").append(legend);
}
}

说明:

(1)为了给饼图的各个区块设置不同的颜色,设置了colors数组。当然三个颜色肯定不够的。

(2)bar函数的前段,一直在封装固定格式的数据。

最后的效果如下:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAf4AAAEiCAIAAACX8ScmAAAgAElEQVR4nO2d+5sb1Znn50/yTj2z+3QI6/HOxlniTWbJ9JgdTAbIMGIZ0g9h0pqxQy8k7KhxQI4hLQiJFW4yBiOapCNMAIWLsQXYuN10221bVru77W71Teqr7tezP7yt6lKpSipJVXWkqu/nOQ+0ylK9OlWlT7116tQ5f8EAAADYjL/g/QUAAACYDdQPAAC2A+oHAADbAfUDAIDtgPoBAMB2QP0AAGA7oH4AALAdDdR/9vD/2nN3n++8bHF2dOjAgaHRbM37s8En9z/y2qWEfl8QANMY6RcEoXdoXPlfs7Onntx/r9JhX2dt/SNNxwHABOqrf3yoVxCEh07EZcujw4/sFoQ9/SPRqsXZ0Wd7BUHofVb66xjpF9pA8ZcDgCE0UP/o0F09Cod93bU1UH929IV7v/vgsXPyZAm/GmAwddUfPnaPovkZY9GR/j2C0HOXNAcaf+GuHrn4tw/ifT881Cx9+3fjIAam0jAbp5yn+rCvv7b66s9eOfHI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TrlgWA+gHQDfI+dWaXep/utRrXyY+aMkhwwWCQmjXE2570CKv4DXUPTc0pXq+3r6+PKi4+NSbm2rrfyqZ75tR5VMz3qdmH7nDIrrSADKgfAH0Q832xK7foffpD7Oaoe2gaGIfUTyNCk4vpX2kmEGoQ131kYGpQIt37/X6a+ZZVmnccDgcNUGzEVQ6tUxywgbxPZ0HaF1zGyegWoH4A9CFWQZbvi3+IjzgZd7uPhgUm/9KAwNQAQuPJUK9KHcNRUw81ppP6+/r6xFlH6CllHcPJqM33pd6n/qMd1ammo4D6AdCNht43tGc3mU52K5VmoTJOf9Jh6WjkBnFWcaPVHwqF6EwjduuUeb+jRsrsNKB+APSEWtW9Xq/b7TbT+4wxsWVf7F9E5x7dH5qVQWNhkoV9Pp/4NJkJ49FTpj9Wmdwc3tcO1A+AIdBDPaZ5XxZa7Lwv3uw1FLqRIKpfPAmZ1qWS7A/vawfqB8AoyEEme18MTSceQ1t7pNAAFSRfLoMWiLk/vK8FqB8AA+GYgVJcMx9lCgaD4kBpXB6hotDmx+1GoH4AjMVuz5Hq+NwWMA6oHwAAbAfUDwAAtgPqBwAA2wH1AwCA7YD6AQDAdkD9AABgO6B+AACwHVA/AADYjv8PnBPNH0LIHJQAAAAASUVORK5CYII=" alt="" />

chart.js 示例的更多相关文章

  1. JS组件系列——开源免费图表组件:Chart.js

    前言:最近被开源免费得有点上火了,各种组件首先想到的就是是开源否.是否免费.是否和bootstrap风格一致.想着以后做报表肯定要用到图表组件的,于是在Bootstrap中文网上面找到了Chart.j ...

  2. chart.js插件生成折线图时数据普遍较大时Y轴数据不从0开始的解决办法[bubuko.com]

    chart.js插件生成折线图时数据普遍较大时Y轴数据不从0开始的解决办法,原文:http://bubuko.com/infodetail-328671.html 默认情况下如下图 Y轴并不是从0开始 ...

  3. 让IE8支持HTML5及canvas功能!chart.js图表绘制工具库IE8上兼容方案

    第一步,我们加上对html5的支持. <!--[if IE]> <script src="/public/html5.js" type="text/ja ...

  4. chart.js图表库案例赏析,饼图添加文字

    chart.js图表库案例赏析,饼图添加文字 Chart.js 是一个令人印象深刻的 JavaScript 图表库,建立在 HTML5 Canvas 基础上.目前,它支持6种图表类型(折线图,条形图, ...

  5. 【译】用 Chart.js 做漂亮的响应式表单

    数据包围着我们.虽然搜索引擎和其他应用都对基于文本方式表示的数据偏爱有加,但人们发现可视化是更容易理解的一种方式.今年初,SitePoint 发表了 Aurelio 的文章< Chart.js简 ...

  6. Chart.js 动态图表的使用

    一.相关资料 1. 简介 Chart.js 是一个基于 HTML5 的简单的面向对象的图表库,支持包括 IE7/8 和所有现代浏览器.支持六种图标:曲线图(Linecharts).柱状图(Barcha ...

  7. [转] angular2+highcharts+chart.js

    这里是在ionic2下使用highchairs和chart.js的简单示例chartjs部分参考http://www.jianshu.com/p/bc18132da812 1.安装hightchart ...

  8. 关于chart.js 设置canvas的宽度为父级元素的宽度的百分百 以及 X轴上面刻度数据太多如何处理

    今天在做一个数据统计的界面的时候,需要做折线统计图,在网上找了一圈发现数据统计的插件还是不少的,本着轻量级的的原则选择了Chart.js,后来在做的过程中便遇到两个问题,以此记录下来,和刚刚接触前端的 ...

  9. Chart.js中文文档-雷达图

    雷达图或蛛网图(Radar chart) 简介 A radar chart is a way of showing multiple data points and the variation bet ...

随机推荐

  1. storyboard和xib的区别

    storyboard只是算是帮你布局,流程什么的,xib的另一种形势,比xib功能多,但是和分享完全没有半点关系 你暂时可以理解为高级xib

  2. 数据挖掘-Python基本模块

    1.numpy:基础模块,高效处理数据.提供数组支持 2.pandas:数据探索和数据分析 3.matplotlib:数据成图模块,解决数据可视化 4.scipy:支持数值计算,支持矩阵运算,提供高等 ...

  3. ActiveX,ATL和COM技术

    首先COM的诞生本来就是基于二进制的复用思想,一直影响到了DLL的技术基础.它是一种windows下二进制模块组件与组件之间通信的规范,ActiveX就需要依赖这个技术,因为浏览器的东西可能需要获取客 ...

  4. 在VS2010下开发C语言程序

    妈蛋,我发现VS下开发C语言,并不是把文件名改成.C的就行了.VS2010不支持C99.  也就是函数局部变量声明必须放在函数的开头.难怪,我从Linux下移植过来的.c工程怎么是编译错误呢,发现是变 ...

  5. sql management studio 附加mdf文件出错的解决办法

    将mdf文件所在文件夹的权限改为everyone.,完全控制即可.

  6. Linux企业级项目实践之网络爬虫(18)——队列处理

    所有的URL都接受管理,并在此进行流动.URL从管理模块的存储空间开始,一直到最后输出给磁盘上的URL索引,都由此部分调度.首先,给出URL调度的一般过程,如图所示.其流程的各个具体操作,后面详述.要 ...

  7. 2015第22周六Java反射、泛型、容器简介

    Java的反射非常强大,传递class, 可以动态的生成该类.取得这个类的所有信息,包括里面的属性.方法以及构造函数等,甚至可以取得其父类或父接口里面的内容. obj.getClass().getDe ...

  8. perl 学习笔记

    一:基础 1:安装perl      centos: yum -y install perl       官网:https://www.perl.org/      升级到5.22:先下载,执行./i ...

  9. 浅谈JVM内存区域划分

    好吧,虽说真的有看过<深入分析Java Web技术内幕>一书,但当时看的时候还是一知半解,稀里糊涂的看完了.本来是打算暑假拿起来再看一遍的,但是早两天一个阿里学长给我做了个小面试,让我颇受 ...

  10. Codeforces Round #322 (Div. 2) —— F. Zublicanes and Mumocrates

    It's election time in Berland. The favorites are of course parties of zublicanes and mumocrates. The ...