Răsfoiți Sursa

fix: 兼容模式

zhangyuhan 2 ani în urmă
părinte
comite
ff21989edb

+ 16 - 11
src/web/staticres/common-module/chart-module/js/chart-common.js

@@ -3,7 +3,7 @@
   * el: 挂载的dom节点
   * chartData 图表数据集合
   * config 支持配置的文本,点击事件函数
-  * type 判断图表类型,有以下几个参数 
+  * type 判断图表类型,有以下几个参数
   * {
       * ve-histogram 柱状图
       * ve-finehistogram 柱状图+折线图
@@ -13,7 +13,7 @@
  */
 
 
-var chartTemplate = 
+var chartTemplate =
 `
   <template>
       <ve-histogram
@@ -53,7 +53,7 @@ var chartTemplate =
       </ve-line>
   </template>
 `
-window.proxy.vComponentChart = function (el, chartData, config, type) {
+var vComponentChart = function (el, chartData, config, type) {
   new Vue({
     delimiters: ['${', '}'],
     el: el,
@@ -141,7 +141,7 @@ window.proxy.vComponentChart = function (el, chartData, config, type) {
                     formatter: (value, index) => value.toString().replace(/,/, '') + '%'
                   }
                 })
-      
+
                 Object.assign(item[1], {
                   splitLine: {
                     show: false
@@ -555,9 +555,9 @@ window.proxy.vComponentChart = function (el, chartData, config, type) {
       newTimeConfig (options) {
         options.xAxis[0].axisLabel.rotate = 60
         options.xAxis[0].axisLabel.interval = 'auto'
-  
+
         options.yAxis[1].axisLabel.show = true
-  
+
         if (this.chartData.rows.length > 12) {
           // 设置时间轴
           Object.assign(options, {
@@ -579,13 +579,13 @@ window.proxy.vComponentChart = function (el, chartData, config, type) {
             }
           })
         }
-  
+
         options.legend.bottom = 30
         options.legend.data = [
           { icon: 'rect', name: this.chartData.columns[1] },
           { icon: 'line', name: this.chartData.columns[2] }
         ]
-  
+
         options.tooltip.axisPointer.shadowStyle.color = 'rgba(5,166,243,0.1)'
         options.tooltip.formatter = params => {
           let tip = `<div style="padding-top:2px;color:#9B9CA3;">${params[0].name}</div>`
@@ -626,7 +626,7 @@ window.proxy.vComponentChart = function (el, chartData, config, type) {
         this.treeMapChart.defaultOptions.legend.data = this.chartData.map(item => {
           return item.name
         })
-  
+
         _.merge(this.treeMapChart.defaultOptions, this.treeMapChart.options)
       },
       treetooltipFormatter (params) {
@@ -676,11 +676,11 @@ window.proxy.vComponentChart = function (el, chartData, config, type) {
             }
           }
         })
-  
+
         Object.assign(options.legend, {
           icon: 'rect'
         })
-  
+
         options.tooltip.formatter = params => {
           let tip = `<div style="padding-top:2px;color:#9B9CA3;">${params[0].name}</div>`
           for (let i = 0; i < params.length; i++) {
@@ -698,3 +698,8 @@ window.proxy.vComponentChart = function (el, chartData, config, type) {
     }
   })
 }
+
+window.vComponentChart = vComponentChart
+if (window.proxy) {
+  window.proxy.vComponentChart = vComponentChart
+}