Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_47563380
NodeJS_629197
提交
eff3ce09
N
NodeJS_629197
项目概览
weixin_47563380
/
NodeJS_629197
与 Fork 源项目一致
Fork自
inscode / NodeJS
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
NodeJS_629197
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
eff3ce09
编写于
8月 16, 2024
作者:
W
weixin_47563380
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fri Aug 16 13:55:00 CST 2024 inscode
上级
c5135333
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
137 addition
and
0 deletion
+137
-0
test/pages/quxiantu1/quxiantu1.js
test/pages/quxiantu1/quxiantu1.js
+89
-0
test/pages/quxiantu1/quxiantu1.json
test/pages/quxiantu1/quxiantu1.json
+3
-0
test/pages/quxiantu1/quxiantu1.wxml
test/pages/quxiantu1/quxiantu1.wxml
+7
-0
test/pages/quxiantu1/quxiantu1.wxss
test/pages/quxiantu1/quxiantu1.wxss
+38
-0
未找到文件。
test/pages/quxiantu1/quxiantu1.js
0 → 100644
浏览文件 @
eff3ce09
var
wxCharts
=
require
(
'
../../utils/wxcharts.js
'
);
var
lineChart
=
null
;
Page
({
data
:{
textcolor1
:
'
#014f8e
'
,
textcolor2
:
'
#bfbfbf
'
,
},
onLoad
:
function
(){
//下面是图表一显示的数据,只需替换掉数据折现就会发生变化实现动态生成
var
x_data
=
[
"
12-05
"
,
"
12-06
"
,
"
12-07
"
,
"
12-08
"
,
"
12-09
"
,
"
12-10
"
,
"
12-11
"
,
"
12-12
"
,
"
12-13
"
,
"
12-14
"
,
"
12-15
"
,
"
12-16
"
,
"
12-17
"
,
"
12-18
"
,
"
12-19
"
]
var
y_data
=
[
"
2710778.83
"
,
"
3701004.17
"
,
"
1959107.37
"
,
"
1875401.10
"
,
"
1844007.76
"
,
"
1927753.07
"
,
"
2214439.68
"
,
"
2501855.64
"
,
"
2348521.30
"
,
"
1815527.72
"
,
"
1938038.04
"
,
"
1911152.88
"
,
"
2062097.59
"
,
"
2397674.45
"
,
"
2796167.86
"
]
//绘制折线图
this
.
OnWxChart
(
x_data
,
y_data
,
'
图表一
'
)
},
//更换折线图数据为图表一数据
canvas1_click
:
function
(){
this
.
setData
({
textcolor1
:
'
#014f8e
'
,
textcolor2
:
'
#bfbfbf
'
,
})
var
x_data
=
[
"
12-05
"
,
"
12-06
"
,
"
12-07
"
,
"
12-08
"
,
"
12-09
"
,
"
12-10
"
,
"
12-11
"
,
"
12-12
"
,
"
12-13
"
,
"
12-14
"
,
"
12-15
"
,
"
12-16
"
,
"
12-17
"
,
"
12-18
"
,
"
12-19
"
]
var
y_data
=
[
"
2710778.83
"
,
"
3701004.17
"
,
"
1959107.37
"
,
"
1875401.10
"
,
"
1844007.76
"
,
"
1927753.07
"
,
"
2214439.68
"
,
"
2501855.64
"
,
"
2348521.30
"
,
"
1815527.72
"
,
"
1938038.04
"
,
"
1911152.88
"
,
"
2062097.59
"
,
"
2397674.45
"
,
"
2796167.86
"
]
//绘制折线图
this
.
OnWxChart
(
x_data
,
y_data
,
'
图表一
'
)
},
//更换折线图数据为图表二数据
canvas2_click
:
function
(){
this
.
setData
({
textcolor1
:
'
#bfbfbf
'
,
textcolor2
:
'
#014f8e
'
,
})
var
x_data
=
[
"
1
"
,
"
2
"
,
"
3
"
,
"
4
"
,
"
5
"
,
"
6
"
,
"
7
"
,
"
8
"
,
"
9
"
]
var
y_data
=
[
"
113
"
,
"
620
"
,
"
332
"
,
"
540
"
,
"
580
"
,
"
580
"
,
"
603
"
,
"
100
"
,
"
605
"
]
//绘制折线图
this
.
OnWxChart
(
x_data
,
y_data
,
'
图表二
'
)
},
//图表点击事件
touchcanvas
:
function
(
e
){
lineChart
.
showToolTip
(
e
,
{
format
:
function
(
item
,
category
)
{
return
category
+
'
'
+
item
.
name
+
'
:
'
+
item
.
data
}
});
},
//折线图绘制方法
OnWxChart
:
function
(
x_data
,
y_data
,
name
){
var
windowWidth
=
''
,
windowHeight
=
''
;
//定义宽高
try
{
var
res
=
wx
.
getSystemInfoSync
();
//试图获取屏幕宽高数据
windowWidth
=
res
.
windowWidth
/
750
*
690
;
//以设计图750为主进行比例算换
windowHeight
=
res
.
windowWidth
/
750
*
550
//以设计图750为主进行比例算换
}
catch
(
e
)
{
console
.
error
(
'
getSystemInfoSync failed!
'
);
//如果获取失败
}
lineChart
=
new
wxCharts
({
canvasId
:
'
lineCanvas
'
,
//输入wxml中canvas的id
type
:
'
line
'
,
categories
:
x_data
,
//模拟的x轴横坐标参数
animation
:
true
,
//是否开启动画
series
:
[{
name
:
name
,
data
:
y_data
,
format
:
function
(
val
,
name
)
{
return
val
+
'
元
'
;
}
}
],
xAxis
:
{
//是否隐藏x轴分割线
disableGrid
:
true
,
},
yAxis
:
{
//y轴数据
title
:
name
,
//标题
format
:
function
(
val
)
{
//返回数值
return
val
.
toFixed
(
2
);
},
min
:
400000.00
,
//最小值
gridColor
:
'
#D8D8D8
'
,
},
width
:
windowWidth
*
1.1
,
//图表展示内容宽度
height
:
windowHeight
,
//图表展示内容高度
dataLabel
:
false
,
//是否在图表上直接显示数据
dataPointShape
:
true
,
//是否在图标上显示数据点标志
extra
:
{
lineStyle
:
'
Broken
'
//曲线
},
});
}
})
test/pages/quxiantu1/quxiantu1.json
0 → 100644
浏览文件 @
eff3ce09
{
"usingComponents"
:
{}
}
\ No newline at end of file
test/pages/quxiantu1/quxiantu1.wxml
0 → 100644
浏览文件 @
eff3ce09
<canvas canvas-id="lineCanvas" disable-scroll="true" class="canvas" bindtouchstart="touchcanvas"></canvas>
<view class = "canvas1_button" bindtap="canvas1_click" >
<text style="color:{{textcolor1}}" class="canvas1_text">图表一</text>
</view>
<view class = "canvas2_button" bindtap="canvas2_click" >
<text style="color:{{textcolor2}}" class="canvas2_text">图表二</text>
</view>
test/pages/quxiantu1/quxiantu1.wxss
0 → 100644
浏览文件 @
eff3ce09
.canvas {
position: absolute;
width: 100%;
height: 50%;
top: 10%;
}
.canvas1_button{
position: absolute;
right:25.5%;
width: 22%;
height: 45rpx;
top: 6%;
}
.canvas1_text{
position: absolute;
right:0%;
width: 65%;
height: 90%;
bottom: 10%;
text-align: center;
font-size: 14px;
}
.canvas2_button{
position: absolute;
right:2.1%;
width: 22%;
height: 45rpx;
top: 6%;
}
.canvas2_text{
position: absolute;
right:0%;
width: 65%;
height: 90%;
bottom: 10%;
text-align: center;
font-size: 14px;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录