【876】柱线图增加数据视图功能,表格增加日期列
Showing
1 changed file
with
30 additions
and
12 deletions
@@ -378,7 +378,23 @@ export default { | @@ -378,7 +378,23 @@ export default { | ||
378 | }, | 378 | }, |
379 | splitLine: { | 379 | splitLine: { |
380 | show: false, | 380 | show: false, |
381 | - } | 381 | + }, |
382 | + /* min:function (value){ | ||
383 | + if(Math.abs(value.max)>Math.abs(value.min)){ | ||
384 | + return (-Math.abs(value.max)*1.2).toFixed(2) | ||
385 | + }else{ | ||
386 | + return (-Math.abs(value.min)*1.2).toFixed(2) | ||
387 | + | ||
388 | + } | ||
389 | + }, | ||
390 | + max:function (value){ | ||
391 | + if(Math.abs(value.max)>Math.abs(value.min)){ | ||
392 | + return (Math.abs(value.max)*1.2).toFixed(2) | ||
393 | + }else{ | ||
394 | + return (Math.abs(value.min)*1.2).toFixed(2) | ||
395 | + | ||
396 | + } | ||
397 | + }*/ | ||
382 | }, | 398 | }, |
383 | { | 399 | { |
384 | type: "value", | 400 | type: "value", |
@@ -627,19 +643,21 @@ export default { | @@ -627,19 +643,21 @@ export default { | ||
627 | dataView: { | 643 | dataView: { |
628 | show: true, title: '数据视图', readOnly: true, optionToContent: function (opt) { | 644 | show: true, title: '数据视图', readOnly: true, optionToContent: function (opt) { |
629 | let series = opt.series; | 645 | let series = opt.series; |
646 | + console.log("***",opt) | ||
630 | let str=''; | 647 | let str=''; |
631 | if(that.optionsSetup.download){ | 648 | if(that.optionsSetup.download){ |
632 | str+=`<div style="position: absolute;right: 10px;top: 6px;color:#1e9fff;cursor: pointer;"> | 649 | str+=`<div style="position: absolute;right: 10px;top: 6px;color:#1e9fff;cursor: pointer;"> |
633 | <span id="handleButton" >导出</span> | 650 | <span id="handleButton" >导出</span> |
634 | </div>`; | 651 | </div>`; |
635 | } | 652 | } |
636 | - let table =str+ '<table '+that.dataViewTable+' class="dataViewTable"><thead><tr class="dataViewTr">'; | 653 | + let table =str+ '<table '+that.dataViewTable+' class="dataViewTable"><thead>' + |
654 | + '<tr class="dataViewTr"><td '+that.dataViewThead+'>日期</td>'; | ||
637 | for(let i=0;i<series.length;i++){ | 655 | for(let i=0;i<series.length;i++){ |
638 | table+='<td '+that.dataViewThead+' class="dataViewHead">' + (series[i].name?series[i].name:'') + '</td>'; | 656 | table+='<td '+that.dataViewThead+' class="dataViewHead">' + (series[i].name?series[i].name:'') + '</td>'; |
639 | } | 657 | } |
640 | table+= '</thead></tr><tbody '+that.dataViewTbody+'>'; | 658 | table+= '</thead></tr><tbody '+that.dataViewTbody+'>'; |
641 | for(let j=0;j<series[0].data.length;j++){ | 659 | for(let j=0;j<series[0].data.length;j++){ |
642 | - table += '<tr class="dataViewTr">'; | 660 | + table += '<tr class="dataViewTr"><td '+that.dataViewTd+'>'+opt.xAxis[0].data[j]+'</td>'; |
643 | for(let i=0;i<series.length;i++){ | 661 | for(let i=0;i<series.length;i++){ |
644 | table +='<td '+that.dataViewTd+' class="dataViewTd">' + series[i].data[j] + '</td>' | 662 | table +='<td '+that.dataViewTd+' class="dataViewTd">' + series[i].data[j] + '</td>' |
645 | } | 663 | } |
@@ -770,15 +788,15 @@ export default { | @@ -770,15 +788,15 @@ export default { | ||
770 | }) | 788 | }) |
771 | } | 789 | } |
772 | this.options.series=series; | 790 | this.options.series=series; |
773 | - let arr=[]; | ||
774 | - this.options.series.map(item=>{ | ||
775 | - arr.push(item.data) | ||
776 | - }) | ||
777 | - let min=this.calMin(arr); | ||
778 | - let max=this.calMax(arr); | ||
779 | - if(min<0){ | ||
780 | - this.options.yAxis[1].min=-20; | ||
781 | - } | 791 | + // let arr=[]; |
792 | + // this.options.series.map(item=>{ | ||
793 | + // arr.push(item.data) | ||
794 | + // }) | ||
795 | + // let min=this.calMin(arr); | ||
796 | + // let max=this.calMax(arr); | ||
797 | + // if(min<0){ | ||
798 | + // this.options.yAxis[1].min=-20; | ||
799 | + // } | ||
782 | // this.options.yAxis[0].max=max; | 800 | // this.options.yAxis[0].max=max; |
783 | // this.options.yAxis[0].min=min; | 801 | // this.options.yAxis[0].min=min; |
784 | // this.options.yAxis[0].interval=(max-min)/7 | 802 | // this.options.yAxis[0].interval=(max-min)/7 |
-
Please register or login to post a comment