| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408 |
- <!DOCTYPE HTML>
- <html xmlns:th="http://www.thymeleaf.org"
- xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
- layout:decorate="~{admin/common/common}">
- <head>
- <title>总体统计</title>
- <style>
- #container {
- height: 500px;
- }
- #polyline {
- height: 500px;
- width: 1100px;
- border:1px solid #000;
- }
- </style>
- </head>
- <body layout:fragment="content">
- <div class="page-container">
- <form class="form form-horizontal" id="form-add" th:action="@{/statistics/getOverallAnalysis}" th:method="get">
- <input type="hidden" id="chartType" name="chartType"/>
- <div>
- <label>开始日期:</label><input type="text" class="input-text" style="width:200px" readonly placeholder="请输入开始日期" id="begin_date" name="begin_date" />
- <label>结束日期:</label><input type="text" class="input-text" style="width:200px" readonly placeholder="请输入结束日期" id="end_date" name="end_date" />
- <span><a onclick="streetDeclaer()" class="btn btn-info radius"><i class="Hui-iconfont"></i> 搜索</a></span>
- </div>
- <div class="chart_data">
- <div id="container"></div>
- </div>
- <!--<div class="chart_data mt-20 col-xs-12 col-sm-12" id="polyline"></div>-->
- </form>
- </div>
- <script type="text/javascript" th:src="@{/js/lib/highcharts/highcharts.js}"></script>
- <script type="text/javascript" th:src="@{/js/lib/highcharts/exporting.js}"></script>
- <script type="text/javascript" th:src="@{/js/lib/highcharts/highcharts-zh_CN.js}"></script>
- <style>
- a.cur{
- background: #0a6999;color:#fff;
- }
- </style>
- <script th:inline="javascript">
- $(function () {
- $(".highlight a").click(function(){
- $(this).addClass("cur").parent().siblings().find("a").removeClass("cur")
- })
- overallAnalysis();
- // businessTrend();
- });
- //初始化柱形图
- var initColumn = {
- chart: {
- renderTo: 'container',
- type: 'column',
- events: {
- render: function () {
- }
- }
- },
- title: {
- text: '2017年各街道申报项目数'
- },
- subtitle: {
- text: null
- },
- xAxis: {
- crosshair: true
- },
- yAxis: {
- min: 0,
- allowDecimals: false,
- title: {
- text: '',
- align: 'high'
- },
- labels: {
- overflow: 'justify'
- }
- },
- tooltip: {
- valueSuffix: ' 个'
- },
- plotOptions: {
- column: {
- pointPadding: 0.2,
- borderWidth: 0
- }
- },
- series: []
- };
- //初始化饼图
- var initPie ={
- chart: {
- renderTo: 'container',
- plotBackgroundColor: null,
- plotBorderWidth: null,
- plotShadow: false
- },
- title: {
- text: '各政务类型处理单据占比'
- },
- tooltip: {
- headerFormat: '',
- pointFormat: '{point.name}: <b>{point.y}</b> '
- },
- plotOptions: {
- pie: {
- allowPointSelect: true,
- cursor: 'pointer',
- dataLabels: {
- enabled: true,
- // 通过 format 或 formatter 来格式化数据标签显示
- //format: '值: {point.y} 占比 {point.percentage} %',
- formatter: function () {
- //this 为当前的点(扇区)对象,可以通过 console.log(this) 来查看详细信息
- return '<span"> ' + this.point.name + ':' + this.y + '</span>';
- }
- },
- showInLegend: true // 显示在图例中
- }
- },
- series: [{
- type: 'pie',
- name: ''
- }]
- };
- //总体分析
- function overallAnalysis() {
- $("#chartType").val(2);
- $.ajax({
- type: "get",
- dataType: "json",
- data: {
- begin_date: $("#begin_date").val(),
- end_date: $("#end_date").val()
- },
- url: pagePath+ "/statistics/getOverallAnalysis",
- success: function (result) {
- console.log(result);
- if (result.success) {
- var value = result.obj;
- var data = [];
- for(var j=0;j<value.length;j++){
- data.push({"name":value[j].type,"y":value[j].overallNum});
- }
- console.log(data);
- var chart = new Highcharts.Chart(initPie);
- chart.series[0].setData(data);
- } else {
- errorMessage(result.message);
- }
- },
- error: function () {
- errorMessage('系统错误!');
- }
- });
- }
- //各政务增长趋势图
- function businessTrend() {
- $("#chartType").val(4);
- var initPolyline = Highcharts.chart('polyline', {
- title: {
- text: '各政务增长趋势图',
- x: -20 //center
- },
- xAxis: {
- categories: []
- },
- yAxis: {
- title: {
- text: ''
- },
- min: 0,
- allowDecimals: false,
- },
- tooltip: {
- valueSuffix: '次'
- },
- legend: {
- layout: 'vertical',
- align: 'right',
- verticalAlign: 'middle',
- borderWidth: 0
- },
- series: []
- });
- $.ajax({
- type: "post",
- dataType: "json",
- data: {
- begin_date: $("#begin_date").val(),
- end_date: $("#end_date").val()
- },
- url: pagePath + "/projectDeclaration/streetReportingTrend",
- success: function (result) {
- console.log(result);
- if (result.success) {
- var obj = result.obj;
- var map = obj.polyline_data;
- //x轴年份
- var categories = obj.year_array;
- initPolyline.xAxis[0].categories=categories;
- //展示数据
- for(var key in map){
- initPolyline.addSeries({
- name: key,
- data: map[key]
- });
- }
- } else {
- errorMessage(result.message);
- }
- },
- error: function () {
- errorMessage('系统错误!');
- }
- });
- }
- //各街道申报数量
- function streetDeclaerNum(type) {
- $("#chartType").val(1);
- $.ajax({
- type: "post",
- dataType: "json",
- data: {
- begin_date: $("#begin_date").val(),
- end_date: $("#end_date").val(),
- type : type
- },
- url: pagePath + "/projectDeclaration/streetDeclaerNum/",
- success: function (result) {
- console.log(result);
- if (result.success) {
- var chart = new Highcharts.Chart(initColumn);
- var categoies = [];
- var row1 = [];
- var row2 = [];
- var value = result.obj;
- for(var j=0;j<value.length;j++){
- categoies.push(value[j].street_name);
- row1.push(value[j].declare_num);
- row2.push(value[j].declare_success);
- }
- chart.xAxis[0].categories=categoies;
- chart.addSeries({
- name: "申报项目",
- data: row1
- });
- chart.addSeries({
- name: "申报成功",
- data: row2
- });
- } else {
- errorMessage(result.message);
- }
- },
- error: function () {
- errorMessage('系统错误!');
- }
- });
- }
- //项目发展趋势
- function projectDevelopmentTrend(type) {
- $("#chartType").val(3);
- var initPolyline = Highcharts.chart('container', {
- title: {
- text: '项目发展趋势',
- x: -20 //center
- },
- // subtitle: {
- // text: 'Source: WorldClimate.com',
- // x: -20
- // },
- xAxis: {
- categories: []
- },
- yAxis: {
- title: {
- text: '项目申请次数(次)'
- },
- plotLines: [{
- value: 0,
- width: 1,
- color: '#808080'
- }]
- },
- tooltip: {
- valueSuffix: '次'
- },
- legend: {
- layout: 'vertical',
- align: 'right',
- verticalAlign: 'middle',
- borderWidth: 0
- },
- series: []
- });
- $.ajax({
- type: "post",
- dataType: "json",
- data: {
- begin_date: $("#begin_date").val(),
- end_date: $("#end_date").val(),
- type : type
- },
- url: pagePath + "/projectDeclaration/projectDevelopmentTrend",
- success: function (result) {
- console.log(result);
- if (result.success) {
- var obj = result.obj;
- var map = obj.polyline_data;
- //x轴年份
- var categories = obj.year_array;
- initPolyline.xAxis[0].categories=categories;
- //展示数据
- for(var key in map){
- initPolyline.addSeries({
- name: key,
- data: map[key]
- });
- }
- } else {
- errorMessage(result.message);
- }
- },
- error: function () {
- errorMessage('系统错误!');
- }
- });
- }
- //各类别项目申请情况
- function filingSituation(type) {
- $("#chartType").val(5);
- $.ajax({
- type: "post",
- dataType: "json",
- data: {
- begin_date: $("#begin_date").val(),
- end_date: $("#end_date").val(),
- type : type
- },
- url: pagePath + "/projectDeclaration/filingSituation/",
- success: function (result) {
- console.log(result);
- if (result.success) {
- var chart = new Highcharts.Chart(initColumn);
- var categoies = [];
- var row1 = [];
- var row2 = [];
- var value = result.obj;
- for(var j=0;j<value.length;j++){
- categoies.push(value[j].project_type_name);
- row1.push(value[j].declare_num);
- row2.push(value[j].declare_success);
- }
- chart.xAxis[0].categories=categoies;
- chart.addSeries({
- name: "申报项目",
- data: row1
- });
- chart.addSeries({
- name: "申报成功",
- data: row2
- });
- } else {
- errorMessage(result.message);
- }
- },
- error: function () {
- errorMessage('系统错误!');
- }
- });
- }
- function streetDeclaer(){
- overallAnalysis();
- }
- laydate.render({
- elem: '#begin_date', //指定元素
- // min: 0
- });
- laydate.render({
- elem: '#end_date', //指定元素
- // min: 0
- });
- </script>
- </body>
- </html>
|