Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
datax-cloud
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄营
datax-cloud
Commits
7d3387cb
Commit
7d3387cb
authored
Dec 01, 2020
by
yuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
项目初始化
parent
b8f29b48
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
357 additions
and
55 deletions
+357
-55
ChartDto.java
...n/java/cn/datax/service/data/visual/api/dto/ChartDto.java
+1
-2
ChartEntity.java
.../cn/datax/service/data/visual/api/entity/ChartEntity.java
+2
-4
ChartVo.java
...ain/java/cn/datax/service/data/visual/api/vo/ChartVo.java
+1
-2
ChartMapper.xml
...-visual-service/src/main/resources/mapper/ChartMapper.xml
+1
-1
package.json
datax-ui/package.json
+1
-1
index.vue
datax-ui/src/components/PivotTable/index.vue
+4
-2
DataBoardBuild.vue
datax-ui/src/views/visual/databoard/DataBoardBuild.vue
+15
-8
DataBoardView.vue
datax-ui/src/views/visual/databoard/DataBoardView.vue
+14
-9
DataChartBuild.vue
datax-ui/src/views/visual/datachart/DataChartBuild.vue
+3
-3
ChartBar.vue
...rc/views/visual/datachart/components/widgets/ChartBar.vue
+3
-2
ChartFunnel.vue
...views/visual/datachart/components/widgets/ChartFunnel.vue
+4
-3
ChartGauge.vue
.../views/visual/datachart/components/widgets/ChartGauge.vue
+2
-2
ChartLine.vue
...c/views/visual/datachart/components/widgets/ChartLine.vue
+3
-2
ChartLiquidFill.vue
...s/visual/datachart/components/widgets/ChartLiquidFill.vue
+2
-2
ChartPie.vue
...rc/views/visual/datachart/components/widgets/ChartPie.vue
+3
-2
ChartRadar.vue
.../views/visual/datachart/components/widgets/ChartRadar.vue
+3
-2
ChartSankey.vue
...views/visual/datachart/components/widgets/ChartSankey.vue
+3
-2
ChartScatter.vue
...iews/visual/datachart/components/widgets/ChartScatter.vue
+3
-2
ChartTreemap.vue
...iews/visual/datachart/components/widgets/ChartTreemap.vue
+286
-2
ChartWordCloud.vue
...ws/visual/datachart/components/widgets/ChartWordCloud.vue
+3
-2
No files found.
datax-modules/data-visual-service-parent/data-visual-service-api/src/main/java/cn/datax/service/data/visual/api/dto/ChartDto.java
View file @
7d3387cb
...
@@ -32,6 +32,5 @@ public class ChartDto implements Serializable {
...
@@ -32,6 +32,5 @@ public class ChartDto implements Serializable {
@ApiModelProperty
(
value
=
"图表缩略图(图片base64)"
)
@ApiModelProperty
(
value
=
"图表缩略图(图片base64)"
)
private
String
chartThumbnail
;
private
String
chartThumbnail
;
@ApiModelProperty
(
value
=
"图表配置"
)
@ApiModelProperty
(
value
=
"图表配置"
)
@Valid
private
String
chartConfig
;
private
ChartConfig
chartConfig
;
}
}
datax-modules/data-visual-service-parent/data-visual-service-api/src/main/java/cn/datax/service/data/visual/api/entity/ChartEntity.java
View file @
7d3387cb
package
cn
.
datax
.
service
.
data
.
visual
.
api
.
entity
;
package
cn
.
datax
.
service
.
data
.
visual
.
api
.
entity
;
import
cn.datax.common.base.DataScopeBaseEntity
;
import
cn.datax.common.base.DataScopeBaseEntity
;
import
cn.datax.service.data.visual.api.dto.ChartConfig
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
lombok.experimental.Accessors
;
...
@@ -38,6 +36,6 @@ public class ChartEntity extends DataScopeBaseEntity {
...
@@ -38,6 +36,6 @@ public class ChartEntity extends DataScopeBaseEntity {
/**
/**
* 图表配置
* 图表配置
*/
*/
@TableField
(
value
=
"chart_json"
,
typeHandler
=
JacksonTypeHandler
.
class
)
@TableField
(
value
=
"chart_json"
)
private
ChartConfi
g
chartConfig
;
private
Strin
g
chartConfig
;
}
}
datax-modules/data-visual-service-parent/data-visual-service-api/src/main/java/cn/datax/service/data/visual/api/vo/ChartVo.java
View file @
7d3387cb
package
cn
.
datax
.
service
.
data
.
visual
.
api
.
vo
;
package
cn
.
datax
.
service
.
data
.
visual
.
api
.
vo
;
import
cn.datax.service.data.visual.api.dto.ChartConfig
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -27,5 +26,5 @@ public class ChartVo implements Serializable {
...
@@ -27,5 +26,5 @@ public class ChartVo implements Serializable {
private
String
remark
;
private
String
remark
;
private
String
chartName
;
private
String
chartName
;
private
String
chartThumbnail
;
private
String
chartThumbnail
;
private
ChartConfi
g
chartConfig
;
private
Strin
g
chartConfig
;
}
}
datax-modules/data-visual-service-parent/data-visual-service/src/main/resources/mapper/ChartMapper.xml
View file @
7d3387cb
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
</resultMap>
</resultMap>
<resultMap
id=
"ExtendResultMap"
type=
"cn.datax.service.data.visual.api.entity.ChartEntity"
extends=
"BaseResultMap"
>
<resultMap
id=
"ExtendResultMap"
type=
"cn.datax.service.data.visual.api.entity.ChartEntity"
extends=
"BaseResultMap"
>
<result
column=
"chart_json"
property=
"chartConfig"
typeHandler=
"com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"
/>
<result
column=
"chart_json"
property=
"chartConfig"
/>
</resultMap>
</resultMap>
<!-- 通用查询结果列 -->
<!-- 通用查询结果列 -->
...
...
datax-ui/package.json
View file @
7d3387cb
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
"sql-formatter"
:
"^2.3.3"
,
"sql-formatter"
:
"^2.3.3"
,
"vue"
:
"2.6.10"
,
"vue"
:
"2.6.10"
,
"vue-codemirror"
:
"^4.0.6"
,
"vue-codemirror"
:
"^4.0.6"
,
"vue-grid-layout"
:
"^2.3.
8
"
,
"vue-grid-layout"
:
"^2.3.
11
"
,
"vue-router"
:
"3.0.6"
,
"vue-router"
:
"3.0.6"
,
"vuedraggable"
:
"^2.24.0"
,
"vuedraggable"
:
"^2.24.0"
,
"vuex"
:
"3.1.0"
"vuex"
:
"3.1.0"
...
...
datax-ui/src/components/PivotTable/index.vue
View file @
7d3387cb
...
@@ -76,6 +76,7 @@ export default {
...
@@ -76,6 +76,7 @@ export default {
},
},
rowPaths
()
{
rowPaths
()
{
const
_paths
=
this
.
_combineRowPaths
(
const
_paths
=
this
.
_combineRowPaths
(
this
.
localData
,
...
this
.
localRows
.
map
(({
key
,
values
})
=>
{
return
{
key
,
values
}
})
...
this
.
localRows
.
map
(({
key
,
values
})
=>
{
return
{
key
,
values
}
})
)
)
return
_paths
return
_paths
...
@@ -389,6 +390,7 @@ export default {
...
@@ -389,6 +390,7 @@ export default {
handleCalcData
()
{
handleCalcData
()
{
if
(
!
this
.
localValues
.
length
)
return
if
(
!
this
.
localValues
.
length
)
return
const
_rowPaths
=
this
.
_combineRowPaths
(
const
_rowPaths
=
this
.
_combineRowPaths
(
this
.
localData
,
...
this
.
localRows
.
map
(({
key
,
values
})
=>
{
return
{
key
,
values
}
})
...
this
.
localRows
.
map
(({
key
,
values
})
=>
{
return
{
key
,
values
}
})
)
)
const
_rowKeys
=
this
.
localRows
.
map
(({
key
})
=>
key
)
const
_rowKeys
=
this
.
localRows
.
map
(({
key
})
=>
key
)
...
@@ -428,7 +430,7 @@ export default {
...
@@ -428,7 +430,7 @@ export default {
.
flat
()
.
flat
()
)
)
},
},
_combineRowPaths
(...
arrays
)
{
_combineRowPaths
(
data
,
...
arrays
)
{
const
len
=
arrays
.
length
const
len
=
arrays
.
length
let
_result
=
[]
let
_result
=
[]
if
(
len
)
{
if
(
len
)
{
...
@@ -444,7 +446,7 @@ export default {
...
@@ -444,7 +446,7 @@ export default {
})
})
conditions
[
currKey
]
=
_currEl
conditions
[
currKey
]
=
_currEl
// 判断数据里是否有该项
// 判断数据里是否有该项
const
filter
=
this
.
localD
ata
.
some
((
data
)
=>
{
const
filter
=
d
ata
.
some
((
data
)
=>
{
let
status
=
true
let
status
=
true
for
(
const
key
in
conditions
)
{
for
(
const
key
in
conditions
)
{
if
(
conditions
[
key
]
!==
data
[
key
])
{
if
(
conditions
[
key
]
!==
data
[
key
])
{
...
...
datax-ui/src/views/visual/databoard/DataBoardBuild.vue
View file @
7d3387cb
...
@@ -41,6 +41,7 @@
...
@@ -41,6 +41,7 @@
:is-mirrored=
"false"
:is-mirrored=
"false"
:vertical-compact=
"true"
:vertical-compact=
"true"
:use-css-transforms=
"true"
:use-css-transforms=
"true"
:pane-container=
"false"
:margin=
"[10, 10]"
:margin=
"[10, 10]"
style=
"border: 1px dashed #999; height: 100%; overflow-x: hidden; overflow-y: auto;"
style=
"border: 1px dashed #999; height: 100%; overflow-x: hidden; overflow-y: auto;"
>
>
...
@@ -63,7 +64,7 @@
...
@@ -63,7 +64,7 @@
<i
class=
"el-icon-delete"
@
click=
"handleDeleteChart(item.i)"
/>
<i
class=
"el-icon-delete"
@
click=
"handleDeleteChart(item.i)"
/>
</div>
</div>
</div>
</div>
<chart-panel
v-if=
"getChartItem(item.i).visible"
:key=
"item.i"
:ref=
"`charts$
{item.i}`" :chart-schema="getChartItem(item.i).chart
Config
" :chart-data="getChartItem(item.i).data" :chart-style="{height: `${item.h * 30 + 10 * (item.h - 1) - 60}px`}" />
<chart-panel
v-if=
"getChartItem(item.i).visible"
:key=
"item.i"
:ref=
"`charts$
{item.i}`" :chart-schema="getChartItem(item.i).chart
Schema
" :chart-data="getChartItem(item.i).data" :chart-style="{height: `${item.h * 30 + 10 * (item.h - 1) - 60}px`}" />
<div
v-else
:style=
"
{height: `${item.h * 30 + 10 * (item.h - 1) - 60}px`}">
</div>
<div
v-else
:style=
"
{height: `${item.h * 30 + 10 * (item.h - 1) - 60}px`}">
</div>
</el-card>
</el-card>
</grid-item>
</grid-item>
...
@@ -136,13 +137,18 @@ export default {
...
@@ -136,13 +137,18 @@ export default {
},
},
parserChart
(
chart
)
{
parserChart
(
chart
)
{
this
.
$set
(
chart
,
'loading'
,
true
)
this
.
$set
(
chart
,
'loading'
,
true
)
dataParser
(
chart
.
chartConfig
).
then
(
response
=>
{
if
(
chart
.
chartConfig
)
{
if
(
response
.
success
)
{
dataParser
(
JSON
.
parse
(
chart
.
chartConfig
)).
then
(
response
=>
{
this
.
$set
(
chart
,
'visible'
,
true
)
if
(
response
.
success
)
{
this
.
$set
(
chart
,
'loading'
,
false
)
this
.
$set
(
chart
,
'data'
,
response
.
data
.
data
)
this
.
$set
(
chart
,
'data'
,
response
.
data
.
data
)
this
.
$set
(
chart
,
'chartSchema'
,
JSON
.
parse
(
chart
.
chartConfig
))
}
this
.
$set
(
chart
,
'loading'
,
false
)
})
this
.
$set
(
chart
,
'visible'
,
true
)
}
})
}
else
{
this
.
$set
(
chart
,
'loading'
,
false
)
}
},
},
getChartItem
(
id
)
{
getChartItem
(
id
)
{
return
this
.
charts
.
find
(
chart
=>
chart
.
id
===
id
)
return
this
.
charts
.
find
(
chart
=>
chart
.
id
===
id
)
...
@@ -220,6 +226,7 @@ export default {
...
@@ -220,6 +226,7 @@ export default {
window
.
close
()
window
.
close
()
},
},
handleResize
(
i
,
newH
,
newW
,
newHPx
,
newWPx
)
{
handleResize
(
i
,
newH
,
newW
,
newHPx
,
newWPx
)
{
console
.
log
(
'handleResize'
,
i
)
if
(
this
.
charts
.
find
(
chart
=>
chart
.
id
===
i
).
visible
)
{
if
(
this
.
charts
.
find
(
chart
=>
chart
.
id
===
i
).
visible
)
{
this
.
$refs
[
`charts
${
i
}
`
][
0
].
$children
[
0
].
$emit
(
'resized'
)
this
.
$refs
[
`charts
${
i
}
`
][
0
].
$children
[
0
].
$emit
(
'resized'
)
}
}
...
...
datax-ui/src/views/visual/databoard/DataBoardView.vue
View file @
7d3387cb
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
<span>
{{
getChartItem
(
item
.
i
).
chartName
}}
</span>
<span>
{{
getChartItem
(
item
.
i
).
chartName
}}
</span>
</div>
</div>
</div>
</div>
<chart-panel
v-if=
"getChartItem(item.i).visible"
:key=
"item.i"
:ref=
"`charts$
{item.i}`" :chart-schema="getChartItem(item.i).chart
Config
" :chart-data="getChartItem(item.i).data" :chart-style="{height: `${item.h * 30 + 10 * (item.h - 1) - 60}px`}" />
<chart-panel
v-if=
"getChartItem(item.i).visible"
:key=
"item.i"
:ref=
"`charts$
{item.i}`" :chart-schema="getChartItem(item.i).chart
Schema
" :chart-data="getChartItem(item.i).data" :chart-style="{height: `${item.h * 30 + 10 * (item.h - 1) - 60}px`}" />
<div
v-else
:style=
"
{height: `${item.h * 30 + 10 * (item.h - 1) - 60}px`}">
</div>
<div
v-else
:style=
"
{height: `${item.h * 30 + 10 * (item.h - 1) - 60}px`}">
</div>
</el-card>
</el-card>
</grid-item>
</grid-item>
...
@@ -69,7 +69,7 @@ export default {
...
@@ -69,7 +69,7 @@ export default {
if
(
response
.
success
)
{
if
(
response
.
success
)
{
this
.
dataBoard
=
response
.
data
this
.
dataBoard
=
response
.
data
this
.
layout
=
this
.
dataBoard
.
boardConfig
?
JSON
.
parse
(
JSON
.
stringify
(
this
.
dataBoard
.
boardConfig
.
layout
))
:
[]
this
.
layout
=
this
.
dataBoard
.
boardConfig
?
JSON
.
parse
(
JSON
.
stringify
(
this
.
dataBoard
.
boardConfig
.
layout
))
:
[]
const
charts
=
this
.
dataBoard
.
charts
const
charts
=
this
.
dataBoard
.
charts
?
JSON
.
parse
(
JSON
.
stringify
(
this
.
dataBoard
.
charts
))
:
[]
charts
.
forEach
((
item
,
index
,
arr
)
=>
{
charts
.
forEach
((
item
,
index
,
arr
)
=>
{
this
.
parserChart
(
item
)
this
.
parserChart
(
item
)
})
})
...
@@ -79,13 +79,18 @@ export default {
...
@@ -79,13 +79,18 @@ export default {
},
},
parserChart
(
chart
)
{
parserChart
(
chart
)
{
this
.
$set
(
chart
,
'loading'
,
true
)
this
.
$set
(
chart
,
'loading'
,
true
)
dataParser
(
chart
.
chartConfig
).
then
(
response
=>
{
if
(
chart
.
chartConfig
)
{
if
(
response
.
success
)
{
dataParser
(
JSON
.
parse
(
chart
.
chartConfig
)).
then
(
response
=>
{
this
.
$set
(
chart
,
'visible'
,
true
)
if
(
response
.
success
)
{
this
.
$set
(
chart
,
'loading'
,
false
)
this
.
$set
(
chart
,
'data'
,
response
.
data
.
data
)
this
.
$set
(
chart
,
'data'
,
response
.
data
.
data
)
this
.
$set
(
chart
,
'chartSchema'
,
JSON
.
parse
(
chart
.
chartConfig
))
}
this
.
$set
(
chart
,
'loading'
,
false
)
})
this
.
$set
(
chart
,
'visible'
,
true
)
}
})
}
else
{
this
.
$set
(
chart
,
'loading'
,
false
)
}
},
},
getChartItem
(
id
)
{
getChartItem
(
id
)
{
return
this
.
charts
.
find
(
chart
=>
chart
.
id
===
id
)
return
this
.
charts
.
find
(
chart
=>
chart
.
id
===
id
)
...
...
datax-ui/src/views/visual/datachart/DataChartBuild.vue
View file @
7d3387cb
...
@@ -245,7 +245,7 @@ export default {
...
@@ -245,7 +245,7 @@ export default {
rows
:
[],
rows
:
[],
columns
:
[],
columns
:
[],
measures
:
[],
measures
:
[],
//
后期添加条件过滤
//
过滤条件
filters
:
[],
filters
:
[],
// 图表配置项
// 图表配置项
options
:
chartOptions
,
options
:
chartOptions
,
...
@@ -280,7 +280,7 @@ export default {
...
@@ -280,7 +280,7 @@ export default {
if
(
response
.
success
)
{
if
(
response
.
success
)
{
this
.
dataChart
=
response
.
data
this
.
dataChart
=
response
.
data
if
(
this
.
dataChart
.
chartConfig
)
{
if
(
this
.
dataChart
.
chartConfig
)
{
const
chartConfig
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
dataChart
.
chartConfig
)
)
const
chartConfig
=
JSON
.
parse
(
this
.
dataChart
.
chartConfig
)
getDataSet
(
chartConfig
.
dataSetId
).
then
(
response
=>
{
getDataSet
(
chartConfig
.
dataSetId
).
then
(
response
=>
{
if
(
response
.
success
)
{
if
(
response
.
success
)
{
this
.
dataSet
=
response
.
data
this
.
dataSet
=
response
.
data
...
@@ -359,7 +359,7 @@ export default {
...
@@ -359,7 +359,7 @@ export default {
const
data
=
{
const
data
=
{
id
:
this
.
dataChart
.
id
,
id
:
this
.
dataChart
.
id
,
chartThumbnail
:
this
.
dataChart
.
chartThumbnail
,
chartThumbnail
:
this
.
dataChart
.
chartThumbnail
,
chartConfig
:
this
.
widget
chartConfig
:
JSON
.
stringify
(
this
.
widget
)
}
}
buildDataChart
(
data
).
then
(
response
=>
{
buildDataChart
(
data
).
then
(
response
=>
{
if
(
response
.
success
)
{
if
(
response
.
success
)
{
...
...
datax-ui/src/views/visual/datachart/components/widgets/ChartBar.vue
View file @
7d3387cb
...
@@ -153,6 +153,7 @@ export default {
...
@@ -153,6 +153,7 @@ export default {
handleCalcData
()
{
handleCalcData
()
{
if
(
!
this
.
localRows
.
length
||
!
this
.
localValues
.
length
)
return
if
(
!
this
.
localRows
.
length
||
!
this
.
localValues
.
length
)
return
const
_rowPaths
=
this
.
_combineRowPaths
(
const
_rowPaths
=
this
.
_combineRowPaths
(
this
.
localData
,
...
this
.
localRows
.
map
(({
key
,
values
})
=>
{
return
{
key
,
values
}
})
...
this
.
localRows
.
map
(({
key
,
values
})
=>
{
return
{
key
,
values
}
})
)
)
const
_rowKeys
=
this
.
localRows
.
map
(({
key
})
=>
key
)
const
_rowKeys
=
this
.
localRows
.
map
(({
key
})
=>
key
)
...
@@ -324,7 +325,7 @@ export default {
...
@@ -324,7 +325,7 @@ export default {
option
.
xAxis
.
max
=
100
option
.
xAxis
.
max
=
100
}
}
},
},
_combineRowPaths
(...
arrays
)
{
_combineRowPaths
(
data
,
...
arrays
)
{
const
len
=
arrays
.
length
const
len
=
arrays
.
length
let
_result
=
[]
let
_result
=
[]
if
(
len
)
{
if
(
len
)
{
...
@@ -340,7 +341,7 @@ export default {
...
@@ -340,7 +341,7 @@ export default {
})
})
conditions
[
currKey
]
=
_currEl
conditions
[
currKey
]
=
_currEl
// 判断数据里是否有该项
// 判断数据里是否有该项
const
filter
=
this
.
localD
ata
.
some
((
data
)
=>
{
const
filter
=
d
ata
.
some
((
data
)
=>
{
let
status
=
true
let
status
=
true
for
(
const
key
in
conditions
)
{
for
(
const
key
in
conditions
)
{
if
(
conditions
[
key
]
!==
data
[
key
])
{
if
(
conditions
[
key
]
!==
data
[
key
])
{
...
...
datax-ui/src/views/visual/datachart/components/widgets/ChartFunnel.vue
View file @
7d3387cb
...
@@ -148,8 +148,9 @@ export default {
...
@@ -148,8 +148,9 @@ export default {
},
},
// 计算值
// 计算值
handleCalcData
()
{
handleCalcData
()
{
if
(
!
this
.
local
Rows
.
length
||
!
this
.
local
Values
.
length
)
return
if
(
!
this
.
localValues
.
length
)
return
const
_rowPaths
=
this
.
_combineRowPaths
(
const
_rowPaths
=
this
.
_combineRowPaths
(
this
.
localData
,
...
this
.
localRows
.
map
(({
key
,
values
})
=>
{
return
{
key
,
values
}
})
...
this
.
localRows
.
map
(({
key
,
values
})
=>
{
return
{
key
,
values
}
})
)
)
const
_rowKeys
=
this
.
localRows
.
map
(({
key
})
=>
key
)
const
_rowKeys
=
this
.
localRows
.
map
(({
key
})
=>
key
)
...
@@ -301,7 +302,7 @@ export default {
...
@@ -301,7 +302,7 @@ export default {
return
params
.
seriesName
+
' <br/>'
+
params
.
name
+
' : '
+
params
.
value
+
'<br>'
+
params
.
percent
+
'%'
return
params
.
seriesName
+
' <br/>'
+
params
.
name
+
' : '
+
params
.
value
+
'<br>'
+
params
.
percent
+
'%'
}
}
},
},
_combineRowPaths
(...
arrays
)
{
_combineRowPaths
(
data
,
...
arrays
)
{
const
len
=
arrays
.
length
const
len
=
arrays
.
length
let
_result
=
[]
let
_result
=
[]
if
(
len
)
{
if
(
len
)
{
...
@@ -317,7 +318,7 @@ export default {
...
@@ -317,7 +318,7 @@ export default {
})
})
conditions
[
currKey
]
=
_currEl
conditions
[
currKey
]
=
_currEl
// 判断数据里是否有该项
// 判断数据里是否有该项
const
filter
=
this
.
localD
ata
.
some
((
data
)
=>
{
const
filter
=
d
ata
.
some
((
data
)
=>
{
let
status
=
true
let
status
=
true
for
(
const
key
in
conditions
)
{
for
(
const
key
in
conditions
)
{
if
(
conditions
[
key
]
!==
data
[
key
])
{
if
(
conditions
[
key
]
!==
data
[
key
])
{
...
...
datax-ui/src/views/visual/datachart/components/widgets/ChartGauge.vue
View file @
7d3387cb
...
@@ -207,7 +207,7 @@ export default {
...
@@ -207,7 +207,7 @@ export default {
this
.
chart
.
setOption
(
option
,
true
)
this
.
chart
.
setOption
(
option
,
true
)
}
}
},
},
_combineRowPaths
(...
arrays
)
{
_combineRowPaths
(
data
,
...
arrays
)
{
const
len
=
arrays
.
length
const
len
=
arrays
.
length
let
_result
=
[]
let
_result
=
[]
if
(
len
)
{
if
(
len
)
{
...
@@ -223,7 +223,7 @@ export default {
...
@@ -223,7 +223,7 @@ export default {
})
})
conditions
[
currKey
]
=
_currEl
conditions
[
currKey
]
=
_currEl
// 判断数据里是否有该项
// 判断数据里是否有该项
const
filter
=
this
.
localD
ata
.
some
((
data
)
=>
{
const
filter
=
d
ata
.
some
((
data
)
=>
{
let
status
=
true
let
status
=
true
for
(
const
key
in
conditions
)
{
for
(
const
key
in
conditions
)
{
if
(
conditions
[
key
]
!==
data
[
key
])
{
if
(
conditions
[
key
]
!==
data
[
key
])
{
...
...
datax-ui/src/views/visual/datachart/components/widgets/ChartLine.vue
View file @
7d3387cb
...
@@ -153,6 +153,7 @@ export default {
...
@@ -153,6 +153,7 @@ export default {
handleCalcData
()
{
handleCalcData
()
{
if
(
!
this
.
localRows
.
length
||
!
this
.
localValues
.
length
)
return
if
(
!
this
.
localRows
.
length
||
!
this
.
localValues
.
length
)
return
const
_rowPaths
=
this
.
_combineRowPaths
(
const
_rowPaths
=
this
.
_combineRowPaths
(
this
.
localData
,
...
this
.
localRows
.
map
(({
key
,
values
})
=>
{
return
{
key
,
values
}
})
...
this
.
localRows
.
map
(({
key
,
values
})
=>
{
return
{
key
,
values
}
})
)
)
const
_rowKeys
=
this
.
localRows
.
map
(({
key
})
=>
key
)
const
_rowKeys
=
this
.
localRows
.
map
(({
key
})
=>
key
)
...
@@ -312,7 +313,7 @@ export default {
...
@@ -312,7 +313,7 @@ export default {
// }
// }
}
}
},
},
_combineRowPaths(...arrays) {
_combineRowPaths(
data,
...arrays) {
const len = arrays.length
const len = arrays.length
let _result = []
let _result = []
if (len) {
if (len) {
...
@@ -328,7 +329,7 @@ export default {
...
@@ -328,7 +329,7 @@ export default {
})
})
conditions[currKey] = _currEl
conditions[currKey] = _currEl
// 判断数据里是否有该项
// 判断数据里是否有该项
const filter =
this.localD
ata.some((data) => {
const filter =
d
ata.some((data) => {
let status = true
let status = true
for (const key in conditions) {
for (const key in conditions) {
if (conditions[key] !== data[key]) {
if (conditions[key] !== data[key]) {
...
...
datax-ui/src/views/visual/datachart/components/widgets/ChartLiquidFill.vue
View file @
7d3387cb
...
@@ -246,7 +246,7 @@ export default {
...
@@ -246,7 +246,7 @@ export default {
})
})
}
}
},
},
_combineRowPaths
(...
arrays
)
{
_combineRowPaths
(
data
,
...
arrays
)
{
const
len
=
arrays
.
length
const
len
=
arrays
.
length
let
_result
=
[]
let
_result
=
[]
if
(
len
)
{
if
(
len
)
{
...
@@ -262,7 +262,7 @@ export default {
...
@@ -262,7 +262,7 @@ export default {
})
})
conditions
[
currKey
]
=
_currEl
conditions
[
currKey
]
=
_currEl
// 判断数据里是否有该项
// 判断数据里是否有该项
const
filter
=
this
.
localD
ata
.
some
((
data
)
=>
{
const
filter
=
d
ata
.
some
((
data
)
=>
{
let
status
=
true
let
status
=
true
for
(
const
key
in
conditions
)
{
for
(
const
key
in
conditions
)
{
if
(
conditions
[
key
]
!==
data
[
key
])
{
if
(
conditions
[
key
]
!==
data
[
key
])
{
...
...
datax-ui/src/views/visual/datachart/components/widgets/ChartPie.vue
View file @
7d3387cb
...
@@ -150,6 +150,7 @@ export default {
...
@@ -150,6 +150,7 @@ export default {
handleCalcData
()
{
handleCalcData
()
{
if
(
!
this
.
localRows
.
length
||
!
this
.
localValues
.
length
)
return
if
(
!
this
.
localRows
.
length
||
!
this
.
localValues
.
length
)
return
const
_rowPaths
=
this
.
_combineRowPaths
(
const
_rowPaths
=
this
.
_combineRowPaths
(
this
.
localData
,
...
this
.
localRows
.
map
(({
key
,
values
})
=>
{
return
{
key
,
values
}
})
...
this
.
localRows
.
map
(({
key
,
values
})
=>
{
return
{
key
,
values
}
})
)
)
const
_rowKeys
=
this
.
localRows
.
map
(({
key
})
=>
key
)
const
_rowKeys
=
this
.
localRows
.
map
(({
key
})
=>
key
)
...
@@ -279,7 +280,7 @@ export default {
...
@@ -279,7 +280,7 @@ export default {
})
})
}
}
},
},
_combineRowPaths
(...
arrays
)
{
_combineRowPaths
(
data
,
...
arrays
)
{
const
len
=
arrays
.
length
const
len
=
arrays
.
length
let
_result
=
[]
let
_result
=
[]
if
(
len
)
{
if
(
len
)
{
...
@@ -295,7 +296,7 @@ export default {
...
@@ -295,7 +296,7 @@ export default {
})
})
conditions
[
currKey
]
=
_currEl
conditions
[
currKey
]
=
_currEl
// 判断数据里是否有该项
// 判断数据里是否有该项
const
filter
=
this
.
localD
ata
.
some
((
data
)
=>
{
const
filter
=
d
ata
.
some
((
data
)
=>
{
let
status
=
true
let
status
=
true
for
(
const
key
in
conditions
)
{
for
(
const
key
in
conditions
)
{
if
(
conditions
[
key
]
!==
data
[
key
])
{
if
(
conditions
[
key
]
!==
data
[
key
])
{
...
...
datax-ui/src/views/visual/datachart/components/widgets/ChartRadar.vue
View file @
7d3387cb
...
@@ -152,6 +152,7 @@ export default {
...
@@ -152,6 +152,7 @@ export default {
handleCalcData
()
{
handleCalcData
()
{
if
(
!
this
.
localRows
.
length
||
!
this
.
localValues
.
length
)
return
if
(
!
this
.
localRows
.
length
||
!
this
.
localValues
.
length
)
return
const
_rowPaths
=
this
.
_combineRowPaths
(
const
_rowPaths
=
this
.
_combineRowPaths
(
this
.
localData
,
...
this
.
localRows
.
map
(({
key
,
values
})
=>
{
return
{
key
,
values
}
})
...
this
.
localRows
.
map
(({
key
,
values
})
=>
{
return
{
key
,
values
}
})
)
)
const
_rowKeys
=
this
.
localRows
.
map
(({
key
})
=>
key
)
const
_rowKeys
=
this
.
localRows
.
map
(({
key
})
=>
key
)
...
@@ -276,7 +277,7 @@ export default {
...
@@ -276,7 +277,7 @@ export default {
})
})
}
}
},
},
_combineRowPaths
(...
arrays
)
{
_combineRowPaths
(
data
,
...
arrays
)
{
const
len
=
arrays
.
length
const
len
=
arrays
.
length
let
_result
=
[]
let
_result
=
[]
if
(
len
)
{
if
(
len
)
{
...
@@ -292,7 +293,7 @@ export default {
...
@@ -292,7 +293,7 @@ export default {
})
})
conditions
[
currKey
]
=
_currEl
conditions
[
currKey
]
=
_currEl
// 判断数据里是否有该项
// 判断数据里是否有该项
const
filter
=
this
.
localD
ata
.
some
((
data
)
=>
{
const
filter
=
d
ata
.
some
((
data
)
=>
{
let
status
=
true
let
status
=
true
for
(
const
key
in
conditions
)
{
for
(
const
key
in
conditions
)
{
if
(
conditions
[
key
]
!==
data
[
key
])
{
if
(
conditions
[
key
]
!==
data
[
key
])
{
...
...
datax-ui/src/views/visual/datachart/components/widgets/ChartSankey.vue
View file @
7d3387cb
...
@@ -141,6 +141,7 @@ export default {
...
@@ -141,6 +141,7 @@ export default {
handleCalcData
()
{
handleCalcData
()
{
if
(
!
this
.
localRows
.
length
||
!
this
.
localValues
.
length
)
return
if
(
!
this
.
localRows
.
length
||
!
this
.
localValues
.
length
)
return
const
_rowPaths
=
this
.
_combineRowPaths
(
const
_rowPaths
=
this
.
_combineRowPaths
(
this
.
localData
,
...
this
.
localRows
.
map
(({
key
,
values
})
=>
{
return
{
key
,
values
}
})
...
this
.
localRows
.
map
(({
key
,
values
})
=>
{
return
{
key
,
values
}
})
)
)
const
_rowKeys
=
this
.
localRows
.
map
(({
key
})
=>
key
)
const
_rowKeys
=
this
.
localRows
.
map
(({
key
})
=>
key
)
...
@@ -268,7 +269,7 @@ export default {
...
@@ -268,7 +269,7 @@ export default {
this
.
chart
.
setOption
(
option
,
true
)
this
.
chart
.
setOption
(
option
,
true
)
}
}
},
},
_combineRowPaths
(...
arrays
)
{
_combineRowPaths
(
data
,
...
arrays
)
{
const
len
=
arrays
.
length
const
len
=
arrays
.
length
let
_result
=
[]
let
_result
=
[]
if
(
len
)
{
if
(
len
)
{
...
@@ -284,7 +285,7 @@ export default {
...
@@ -284,7 +285,7 @@ export default {
})
})
conditions
[
currKey
]
=
_currEl
conditions
[
currKey
]
=
_currEl
// 判断数据里是否有该项
// 判断数据里是否有该项
const
filter
=
this
.
localD
ata
.
some
((
data
)
=>
{
const
filter
=
d
ata
.
some
((
data
)
=>
{
let
status
=
true
let
status
=
true
for
(
const
key
in
conditions
)
{
for
(
const
key
in
conditions
)
{
if
(
conditions
[
key
]
!==
data
[
key
])
{
if
(
conditions
[
key
]
!==
data
[
key
])
{
...
...
datax-ui/src/views/visual/datachart/components/widgets/ChartScatter.vue
View file @
7d3387cb
...
@@ -145,6 +145,7 @@ export default {
...
@@ -145,6 +145,7 @@ export default {
handleCalcData
()
{
handleCalcData
()
{
if
(
!
this
.
localRows
.
length
||
!
this
.
localValues
.
length
)
return
if
(
!
this
.
localRows
.
length
||
!
this
.
localValues
.
length
)
return
const
_rowPaths
=
this
.
_combineRowPaths
(
const
_rowPaths
=
this
.
_combineRowPaths
(
this
.
localData
,
...
this
.
localRows
.
map
(({
key
,
values
})
=>
{
return
{
key
,
values
}
})
...
this
.
localRows
.
map
(({
key
,
values
})
=>
{
return
{
key
,
values
}
})
)
)
const
_rowKeys
=
this
.
localRows
.
map
(({
key
})
=>
key
)
const
_rowKeys
=
this
.
localRows
.
map
(({
key
})
=>
key
)
...
@@ -277,7 +278,7 @@ export default {
...
@@ -277,7 +278,7 @@ export default {
this
.
chart
.
setOption
(
option
,
true
)
this
.
chart
.
setOption
(
option
,
true
)
}
}
},
},
_combineRowPaths
(...
arrays
)
{
_combineRowPaths
(
data
,
...
arrays
)
{
const
len
=
arrays
.
length
const
len
=
arrays
.
length
let
_result
=
[]
let
_result
=
[]
if
(
len
)
{
if
(
len
)
{
...
@@ -293,7 +294,7 @@ export default {
...
@@ -293,7 +294,7 @@ export default {
})
})
conditions
[
currKey
]
=
_currEl
conditions
[
currKey
]
=
_currEl
// 判断数据里是否有该项
// 判断数据里是否有该项
const
filter
=
this
.
localD
ata
.
some
((
data
)
=>
{
const
filter
=
d
ata
.
some
((
data
)
=>
{
let
status
=
true
let
status
=
true
for
(
const
key
in
conditions
)
{
for
(
const
key
in
conditions
)
{
if
(
conditions
[
key
]
!==
data
[
key
])
{
if
(
conditions
[
key
]
!==
data
[
key
])
{
...
...
datax-ui/src/views/visual/datachart/components/widgets/ChartTreemap.vue
View file @
7d3387cb
...
@@ -3,6 +3,9 @@
...
@@ -3,6 +3,9 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
echarts
from
'echarts'
import
{
convertPathToMap
,
SEPARATOR
}
from
'@/utils/visual-chart'
export
default
{
export
default
{
name
:
'ChartTreemap'
,
name
:
'ChartTreemap'
,
props
:
{
props
:
{
...
@@ -32,7 +35,8 @@ export default {
...
@@ -32,7 +35,8 @@ export default {
},
},
chartTheme
:
{
chartTheme
:
{
type
:
String
,
type
:
String
,
require
:
true
require
:
true
,
default
:
'default'
},
},
chartOption
:
{
chartOption
:
{
type
:
Object
,
type
:
Object
,
...
@@ -49,8 +53,288 @@ export default {
...
@@ -49,8 +53,288 @@ export default {
}
}
}
}
},
},
data
()
{
return
{
localRows
:
[],
localColumns
:
[],
localValues
:
[],
localData
:
[],
// 连接符
connector
:
'-'
,
chart
:
null
,
calcOption
:
{
tooltip
:
{
trigger
:
'item'
,
formatter
:
'{b} : {c}'
}
},
calcData
:
{
seriesObj
:
{}
}
}
},
computed
:
{
watchAllProps
()
{
const
{
rows
,
columns
,
values
,
data
}
=
this
return
{
rows
,
columns
,
values
,
data
}
}
},
watch
:
{
watchAllProps
()
{
this
.
init
()
this
.
mergeChartOption
()
},
chartTheme
()
{
this
.
mergeChartTheme
()
},
chartOption
:
{
handler
(
newValue
,
oldValue
)
{
this
.
mergeChartOption
()
},
deep
:
true
}
},
mounted
()
{
this
.
renderChart
()
this
.
$on
(
'resized'
,
this
.
handleResize
)
window
.
addEventListener
(
'resize'
,
this
.
handleResize
)
},
created
()
{
created
()
{
console
.
log
(
this
.
data
)
this
.
init
()
},
beforeDestroy
()
{
if
(
this
.
chart
)
{
this
.
chart
.
dispose
()
}
window
.
removeEventListener
(
'resize'
,
this
.
handleResize
)
},
methods
:
{
init
()
{
if
(
this
.
rows
.
length
||
this
.
columns
.
length
||
this
.
values
.
length
)
{
this
.
handleDataClone
()
this
.
setValuesToColAndRow
()
this
.
handleCalcData
()
}
else
{
console
.
warn
(
'[Warn]: props.rows, props.columns, props.values at least one is not empty.'
)
}
},
// clone data
handleDataClone
()
{
this
.
localRows
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
rows
))
this
.
localColumns
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
columns
))
this
.
localValues
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
values
))
this
.
localData
=
Object
.
freeze
(
this
.
data
)
},
// set the `values` attribute to rows and columns
setValuesToColAndRow
()
{
const
rowKeys
=
this
.
localRows
.
map
(({
key
})
=>
key
)
const
columnKeys
=
this
.
localColumns
.
map
(({
key
})
=>
key
)
const
rowValues
=
this
.
_findCategory
(
rowKeys
,
this
.
localData
)
const
columnValues
=
this
.
_findCategory
(
columnKeys
,
this
.
localData
)
this
.
localRows
.
forEach
((
row
)
=>
{
const
{
key
,
values
}
=
row
this
.
$set
(
row
,
'values'
,
values
||
rowValues
[
key
]
||
[])
})
this
.
localColumns
.
forEach
((
column
)
=>
{
const
{
key
,
values
}
=
column
this
.
$set
(
column
,
'values'
,
values
||
columnValues
[
key
]
||
[])
})
},
// 计算值
handleCalcData
()
{
if
(
!
this
.
localRows
.
length
||
!
this
.
localValues
.
length
)
return
const
seriesData
=
this
.
recursion
(
0
,
{},
this
.
localRows
,
this
.
localValues
,
this
.
localData
)
const
seriesObj
=
{}
const
seriesName
=
'treemap'
seriesObj
[
seriesName
]
=
{
name
:
seriesName
,
type
:
this
.
chartType
,
leafDepth
:
1
,
visibleMin
:
1
,
label
:
{
position
:
'insideTopLeft'
},
data
:
seriesData
}
this
.
calcData
.
seriesObj
=
seriesObj
},
// 递归
recursion
(
depth
,
conditions
=
{},
rows
=
[],
values
=
[],
data
=
[])
{
const
_result
=
[]
if
(
depth
<
rows
.
length
)
{
const
row
=
rows
[
depth
]
row
.
values
.
forEach
((
val
)
=>
{
conditions
[
row
.
key
]
=
val
const
filters
=
Object
.
keys
(
conditions
)
.
filter
((
key
,
index
)
=>
index
<=
depth
)
.
reduce
((
obj
,
key
)
=>
{
obj
[
key
]
=
conditions
[
key
]
return
obj
},
{})
const
filterData
=
data
.
filter
((
item
)
=>
{
let
status
=
true
for
(
const
key
in
filters
)
{
if
(
filters
[
key
]
!==
item
[
key
])
{
status
=
false
return
}
}
return
status
})
if
(
filterData
.
length
)
{
if
(
depth
===
(
rows
.
length
-
1
))
{
values
.
forEach
(({
key
})
=>
{
const
value
=
this
.
_reduceValue
(
filterData
,
key
)
_result
.
push
({
name
:
val
,
value
:
value
})
})
}
else
{
_result
.
push
({
name
:
val
,
children
:
this
.
recursion
(
depth
+
1
,
conditions
,
rows
,
values
,
filterData
)
})
}
}
})
}
return
_result
},
handleResize
()
{
if
(
this
.
chart
)
{
this
.
chart
.
resize
()
}
},
renderChart
()
{
if
(
!
this
.
$refs
.
chart
)
return
let
option
=
Object
.
assign
({},
this
.
chartOption
,
this
.
calcOption
)
option
=
JSON
.
parse
(
JSON
.
stringify
(
option
))
const
series
=
JSON
.
parse
(
JSON
.
stringify
(
Object
.
values
(
this
.
calcData
.
seriesObj
)))
this
.
parseChartSeries
(
option
,
series
,
this
.
chartSeriesType
)
option
.
series
=
series
setTimeout
(()
=>
{
if
(
!
this
.
chart
)
{
if
(
this
.
chartTheme
!==
'default'
)
{
require
(
'./themes/'
+
this
.
chartTheme
+
'.js'
)
}
this
.
chart
=
echarts
.
init
(
this
.
$refs
.
chart
,
this
.
chartTheme
)
}
this
.
chart
.
clear
()
this
.
chart
.
setOption
(
option
)
},
0
)
},
mergeChartTheme
()
{
if
(
!
this
.
$refs
.
chart
)
return
if
(
this
.
chart
)
{
// 使用刚指定的配置项和数据显示图表
let
option
=
Object
.
assign
({},
this
.
chartOption
,
this
.
calcOption
)
option
=
JSON
.
parse
(
JSON
.
stringify
(
option
))
const
series
=
JSON
.
parse
(
JSON
.
stringify
(
Object
.
values
(
this
.
calcData
.
seriesObj
)))
this
.
parseChartSeries
(
option
,
series
,
this
.
chartSeriesType
)
option
.
series
=
series
if
(
this
.
chartTheme
!==
'default'
)
{
require
(
'./themes/'
+
this
.
chartTheme
+
'.js'
)
}
this
.
chart
.
dispose
()
// 基于准备好的dom,初始化echarts实例
this
.
chart
=
echarts
.
init
(
this
.
$refs
.
chart
,
this
.
chartTheme
)
this
.
chart
.
setOption
(
option
)
}
},
mergeChartOption
()
{
if
(
!
this
.
$refs
.
chart
)
return
if
(
this
.
chart
)
{
let
option
=
Object
.
assign
({},
this
.
chartOption
,
this
.
calcOption
)
option
=
JSON
.
parse
(
JSON
.
stringify
(
option
))
const
series
=
JSON
.
parse
(
JSON
.
stringify
(
Object
.
values
(
this
.
calcData
.
seriesObj
)))
this
.
parseChartSeries
(
option
,
series
,
this
.
chartSeriesType
)
option
.
series
=
series
this
.
chart
.
clear
()
this
.
chart
.
setOption
(
option
,
true
)
}
},
parseChartSeries
(
option
,
series
,
type
)
{
series
.
forEach
((
item
)
=>
{
item
.
label
.
formatter
=
(
params
)
=>
{
return
params
.
name
+
'
\
n
\
nvalue : '
+
params
.
value
}
})
},
_combineRowPaths
(...
arrays
)
{
const
len
=
arrays
.
length
let
_result
=
[]
if
(
len
)
{
const
rowPaths
=
arrays
.
reduce
((
prev
,
curr
)
=>
{
const
arr
=
[]
prev
.
values
.
forEach
(
_prevEl
=>
{
const
prevKey
=
prev
.
key
.
split
(
SEPARATOR
)
curr
.
values
.
forEach
(
_currEl
=>
{
const
currKey
=
curr
.
key
const
conditions
=
{}
prevKey
.
forEach
((
key
,
i
)
=>
{
conditions
[
key
]
=
_prevEl
.
split
(
SEPARATOR
)[
i
]
})
conditions
[
currKey
]
=
_currEl
// 判断数据里是否有该项
const
filter
=
this
.
localData
.
some
((
data
)
=>
{
let
status
=
true
for
(
const
key
in
conditions
)
{
if
(
conditions
[
key
]
!==
data
[
key
])
{
status
=
false
return
}
}
return
status
})
if
(
filter
)
{
arr
.
push
(
_prevEl
+
SEPARATOR
+
_currEl
)
}
})
})
return
{
key
:
prev
.
key
+
SEPARATOR
+
curr
.
key
,
values
:
arr
}
})
||
{}
_result
=
rowPaths
.
values
||
[]
}
return
_result
},
_combineColPaths
(...
arrays
)
{
return
arrays
.
length
?
arrays
.
reduce
((
prev
,
curr
)
=>
{
const
arr
=
[]
prev
.
forEach
(
_prevEl
=>
{
curr
.
forEach
(
_currEl
=>
{
arr
.
push
(
_prevEl
+
SEPARATOR
+
_currEl
)
})
})
return
arr
})
:
arrays
},
_findCategory
(
keys
=
[],
data
=
[])
{
const
_result
=
{}
data
.
forEach
(
item
=>
{
keys
.
forEach
(
key
=>
{
// Remove duplicates
_result
[
key
]
=
_result
[
key
]
||
[]
_result
[
key
].
push
(
item
[
key
])
_result
[
key
]
=
[...
new
Set
(
_result
[
key
])]
})
})
return
_result
},
_reduceValue
(
data
,
key
)
{
if
(
!
data
.
length
)
return
0
return
data
.
reduce
((
sum
,
item
)
=>
{
return
sum
+
Number
(
item
[
key
])
},
0
)
},
_filterData
(
conditions
,
data
)
{
return
data
.
filter
((
data
)
=>
{
let
status
=
true
for
(
const
key
in
conditions
)
{
if
(
conditions
[
key
]
!==
data
[
key
])
{
status
=
false
return
}
}
return
status
})
}
}
}
}
}
</
script
>
</
script
>
...
...
datax-ui/src/views/visual/datachart/components/widgets/ChartWordCloud.vue
View file @
7d3387cb
...
@@ -142,6 +142,7 @@ export default {
...
@@ -142,6 +142,7 @@ export default {
handleCalcData
()
{
handleCalcData
()
{
if
(
!
this
.
localRows
.
length
||
!
this
.
localValues
.
length
)
return
if
(
!
this
.
localRows
.
length
||
!
this
.
localValues
.
length
)
return
const
_rowPaths
=
this
.
_combineRowPaths
(
const
_rowPaths
=
this
.
_combineRowPaths
(
this
.
localData
,
...
this
.
localRows
.
map
(({
key
,
values
})
=>
{
return
{
key
,
values
}
})
...
this
.
localRows
.
map
(({
key
,
values
})
=>
{
return
{
key
,
values
}
})
)
)
const
_rowKeys
=
this
.
localRows
.
map
(({
key
})
=>
key
)
const
_rowKeys
=
this
.
localRows
.
map
(({
key
})
=>
key
)
...
@@ -242,7 +243,7 @@ export default {
...
@@ -242,7 +243,7 @@ export default {
this
.
chart
.
setOption
(
option
,
true
)
this
.
chart
.
setOption
(
option
,
true
)
}
}
},
},
_combineRowPaths
(...
arrays
)
{
_combineRowPaths
(
data
,
...
arrays
)
{
const
len
=
arrays
.
length
const
len
=
arrays
.
length
let
_result
=
[]
let
_result
=
[]
if
(
len
)
{
if
(
len
)
{
...
@@ -258,7 +259,7 @@ export default {
...
@@ -258,7 +259,7 @@ export default {
})
})
conditions
[
currKey
]
=
_currEl
conditions
[
currKey
]
=
_currEl
// 判断数据里是否有该项
// 判断数据里是否有该项
const
filter
=
this
.
localD
ata
.
some
((
data
)
=>
{
const
filter
=
d
ata
.
some
((
data
)
=>
{
let
status
=
true
let
status
=
true
for
(
const
key
in
conditions
)
{
for
(
const
key
in
conditions
)
{
if
(
conditions
[
key
]
!==
data
[
key
])
{
if
(
conditions
[
key
]
!==
data
[
key
])
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment