彩票走势图

SpreadJS 9 新功能之表格切片器

转帖|使用教程|编辑:龚雪|2016-03-09 11:23:57.000|阅读 353 次

概述:本文主要介绍SpreadJS 9版本中的新功能:表格切片器,提供类似Excel表的体验。

# 慧都年终大促·界面/图表报表/文档/IDE等千款热门软控件火热促销中 >>

相关链接:

本文主要介绍SpreadJS 9 新功能:表格切片器。SpreadJS提供通过类似Excel的表格切片器过滤和分析数据的功能。

1.引用相关资源

  <meta name="spreadjs culture" content="zh-CN" />
    <title>SpreadJS Pluggable Sample</title>
    <link href="gcspread.sheets.excel2016darkGray.9.40.20153.0.css" rel="stylesheet" type="text/css" />
    <script src="jquery-1.8.2.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="gcspread.sheets.all.9.40.20153.0.min.js"></script>
    <script type="text/javascript" src="gcspread.sheets.resources.zh.9.40.20153.0.min.js"></script>

2.初始化Spread和Table

注意:切片器建立在Table之上

 var spread = new GcSpread.Sheets.Spread(document.getElementById("ss"));
            spread.isPaintSuspended(true);
            var sheet = spread.getActiveSheet();
            dataColumns = ["Name", "City", "Birthday", "Sex", "Weight", "Height"];
            data = [
                ["bob", "NewYork", "1968/6/8", "man", "80", "180"],
                ["Betty", "NewYork", "1972/7/3", "woman", "72", "168"],
                ["Gary", "NewYork", "1964/3/2", "man", "71", "179"],
                ["Hunk", "Washington", "1972/8/8", "man", "80", "171"],
                ["Cherry", "Washington", "1986/2/2", "woman", "58", "161"],
                ["Eva", "Washington", "1993/2/15", "woman", "71", "180"]];
            sheet.addTableByDataSource("table1", 1, 1, data);
            var table = sheet.findTableByName("table1");
            table.setColumnName(0, dataColumns[0]);
            table.setColumnName(1, dataColumns[1]);
            table.setColumnName(2, dataColumns[2]);
            table.setColumnName(3, dataColumns[3]);
            table.setColumnName(4, dataColumns[4]);
            table.setColumnName(5, dataColumns[5]);

3.增加两个切片器

            var slicer0 = sheet.addSlicer("slicer1", "table1", "Name");
            slicer0.position(new GcSpread.Sheets.Point(230, 120));
            var slicer1 = sheet.addSlicer("slicer2", "table1", "City");
            slicer1.position(new GcSpread.Sheets.Point(440, 120));

效果截图:

效果截图

效果截图

效果截图

源码下载:

文章转自葡萄城
更多厂商产品信息请查看>>

标签:JavaScript HTML5数据可视化

本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@cahobeh.cn


为你推荐

  • 推荐视频
  • 推荐活动
  • 推荐产品
  • 推荐文章
  • 慧都慧问
扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP