zoukankan      html  css  js  c++  java
  • hightcharts 3d 堆积图下钻

    图片效果

    ***************代码部分******************************************************

    <!doctype html>
    <html>

    <head>
    <script type="text/javascript" src="http://cdn.hcharts.cn/jquery/jquery-1.8.3.min.js"></script>
    <script src="http://cdn.hcharts.cn/highcharts/highcharts.js"></script>
    <script src="http://cdn.hcharts.cn/highcharts/highcharts-3d.js"></script>
    <script src="http://cdn.hcharts.cn/highcharts/modules/data.js"></script>
    <script src="http://cdn.hcharts.cn/highcharts/modules/drilldown.js"></script>
    <script type="text/javascript">
    $(function() {
    var global = {};
    global.app = {};
    global.ui = {};

    Highcharts.setOptions({
    lang: {
    drillUpText: '返回'
    }
    });

    var _data = [
    ["1", 500],
    ["2", 246],
    ["3", 54],
    ["4", 137],
    ["5", 317],
    ["6", 87],
    ["7", 11],
    ["8", 89],
    ["9", 80],
    ["10", 62],
    ["11", 84],
    ["12", 80],
    ["13", 74],
    ["14", 10],
    ["15", 70]
    ];
    var _data2 = [
    ["1", 300],
    ["2", 296],
    ["3", 54],
    ["4", 177],
    ["5", 117],
    ["6", 74]
    ];

    global.ui.chart = {
    stackColumn: function(id, title, value, data, drilldownSeries) {
    $(id).highcharts({
    chart: {
    type: 'column',
    options3d: {
    enabled: true,
    alpha: 5,
    beta: 0,
    depth: 50,
    viewDistance: 25
    }
    },
    title: {
    text: title,
    style: "font-size:12px;"
    },
    xAxis: {
    type: "category"
    },
    yAxis: {
    min: 0,
    title: {
    text: value,
    align: 'high'
    },
    labels: {
    enabled: false
    }
    },
    tooltip: {
    pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b> ({point.percentage:.0f}%)<br/>',
    shared: true
    },
    plotOptions: {
    column: {
    stacking: 'normal',
    dataLabels: {
    enabled: true
    },
    showInLegend: false
    }
    },
    credits: {
    enabled: false
    },
    series: data,
    drilldown: {
    drillUpButton: _drillUpButton,
    series: drilldownSeries
    }
    });
    }
    };
    global.ui.chart.stackColumn("#container", "a", "a", [{
    name: "1",
    color:'#95ceff',
    data: [{
    name: "2012年",
    y: 200,
    drilldown: 'year'
    }, {
    name: "2013年",
    y: 300,
    drilldown: 'year'
    }, {
    name: "2014年",
    y: 400,
    drilldown: 'year'
    }, {
    name: "2015年",
    y: 150,
    drilldown: 'year'
    }, {
    name: "2016年",
    y: 50,
    drilldown: 'year'
    }]
    }, {
    name: "2",
    color:'#ffbd2e',
    data: [{
    name: "2012年",
    y: 40,
    drilldown: 'year2'
    }, {
    name: "2013年",
    y: 58,
    drilldown: 'year'
    }, {
    name: "2014年",
    y: 60,
    drilldown: 'year'
    }, {
    name: "2015年",
    y: 85,
    drilldown: 'year'
    }, {
    name: "2016年",
    y: 60,
    drilldown: 'year'
    }]
    }], [{
    id: 'year',
    name: "1",

    data: _data
    }, {
    id: 'year2',
    name: "2",

    data: _data2
    }]);
    });
    </script>
    </head>

    <body>
    <div id="container" style="min- 310px; height: 400px; margin: 0 auto"></div>
    </body>

    </html>

    ********************************************************************

    highCharts钻取功能官方教程地址:http://www.hcharts.cn/docs/basic-drilldown

  • 相关阅读:
    软件工程2019:第3次作业—— 团队项目阶段一: 项目需求分析
    软件工程2019:第2次作业—— 时事点评
    第1次作业—— 自我介绍 + 软工五问(热身运动)
    软工作业(4)用户体验分析:以 “师路南通网站” 为例
    软工作业(3):用户体验分析
    软工作业: (2)硬币游戏—— 代码分析与改进
    《软件工程导论》读后感想与疑惑
    软工作业(1)
    用户体验分析:以 “师路南通网站” 为例
    用户体验分析: 以 “南通大学教务管理系统微信公众号” 为例
  • 原文地址:https://www.cnblogs.com/youngMe/p/6202529.html
Copyright © 2011-2022 走看看