Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
M
monthReport_smzx
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
邓文彬
monthReport_smzx
Commits
ad78f66e
提交
ad78f66e
authored
11月 21, 2024
作者:
邓文彬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(图表): 图表完成
上级
c571475d
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
169 行增加
和
119 行删除
+169
-119
rightBar.vue
pages/monthReport/components/rightBar.vue
+43
-22
rightLine.vue
pages/monthReport/components/rightLine.vue
+61
-15
rightPie.vue
pages/monthReport/components/rightPie.vue
+65
-82
没有可用的文件名
+0
-0
没有找到文件。
pages/monthReport/components/rightBar.vue
浏览文件 @
ad78f66e
<
template
>
<view>
<view
class=
"echartsBar"
id=
"echartsBar"
></view>
<view
class=
"echartsBar"
id=
"echartsBar"
:prop=
"option"
:change:prop=
"echarts.updateEcharts"
></view>
</view>
</
template
>
<
script
>
export
default
{
data
()
{
return
{};
},
};
</
script
>
<
script
module=
"echarts"
lang=
"renderjs"
>
import
*
as
echarts
from
"echarts"
;
export
default
{
props
:
{},
...
...
@@ -77,26 +75,49 @@ export default {
};
},
},
async
mounted
()
{
this
.
$nextTick
(()
=>
{
this
.
init
();
});
},
async
mounted
()
{},
methods
:
{
init
()
{
const
DOM
=
document
.
getElementById
(
"echartsBar"
);
const
myChart
=
echarts
.
init
(
DOM
);
myChart
.
setOption
(
this
.
option
);
window
.
addEventListener
(
"resize"
,
()
=>
{
myChart
.
clear
();
myChart
.
setOption
(
this
.
option
);
myChart
&&
myChart
.
resize
();
});
changeOption
()
{
// const data = this.option.series[0].data;
// // 随机更新示例数据
// data.forEach((item, index) => {
// data.splice(index, 1, Math.random() * 40);
// });
},
},
};
</
script
>
<
script
module=
"echarts"
lang=
"renderjs"
>
let
myChart
export
default
{
mounted
()
{
if
(
typeof
window
.
echarts
===
'function'
)
{
this
.
initEcharts
()
}
else
{
// 动态引入较大类库避免影响页面展示
const
script
=
document
.
createElement
(
'script'
)
// view 层的页面运行在 www 根目录,其相对路径相对于 www 计算
script
.
src
=
'static/echarts.js'
script
.
onload
=
this
.
initEcharts
.
bind
(
this
)
document
.
head
.
appendChild
(
script
)
}
},
methods
:
{
initEcharts
()
{
myChart
=
echarts
.
init
(
document
.
getElementById
(
'echartsBar'
))
// 观测更新的数据在 view 层可以直接访问到
myChart
.
setOption
(
this
.
option
)
},
updateEcharts
(
newValue
,
oldValue
,
ownerInstance
,
instance
)
{
// 监听 service 层数据变更
myChart
.
setOption
(
newValue
)
},
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.echartsBar
{
height
:
200px
;
...
...
pages/monthReport/components/rightLine.vue
浏览文件 @
ad78f66e
<
template
>
<view>
<view
canvas-id=
"myChart"
id=
"myChart"
class=
"echartsBar"
></view>
<view
id=
"echartsLine"
class=
"echartsLine"
:prop=
"option"
:change:prop=
"echarts.updateEcharts"
></view>
</view>
</
template
>
...
...
@@ -8,17 +13,7 @@
export
default
{
data
()
{
return
{
};
},
};
</
script
>
<
script
module=
"echarts"
lang=
"renderjs"
>
import
*
as
echarts
from
"echarts"
;
export
default
{
data
()
{
return
{
lists
:
[
{
name
:
"终端"
,
...
...
@@ -59,7 +54,7 @@ export default {
xData
=
[];
for
(
let
i
=
1
;
i
<=
31
;
i
++
)
{
yData
.
push
(
Math
.
floor
(
Math
.
random
()
*
100
));
xData
.
push
(
"10-"
+
i
.
toString
().
padStart
(
2
,
'0'
));
xData
.
push
(
"10-"
+
i
.
toString
().
padStart
(
2
,
"0"
));
}
serverData
.
push
({
name
:
item
.
name
,
...
...
@@ -114,6 +109,28 @@ export default {
};
},
},
methods
:
{
changeOption
()
{
// const data = this.option.series[0].data;
// // 随机更新示例数据
// data.forEach((item, index) => {
// data.splice(index, 1, Math.random() * 40);
// });
},
},
};
</
script
>
<!-- <script module="echarts" lang="renderjs">
import * as echarts from "echarts";
export default {
data() {
return {
};
},
mounted() {
// 初始化图表
this.initChart();
...
...
@@ -137,10 +154,39 @@ export default {
}
}
}
</
script
>
</script>
-->
<
script
module=
"echarts"
lang=
"renderjs"
>
let
myChart
export
default
{
mounted
()
{
if
(
typeof
window
.
echarts
===
'function'
)
{
this
.
initEcharts
()
}
else
{
// 动态引入较大类库避免影响页面展示
const
script
=
document
.
createElement
(
'script'
)
// view 层的页面运行在 www 根目录,其相对路径相对于 www 计算
script
.
src
=
'static/echarts.js'
script
.
onload
=
this
.
initEcharts
.
bind
(
this
)
document
.
head
.
appendChild
(
script
)
}
},
methods
:
{
initEcharts
()
{
myChart
=
echarts
.
init
(
document
.
getElementById
(
'echartsLine'
))
// 观测更新的数据在 view 层可以直接访问到
myChart
.
setOption
(
this
.
option
)
},
updateEcharts
(
newValue
,
oldValue
,
ownerInstance
,
instance
)
{
// 监听 service 层数据变更
myChart
.
setOption
(
newValue
)
},
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.echarts
Bar
{
.echarts
Line
{
height
:
200px
;
width
:
100%
;
}
...
...
pages/monthReport/components/rightPie.vue
浏览文件 @
ad78f66e
<
template
>
<view>
<view
id=
"lineTendencyChart"
></view>
<view
class=
"content"
>
<!-- #ifdef APP-PLUS || H5 -->
<view
:prop=
"option"
:change:prop=
"echarts.updateEcharts"
id=
"echarts"
class=
"echarts"
></view>
<!-- #endif -->
<!-- #ifndef APP-PLUS || H5 -->
<view>
非 APP、H5 环境不支持
</view>
<!-- #endif -->
</view>
</
template
>
<
script
>
export
default
{
data
()
{
return
{};
},
async
mounted
()
{
}
};
</
script
>
<
script
module=
"echarts"
lang=
"renderjs"
>
import
*
as
echarts
from
"echarts"
;
export
default
{
props
:
{
value
:
{
...
...
@@ -25,17 +26,14 @@ export default {
},
data
()
{
return
{
Chart
:
null
,
};
},
async
mounted
()
{
this
.
$nextTick
(()
=>
{
this
.
initChart
();
});
},
onLoad
()
{},
computed
:
{
option
s
()
{
let
dataTmp
=
this
.
value
;
option
()
{
let
dataTmp
=
this
.
value
||
0
;
let
max
=
100
;
let
min
=
0
;
let
scoresPercentage
=
dataTmp
/
max
;
...
...
@@ -117,16 +115,7 @@ export default {
//底部点位名称
detail
:
{
show
:
false
,
// offsetCenter: [0, '75%'],
// formatter: ['{name|' + '温度' + '}'].join('\n'),
// rich: {
// name: {
// fontFamily: 'Microsoft YaHei',
// fontSize:14,
// color: 'red',
// lineHeight: 52
// }
// }
},
data
:
[
{
...
...
@@ -355,23 +344,6 @@ export default {
value
:
100
,
itemStyle
:
{
color
:
"#fcfdff"
,
// {
// type: 'linear',
// x: 0,
// y: 0,
// x2: 0,
// y2: 1,
// colorStops: [
// {
// offset: 0,
// color: '##fcfdff',
// },
// {
// offset: 1,
// color: '#fff',
// },
// ],
// },
},
},
],
...
...
@@ -395,23 +367,6 @@ export default {
value
:
100
,
itemStyle
:
{
color
:
"#fff"
,
// {
// type: 'linear',
// x: 0,
// y: 0,
// x2: 0,
// y2: 1,
// colorStops: [
// {
// offset: 0,
// color: '##fcfdff',
// },
// {
// offset: 1,
// color: '#fff',
// },
// ],
// },
},
},
],
...
...
@@ -421,30 +376,58 @@ export default {
},
},
methods
:
{
initChart
()
{
let
Chart
=
echarts
.
init
(
document
.
getElementById
(
"lineTendencyChart"
));
Chart
.
setOption
(
this
.
options
);
this
.
Chart
=
Chart
;
window
.
addEventListener
(
"resize"
,
function
()
{
Chart
.
resize
();
});
changeOption
()
{
// const data = this.option.series[0].data;
// // 随机更新示例数据
// data.forEach((item, index) => {
// data.splice(index, 1, Math.random() * 40);
// });
},
},
watch
:
{
value
:
{
immediate
:
true
,
handler
(
val
)
{
this
.
$nextTick
(()
=>
{
this
.
initChart
();
});
},
onViewClick
(
options
)
{
console
.
log
(
options
);
},
},
};
</
script
>
<
style
lang=
"scss"
scoped
>
#lineTendencyChart
{
<
script
module=
"echarts"
lang=
"renderjs"
>
let
myChart
export
default
{
mounted
()
{
if
(
typeof
window
.
echarts
===
'function'
)
{
this
.
initEcharts
()
}
else
{
// 动态引入较大类库避免影响页面展示
const
script
=
document
.
createElement
(
'script'
)
// view 层的页面运行在 www 根目录,其相对路径相对于 www 计算
script
.
src
=
'static/echarts.js'
script
.
onload
=
this
.
initEcharts
.
bind
(
this
)
document
.
head
.
appendChild
(
script
)
}
},
methods
:
{
initEcharts
()
{
myChart
=
echarts
.
init
(
document
.
getElementById
(
'echarts'
))
// 观测更新的数据在 view 层可以直接访问到
myChart
.
setOption
(
this
.
option
)
},
updateEcharts
(
newValue
,
oldValue
,
ownerInstance
,
instance
)
{
// 监听 service 层数据变更
myChart
.
setOption
(
newValue
)
},
}
}
</
script
>
<
style
>
.content
{
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
justify-content
:
center
;
}
.echarts
{
width
:
230px
;
height
:
230px
;
}
...
...
浏览文件 @
ad78f66e
No preview for this file type
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论