highchart使用与图像动态代码

来源:互联网 发布:云计算平台性能指标 编辑:程序博客网 时间:2024/05/01 08:16

1、所要引入的jar包

    <script type="text/javascript"    src="<%=basePath %>common/js/easyui/highcharts/jquery-1.8.3.min.js"></script>
    <script type="text/javascript"    src="<%=basePath %>common/js/easyui/highcharts/highcharts.js"></script>
    <script type="text/javascript"    src="<%=basePath %>common/js/easyui/highcharts/exporting.js"></script>
    <script type="text/javascript"  src="<%=basePath %>common/js/easyui/highcharts/data.js"></script>

$('#container').highcharts({

      chart: {
          type: 'areaspline'
      },
      title: {
          text: ''
      },
      legend: {                               // 【图例】位置样式
          layout: 'horizontal',               // 【图例】显示的样式:水平(horizontal)/垂直(vertical)
          backgroundColor: '#FFFFFF',
          borderColor: '#CCC',
          borderWidth: 1,
          align: 'center',
          verticalAlign: 'top',
          enabled:true,
          y: 50,
          shadow: true
      },
      xAxis: {
          categories: d1, //X轴的坐标值
          labels: {
              rotation: -45,
              align: 'right',
              style: {font: 'normal 8px'}
          }
        
      },
      yAxis: {
          title: {
              text: '金额(天/充值数)' //Y轴坐标标题  
          }
      },
      tooltip: {
           formatter: function() {  
              // 当鼠标悬置数据点时的格式化提示
               return '<b>'+ this.series.name +'</b><br/>'+  
               '总金额:' + Highcharts.numberFormat(this.y, 1)+'元<br/>当前日期:'+ this.x +'';  
           }  
      },
      credits: {
          enabled: false   
      },
      
      series: [{
          name:"每天各游戏平台充值金额",  
          data: d2
      }]
  });
}

//月报表开发
//获取每个月充值天数
Date.prototype.format = function(format) {
var o = {
    "M+" : this.getMonth() + 1,
    "d+" : this.getDate(),
    "h+" : this.getHours(),
    "m+" : this.getMinutes(),
    "s+" : this.getSeconds(),
    "q+" : Math.floor((this.getMonth() + 3) / 3),
    "S" : this.getMilliseconds()
}
if (/(y+)/.test(format)) {
    format = format.replace(RegExp.$1, (this.getFullYear() + "")
            .substr(4 - RegExp.$1.length));
}
for ( var k in o) {
    if (new RegExp("(" + k + ")").test(format)) {
        format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k]
                : ("00" + o[k]).substr(("" + o[k]).length));
    }
}
return format;
}

function getFormatDateByLong1(l, pattern) {
return new Date(l).format(pattern);
0 0
原创粉丝点击