|
@@ -32,8 +32,8 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import {chartOptionMixins,settingMethod} from '@/views/workspace/components/setting/mixins'
|
|
|
-import Style from '@/views/workspace/components/setting/style.vue'
|
|
|
+import {chartOptionMixins,settingMethod} from '@/views/components/setting/mixins'
|
|
|
+import Style from '@/views/components/setting/style.vue'
|
|
|
var that = this
|
|
|
export default {
|
|
|
name: "CMultipleLine",
|
|
@@ -99,6 +99,7 @@ export default {
|
|
|
// this.$emit('form',this.form)
|
|
|
},
|
|
|
open(chartData,name,relation,timeUnit){
|
|
|
+ console.log(chartData,name,relation,timeUnit)
|
|
|
this.chartData = chartData
|
|
|
this.relation = relation
|
|
|
this.name = name
|
|
@@ -141,44 +142,61 @@ export default {
|
|
|
var timeList = []
|
|
|
var productNameList = []
|
|
|
var data = []
|
|
|
- this.chartData.forEach(item => {
|
|
|
- productNameList.push(item.productName)
|
|
|
- data.push({
|
|
|
- name:item.productName,
|
|
|
+ data.push(
|
|
|
+ {
|
|
|
+ name:'',
|
|
|
type:'line',
|
|
|
connectNulls:true,
|
|
|
- saleVOS:item.saleVOS,
|
|
|
data:[]
|
|
|
- })
|
|
|
- item.saleVOS.forEach(item1=>{
|
|
|
- var index = timeList.findIndex(i=>{
|
|
|
- return item1[relation.x] == i
|
|
|
- })
|
|
|
- if(index == -1){
|
|
|
- timeList.push(item1[relation.x])
|
|
|
- }
|
|
|
- })
|
|
|
- });
|
|
|
- timeList = timeList.sort((a,b)=>{
|
|
|
- if(timeUnit == 0){
|
|
|
- return Date.parse(a.replace(/-/g, "/")) - Date.parse(b.replace(/-/g, "/"))
|
|
|
- }else if(timeUnit==1){
|
|
|
- return Date.parse(a.match(/(\d{1,3})+(?:\.\d+)?/g).join('/'))-Date.parse(b.match(/(\d{1,3})+(?:\.\d+)?/g).join('/'))
|
|
|
- }else{
|
|
|
- return Date.parse(a.substring(0,a.length-1))-Date.parse(b.substring(0,b.length-1))
|
|
|
- }
|
|
|
- }),
|
|
|
- data.forEach(item=>{
|
|
|
- if(item.saleVOS && item.saleVOS.length>0){
|
|
|
- item.saleVOS.forEach(item2=>{
|
|
|
- var index = timeList.findIndex(i=>{
|
|
|
- return item2[relation.x] == i
|
|
|
- })
|
|
|
- item.data[index] = item2[relation.y]
|
|
|
- })
|
|
|
}
|
|
|
+ )
|
|
|
+ productNameList=['']
|
|
|
+ timeList = this.chartData.map(item=>{
|
|
|
+ return item[relation.x]
|
|
|
+ })
|
|
|
+ data[0].data = this.chartData.map(item=>{
|
|
|
+ return item[relation.y]
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+ // this.chartData.forEach(item => {
|
|
|
+ // productNameList.push(item.productName)
|
|
|
+ // data.push({
|
|
|
+ // name:item.productName,
|
|
|
+ // type:'line',
|
|
|
+ // connectNulls:true,
|
|
|
+ // saleVOS:item.saleVOS,
|
|
|
+ // data:[]
|
|
|
+ // })
|
|
|
+ // item.saleVOS.forEach(item1=>{
|
|
|
+ // var index = timeList.findIndex(i=>{
|
|
|
+ // return item1[relation.x] == i
|
|
|
+ // })
|
|
|
+ // if(index == -1){
|
|
|
+ // timeList.push(item1[relation.x])
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // });
|
|
|
+ // timeList = timeList.sort((a,b)=>{
|
|
|
+ // if(timeUnit == 0){
|
|
|
+ // return Date.parse(a.replace(/-/g, "/")) - Date.parse(b.replace(/-/g, "/"))
|
|
|
+ // }else if(timeUnit==1){
|
|
|
+ // return Date.parse(a.match(/(\d{1,3})+(?:\.\d+)?/g).join('/'))-Date.parse(b.match(/(\d{1,3})+(?:\.\d+)?/g).join('/'))
|
|
|
+ // }else{
|
|
|
+ // return Date.parse(a.substring(0,a.length-1))-Date.parse(b.substring(0,b.length-1))
|
|
|
+ // }
|
|
|
+ // }),
|
|
|
+ // data.forEach(item=>{
|
|
|
+ // if(item.saleVOS && item.saleVOS.length>0){
|
|
|
+ // item.saleVOS.forEach(item2=>{
|
|
|
+ // var index = timeList.findIndex(i=>{
|
|
|
+ // return item2[relation.x] == i
|
|
|
+ // })
|
|
|
+ // item.data[index] = item2[relation.y]
|
|
|
+ // })
|
|
|
+ // }
|
|
|
|
|
|
- });
|
|
|
+ // });
|
|
|
|
|
|
this.selected = {
|
|
|
x:timeList,
|
|
@@ -189,7 +207,7 @@ export default {
|
|
|
this.setColor()
|
|
|
}
|
|
|
|
|
|
- // console.log(this.selected)
|
|
|
+ console.log(this.selected)
|
|
|
let {backgroundColor, title, legend, xAxis, yAxis, series, grid,toolbox } = this.get2AxisOption('line', '')
|
|
|
// console.log(legend, xAxis, yAxis, series, grid)
|
|
|
return {
|