Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
Z
ZZDataAnalysis
Project
Project
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
hlwu
ZZDataAnalysis
Commits
45762945
Commit
45762945
authored
Sep 19, 2023
by
liushuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
对接图表数据库数据
parent
9cfdd002
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
27 deletions
+39
-27
data.js
web/src/api/data.js
+7
-0
charts.js
web/src/store/modules/charts.js
+1
-1
chart.vue
web/src/views/chartcustomization/components/chart.vue
+31
-26
No files found.
web/src/api/data.js
View file @
45762945
...
@@ -130,3 +130,10 @@ export function login(params) {
...
@@ -130,3 +130,10 @@ export function login(params) {
params
params
})
})
}
}
export
function
getData
(
params
)
{
return
request
({
url
:
"http://localhost:5000/getData"
,
method
:
'get'
,
params
})
}
web/src/store/modules/charts.js
View file @
45762945
const
state
=
()
=>
({
const
state
=
()
=>
({
chartSettingsTitle
:
{
chartSettingsTitle
:
{
text
:
'
Initial Chart Title
'
,
// 添加初始标题
text
:
'
国民总收入
'
,
// 添加初始标题
top
:
'top'
,
top
:
'top'
,
left
:
'left'
,
left
:
'left'
,
show
:
true
,
show
:
true
,
...
...
web/src/views/chartcustomization/components/chart.vue
View file @
45762945
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
import
{
mapState
}
from
'vuex'
;
import
{
mapState
}
from
'vuex'
;
import
{
getProject
,
getFileList
,
createProject
}
from
'@/api/data'
import
{
getProject
,
getFileList
,
createProject
}
from
'@/api/data'
import
*
as
echarts
from
'echarts'
;
import
*
as
echarts
from
'echarts'
;
import
{
getData
}
from
"@/api/data"
import
Chartedit
from
"../chartedit.vue"
;
import
Chartedit
from
"../chartedit.vue"
;
export
default
{
export
default
{
name
:
'project'
,
name
:
'project'
,
...
@@ -20,12 +21,16 @@
...
@@ -20,12 +21,16 @@
data
()
{
data
()
{
return
{
return
{
myChart
:
null
,
myChart
:
null
,
dataset
:[],
XAxis
:[],
YAxis
:[],
value
:[]
}
}
},
},
mounted
()
{
mounted
()
{
this
.
init
()
this
.
getdata
()
},
},
watch
:{
watch
:{
chartSettingsTitle
:
{
chartSettingsTitle
:
{
...
@@ -40,6 +45,10 @@
...
@@ -40,6 +45,10 @@
deep
:
true
,
deep
:
true
,
handler
:
'init'
// 直接将方法名指定为 handler
handler
:
'init'
// 直接将方法名指定为 handler
},
},
chartSettingsYAxis
:{
deep
:
true
,
handler
:
'init'
// 直接将方法名指定为 handler
},
chartSettingsSeries
:{
chartSettingsSeries
:{
deep
:
true
,
deep
:
true
,
handler
:
'init'
// 直接将方法名指定为 handler
handler
:
'init'
// 直接将方法名指定为 handler
...
@@ -53,6 +62,21 @@
...
@@ -53,6 +62,21 @@
...
mapState
(
'charts'
,
[
'chartSettingsTitle'
,
'chartSettingsLegend'
,
'chartSettingsXAxis'
,
'chartSettingsYAxis'
,
'chartSettingsSeries'
,
'chartSettingsDataZoom'
]),
...
mapState
(
'charts'
,
[
'chartSettingsTitle'
,
'chartSettingsLegend'
,
'chartSettingsXAxis'
,
'chartSettingsYAxis'
,
'chartSettingsSeries'
,
'chartSettingsDataZoom'
]),
},
},
methods
:
{
methods
:
{
getdata
(){
const
params
=
{
"name"
:
"国民总收入"
}
getData
(
params
).
then
(
res
=>
{
this
.
dataset
=
res
.
data
let
XAxis
=
[]
let
value
=
[]
for
(
var
i
in
res
.
data
){
XAxis
.
push
(
res
.
data
[
i
].
year
)
value
.
push
(
res
.
data
[
i
].
value
)
}
this
.
XAxis
=
XAxis
this
.
value
=
value
this
.
init
()
})
},
addPointSetting
(
series
){
addPointSetting
(
series
){
for
(
var
i
=
0
;
i
<
series
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
series
.
length
;
i
++
)
{
for
(
var
key
in
this
.
chartSettingsSeries
)
{
for
(
var
key
in
this
.
chartSettingsSeries
)
{
...
@@ -78,36 +102,17 @@
...
@@ -78,36 +102,17 @@
setOption
.
legend
=
this
.
chartSettingsLegend
setOption
.
legend
=
this
.
chartSettingsLegend
setOption
.
xAxis
=
this
.
chartSettingsXAxis
setOption
.
xAxis
=
this
.
chartSettingsXAxis
setOption
.
yAxis
=
this
.
chartSettingsYAxis
setOption
.
yAxis
=
this
.
chartSettingsYAxis
setOption
.
xAxis
.
data
=
[
'Email'
,
'Union Ads'
,
'Video Ads'
,
'Direct'
,
'Search Engine'
]
setOption
.
xAxis
.
data
=
this
.
XAxis
// setOption.xAxis.data=['Email', 'Union Ads', 'Video Ads', 'Direct', 'Search Engine']
setOption
.
dataZoom
=
this
.
chartSettingsDataZoom
setOption
.
dataZoom
=
this
.
chartSettingsDataZoom
setOption
.
series
=
[
setOption
.
series
=
[
{
{
name
:
'
Email
'
,
name
:
'
国民总收入
'
,
type
:
'line'
,
type
:
'line'
,
data
:
[
120
,
132
,
101
,
134
,
90
,
230
,
210
]
data
:
this
.
value
},
},
{
]
name
:
'Union Ads'
,
type
:
'line'
,
data
:
[
220
,
182
,
191
,
234
,
290
,
330
,
310
]
},
{
name
:
'Video Ads'
,
type
:
'line'
,
data
:
[
150
,
232
,
201
,
154
,
190
,
330
,
410
]
},
{
name
:
'Direct'
,
type
:
'line'
,
data
:
[
320
,
332
,
301
,
334
,
390
,
330
,
320
]
},
{
name
:
'Search Engine'
,
type
:
'line'
,
stack
:
'Total'
,
data
:
[
820
,
932
,
901
,
934
,
1290
,
1330
,
1320
]
}]
if
(
this
.
chartSettingsSeries
.
showPoint
==
true
){
if
(
this
.
chartSettingsSeries
.
showPoint
==
true
){
this
.
addPointSetting
(
setOption
.
series
)
this
.
addPointSetting
(
setOption
.
series
)
}
else
{
}
else
{
...
...
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