12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echarts-theme', 'template'], function ($, undefined, Backend, Datatable, Table, Echarts, undefined, Template) {
- var Controller = {
- index: function () {
- // 基于准备好的dom,初始化echarts实例
- var myChart = Echarts.init(document.getElementById('echart'), 'walden');
- var myChart1 = Echarts.init(document.getElementById('echart1'), 'walden');
- // 指定图表的配置项和数据
- var option = {
- xAxis: {
- type: 'category',
- data: Config.type_column
- },
- yAxis: {
- type: 'value'
- },
- series: [
- {
- data: Config.type_data,
- type: 'bar',
- showBackground: true,
- backgroundStyle: {
- color: 'rgba(180, 180, 180, 0.2)'
- }
- }
- ]
- };
- var option1 = {
- title: {
- text: '支付方式占比',
- left: 'center'
- },
- tooltip: {
- trigger: 'item'
- },
- legend: {
- orient: 'vertical',
- left: 'left'
- },
- series: [
- {
- type: 'pie',
- radius: '50%',
- data: [
- { value: Config.type_data[0], name: Config.type_column[0] },
- { value: Config.type_data[1], name: Config.type_column[1]},
- { value: Config.type_data[2], name: Config.type_column[2]},
- { value: Config.type_data[3], name: Config.type_column[3]},
- { value: Config.type_data[4], name: Config.type_column[4]},
- { value: Config.type_data[5], name: Config.type_column[5]}
- ],
- emphasis: {
- itemStyle: {
- shadowBlur: 10,
- shadowOffsetX: 0,
- shadowColor: 'rgba(0, 0, 0, 0.5)'
- }
- }
- }
- ]
- };
- // 使用刚指定的配置项和数据显示图表。
- myChart.setOption(option);
- myChart1.setOption(option1);
- }
- };
- return Controller;
- });
|