Office 365中制作报表的方式很多。

这里介绍下使用js获取SharePoint List实现报表的一种方法

资源

先看效果, 要实现一个饼图

看代码

详细代码解释见原文(原文中的代码有点小问题,修复后的代码如下)  http://www.sharepointdeveloperhq.com/2013/05/utilizing-spservices-for-sharepoint-2010-to-create-charts-with-high-charts/

 <script src="/sites/target3/Theme/jquery.min.js" type="text/javascript"></script>
<script src="/sites/target3/Theme/highcharts.js" type="text/javascript"></script>
<script src="/sites/target3/Theme/jquery.SPServices-2013.01.js" type="text/javascript"></script>
<script src="/sites/target3/Theme/underscore.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function () {
  $().SPServices({
operation: "GetListItems",
CAMLQuery: "<Query><OrderBy><FieldRef Name='Location'/></OrderBy></Query>",
CAMLViewFields: "<ViewFields><FieldRef Name='Title'/><FieldRef Name='Date_x0020_of_x0020_Sighting'/><FieldRef Name='Action'/><FieldRef Name='Location'/></ViewFields>",
listName: "owl seen",
completefunc: processData
});
    });
 
    function processData (xData, status) {
        var owlData = [];
        $(xData.responseXML).SPFilterNode("z:row").each(function () {
            owlData.push({
                owl:        $(this).attr('ows_Title'),
                date:       $(this).attr('ows_Date_x0020_of_x0020_Sighting'),
                action:     $(this).attr('ows_Action'),
                location:   $(this).attr('ows_Location')
            });
        });         var chartData = [];
        var locationData = _.groupBy(owlData, 'location');         $.each(locationData, function(row) {
            var locCount = row.length;             chartData.push( {
                name:   row[0].location,
                y:      locCount
            });
 
        });         renderChart (chartData);
    }
 
    function renderChart (data) {
        var chart = new Highcharts.Chart({
            chart: {
                renderTo: 'owlchart',
                plotBackgroundColor: null,
                plotBorderWidth: null,
                plotShadow: false
            },
            credits: {
                enabled: true
            },
            title: {
                text: 'Owl Sightings by Location'
            },
            tooltip: {
                pointFormat: '{series.name}: <b>{point.percentage}%</b> {point.y} Times',
                percentageDecimals: 1
            },
            plotOptions: {
                pie: {
                    allowPointSelect: true,
                    cursor: 'pointer',
                    dataLabels: {
                        enabled: true,
                        color: '#000000',
                        connectorColor: '#000000',
                        formatter: function() {
                            return '<b>'+ this.point.name +'</b>: '+ this.y +' Times';
                        }
                    },
                }
            },
            series: [{
                type: 'pie',
                name: 'Location Count',
                data: data
            }]
        });
    }
</script>
<div id="owlchart">​​​​​​​​</div>

Thanks,

Ivan

SharePoint中报表选择的更多相关文章

  1. 在SharePoint中创建可自定义属性的文件夹

    概况 阅读时间:约5分钟 适用版本:SharePoint Server 2010及以上 面向用户:普通用户.管理员.开发人员 难度指数:★★★☆☆ SharePoint中的文件夹分为2种,一种是文档库 ...

  2. 如何:在 SharePoint 中创建外部列表

    在创建外部内容类型后创建外部列表是一项非常简单的任务,有如下4种方式进行: 可使用 Microsoft SharePoint Designer 2010 浏览器来完成 VS2010的列表实例 采用代码 ...

  3. 自定义SharePoint 2013 元数据选择控件

    元数据在Sharepoint中是一个很常用的功能,他提供一个方法来管理企业中常用的关键词,可以更加统一的使用和更新.默认情况下,绑定在列表或库中的元数据字段可以设置是否允许为多个值.但是无法控制在弹出 ...

  4. No-Touch Integration 在SharePoint中使用社区支持的Silverlight应用程序

    No-Touch Integration 在SharePoint中使用社区支持的Silverlight应用程序         No-Touch Integration应该是最简单的方法了.将Silv ...

  5. 彻底抛弃PeopleEditor,SharePoint中利用Jquery Chosen创建新的人员选择器

    彻底抛弃PeopleEditor,SharePoint中利用Jquery Chosen创建新的人员选择器 基于SharePoint平台开发时,人员选择器使用频率是非常高的,但是原生的人员选择器使用太麻 ...

  6. “认证发布”和“获取展示”,如何在 SharePoint 中正确使用 RSS Feed。

    在我们进行的日常工作中,是由一部分信息需要 Share 给其他人或者组织的.SharePoint 虽然支持在某个 Site Collection 中互通信息,但是跨 Site Collection 的 ...

  7. SharePoint中使用Visio Service展示业务数据

    SharePoint中可以通过Visio Service可以在浏览器中查看Visio图,功能部署到系统中,一切安好. 而现实总是很折磨人,使用该功能后,相关使用者随后提出,Visio图能否与我的业务数 ...

  8. Visual Studio工具栏中无法选择调试设备

    Visual Studio工具栏中无法选择调试设备 在Visual Studio工具栏中,默认显示已经识别的设备.用户可以从中选择对应的设备,进行调试和部署App.但是由于误操作,可能导致该选项丢失. ...

  9. VIM 中鼠标选择不选中行号

    VIM 中鼠标选择不选中行号 在Vim中,我们一般会使用 :set nu 打开行号开关. 但是打开行号后,有个弊端,那就是在用鼠标进行选择的时候,会将前面的行号也一起进行拷贝了.但是在gVim中进行选 ...

随机推荐

  1. boost学习笔记(七)---date_time库

    date_time库的日期基于格里高利历,支持从1400-01-01到9999-12-31之间的日期计算 #define BOOST_DATE_TIME_SOURCE #include <boo ...

  2. Android 图形总结

    1.9patch图 2.按钮自定义 <?xml version="1.0" encoding="utf-8"?> <shape xmlns:a ...

  3. idea jrebel6 安装,破解

    一.Setting中在线安装JRebel插件,install 二.拷贝下载的jrebel.rar解压后 把里面内容覆盖IDEA插件安装目录中此插件目录之下 下载:http://pan.baidu.co ...

  4. IE7中绝对定位元素之间的遮盖问题

    由于页面复杂就不上现实例子,举例说明. 两个同层级<div>元素,都设置了 position: relative;相对定位. 他们的内部的元素(不管什么元素了)都设置了position: ...

  5. (原创)QuartusII设置虚拟引脚(Virtual Pin)

    方法一: 在Quartus II中Assignments->Assignment Editor, 在Category栏选择logic options, 到列表中To列下添加要设置的引脚接口,如果 ...

  6. zoj3806Incircle and Circumcircle

    链接 自己的本本没有装画图软件,先借用两张图片..博客园不让贴源地址... 可以想到对于一个确定的外接圆的三角形来说内切圆最大的时候为等边三角形,如下图: 确定有合法的解之后,接下来就是去找这个解,解 ...

  7. 【转】wpa_supplicant与wpa_cli之间通信过程

    [转]wpa_supplicant与wpa_cli之间通信过程 转自:http://blog.chinaunix.net/uid-26585427-id-4051479.html wpa_suppli ...

  8. qt开源社区学习

    http://bbs.qter.org/forum.php?mod=forumdisplay&fid=52

  9. js操作新添加的DOM的问题

    $(function(){ $("body").on("click", '.abc', function(){ alert('ok'); }); $('.b') ...

  10. wireshark常用命令

    Wireshark 基本语法,基本使用方法,及包过虑规则: 1.过滤IP,如来源IP或者目标IP等于某个IP   例子: ip.src eq 192.168.1.107 or ip.dst eq 19 ...