@10yun/cv-mobile-ui 0.5.63 → 0.5.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/other/uCharts-uniapp/index.js +2 -0
- package/other/uCharts-uniapp/package.json +42 -0
- package/other/{qiun-data-charts/js_sdk → uCharts-uniapp}/u-charts/config-echarts.js +421 -421
- package/other/{qiun-data-charts → uCharts-uniapp/u-charts}/license.md +201 -201
- package/other/uCharts-uniapp/u-charts/package.json +19 -0
- package/other/{qiun-data-charts/readme.md → uCharts-uniapp/u-charts/readme-npm.md} +57 -63
- package/other/{qiun-data-charts/js_sdk → uCharts-uniapp}/u-charts/readme.md +4 -4
- package/other/{qiun-data-charts/js_sdk → uCharts-uniapp}/u-charts/u-charts.js +7661 -7661
- package/other/{qiun-data-charts/js_sdk → uCharts-uniapp}/u-charts/u-charts.min.js +1 -1
- package/package.json +1 -1
- package/ui-cv/components/cv-filter-hm/cv-filter-hm.vue +134 -167
- package/uview-plus/components/u-search/u-search.vue +10 -8
- package/other/qiun-data-charts/changelog.md +0 -320
- package/other/qiun-data-charts/components/qiun-data-charts/qiun-data-charts.vue +0 -1618
- package/other/qiun-data-charts/components/qiun-error/qiun-error.vue +0 -46
- package/other/qiun-data-charts/components/qiun-loading/loading1.vue +0 -162
- package/other/qiun-data-charts/components/qiun-loading/loading2.vue +0 -170
- package/other/qiun-data-charts/components/qiun-loading/loading3.vue +0 -173
- package/other/qiun-data-charts/components/qiun-loading/loading4.vue +0 -222
- package/other/qiun-data-charts/components/qiun-loading/loading5.vue +0 -229
- package/other/qiun-data-charts/components/qiun-loading/qiun-loading.vue +0 -36
- package/other/qiun-data-charts/js_sdk2/app-echarts.min.js +0 -23
- package/other/qiun-data-charts/js_sdk2/h5-echarts.min.js +0 -23
- package/other/qiun-data-charts/package.json +0 -81
- package/other/qiun-data-charts/static/app-plus/echarts.min.js +0 -23
- package/other/qiun-data-charts/static/h5/echarts.min.js +0 -23
- package/other/qiun-data-charts_2.5.0-20230101_example/App.vue +0 -20
- package/other/qiun-data-charts_2.5.0-20230101_example/common/uni-icons.css +0 -542
- package/other/qiun-data-charts_2.5.0-20230101_example/common/uni.css +0 -246
- package/other/qiun-data-charts_2.5.0-20230101_example/components/qiun-title-bar/qiun-title-bar.vue +0 -51
- package/other/qiun-data-charts_2.5.0-20230101_example/components/test-charts/test-charts.vue +0 -48
- package/other/qiun-data-charts_2.5.0-20230101_example/main.js +0 -13
- package/other/qiun-data-charts_2.5.0-20230101_example/manifest.json +0 -75
- package/other/qiun-data-charts_2.5.0-20230101_example/mockdata/demodata.json +0 -448
- package/other/qiun-data-charts_2.5.0-20230101_example/mockdata/mapdata.json +0 -1
- package/other/qiun-data-charts_2.5.0-20230101_example/pages/canvas/canvas.vue +0 -142
- package/other/qiun-data-charts_2.5.0-20230101_example/pages/echarts/echarts.vue +0 -228
- package/other/qiun-data-charts_2.5.0-20230101_example/pages/format-e/format-e.vue +0 -113
- package/other/qiun-data-charts_2.5.0-20230101_example/pages/format-u/format-u.vue +0 -110
- package/other/qiun-data-charts_2.5.0-20230101_example/pages/index/index.vue +0 -58
- package/other/qiun-data-charts_2.5.0-20230101_example/pages/layout/layout.vue +0 -174
- package/other/qiun-data-charts_2.5.0-20230101_example/pages/other/other.vue +0 -233
- package/other/qiun-data-charts_2.5.0-20230101_example/pages/tab/tab.vue +0 -115
- package/other/qiun-data-charts_2.5.0-20230101_example/pages/ucharts/ucharts.vue +0 -339
- package/other/qiun-data-charts_2.5.0-20230101_example/pages/unicloud/unicloud.vue +0 -117
- package/other/qiun-data-charts_2.5.0-20230101_example/pages/updata/updata.vue +0 -212
- package/other/qiun-data-charts_2.5.0-20230101_example/pages.json +0 -79
- package/other/qiun-data-charts_2.5.0-20230101_example/static/logo.png +0 -0
- package/other/qiun-data-charts_2.5.0-20230101_example/uni.scss +0 -76
- package/other/qiun-data-charts_2.5.0-20230101_example/uniCloud-aliyun/database/db_init.json +0 -455
- package/other/qiun-data-charts_2.5.0-20230101_example/uniCloud-aliyun/database/qiun-charts-demo.schema.json +0 -76
- package/other/u-charts/config.js +0 -503
- package/other/u-charts/data.json +0 -1143
- package/other/u-charts/demodata.json +0 -267
- package/other/u-charts/mapdata.json +0 -41
- package/other/u-charts/u-charts.js +0 -5687
- package/other/u-charts/u-charts.min.js +0 -1
- package/other/u-charts/u-charts.vue +0 -466
- /package/other/{qiun-data-charts/js_sdk → uCharts-uniapp}/u-charts/config-ucharts.js +0 -0
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view class="content">
|
|
3
|
-
<qiun-title-bar title="在swiper中使用"/>
|
|
4
|
-
<swiper style="height: 330px;" :indicator-dots="true">
|
|
5
|
-
<swiper-item>
|
|
6
|
-
<view class="charts-box">
|
|
7
|
-
<qiun-data-charts type="line" :chartData="chartsDataColumn1" :canvas2d="true" canvasId="swiperida" :inScrollView="true" :pageScrollTop="pageScrollTop"/>
|
|
8
|
-
</view>
|
|
9
|
-
</swiper-item>
|
|
10
|
-
<swiper-item>
|
|
11
|
-
<view class="charts-box">
|
|
12
|
-
<qiun-data-charts type="column" :chartData="chartsDataColumn1" :canvas2d="true" canvasId="swiperidb" :inScrollView="true" :pageScrollTop="pageScrollTop"/>
|
|
13
|
-
</view>
|
|
14
|
-
</swiper-item>
|
|
15
|
-
<swiper-item>
|
|
16
|
-
<view class="charts-box">
|
|
17
|
-
<qiun-data-charts type="area" :chartData="chartsDataColumn1" :canvas2d="true" canvasId="swiperidc" :inScrollView="true" :pageScrollTop="pageScrollTop"/>
|
|
18
|
-
</view>
|
|
19
|
-
</swiper-item>
|
|
20
|
-
</swiper>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<qiun-title-bar title="在scroll-view中使用"/>
|
|
24
|
-
<scroll-view style="height: 400px;" :scroll-y="true">
|
|
25
|
-
<view class="charts-box">
|
|
26
|
-
<!-- 如果您的scroll-view可能和我这个一样,既有页面滚动,还有scroll-view滚动,这种情况下,需要动态传入offsetTop的值为页面滚动条滚动的距离 -->
|
|
27
|
-
<qiun-data-charts type="column" :chartData="chartsDataColumn1" canvasId="scroll-viewid" :inScrollView="true" :pageScrollTop="pageScrollTop"/>
|
|
28
|
-
</view>
|
|
29
|
-
<view style="height: 300px;background: #1890FF;">
|
|
30
|
-
|
|
31
|
-
</view>
|
|
32
|
-
</scroll-view>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
<qiun-title-bar title="父元素fixed定位"/>
|
|
36
|
-
<view class="botton-box">
|
|
37
|
-
<button class="uni-button" type="default" @click="openfixed">点击显示弹出层</button>
|
|
38
|
-
</view>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
<qiun-title-bar title="组件套组件示例(尽量别这么用)"/>
|
|
42
|
-
<test-charts :pageScrollTop="pageScrollTop"/>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
<qiun-title-bar title="使用v-for生成图表"/>
|
|
47
|
-
<view class="charts-box" v-for="(item, index) in listA" :key="item.id">
|
|
48
|
-
<!-- 建议循环使用时,加上key值 -->
|
|
49
|
-
<qiun-data-charts :key="item.id" :type="item.type" :chartData="item.chartData" :animation="false"/>
|
|
50
|
-
</view>
|
|
51
|
-
<qiun-title-bar title="使用v-for生成图表2"/>
|
|
52
|
-
<view class="charts-box" v-for="(item, index) in listB" :key="item.id">
|
|
53
|
-
<!-- 建议循环使用时,加上key值 -->
|
|
54
|
-
<qiun-data-charts :key="item.id" :type="item.type" :chartData="item.chartData" :canvas2d="true" :canvasId="item.id" :animation="false"/>
|
|
55
|
-
</view>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
<view class="fix-class" v-if="fixedzt">
|
|
59
|
-
<view class="fix-bottom">
|
|
60
|
-
<view class="close-title" @click="openfixed">点击此处关闭弹窗</view>
|
|
61
|
-
<qiun-title-bar title="父元素fixed定位"/>
|
|
62
|
-
<view class="charts-box">
|
|
63
|
-
<qiun-data-charts type="area" :chartData="chartsDataColumn1" :canvas2d="true" canvasId="fixedcanvasid" :inScrollView="true" :pageScrollTop="pageScrollTop"/>
|
|
64
|
-
</view>
|
|
65
|
-
</view>
|
|
66
|
-
</view>
|
|
67
|
-
|
|
68
|
-
</view>
|
|
69
|
-
</template>
|
|
70
|
-
|
|
71
|
-
<script>
|
|
72
|
-
//下面是演示数据,您的项目不需要引用,数据需要您从服务器自行获取
|
|
73
|
-
import demodata from '@/mockdata/demodata.json';
|
|
74
|
-
|
|
75
|
-
export default {
|
|
76
|
-
data() {
|
|
77
|
-
return {
|
|
78
|
-
chartsDataColumn1: {},
|
|
79
|
-
pageScrollTop:0,
|
|
80
|
-
fixedzt:false,
|
|
81
|
-
absolutezt:false,
|
|
82
|
-
listA:[],
|
|
83
|
-
listB:[]
|
|
84
|
-
};
|
|
85
|
-
},
|
|
86
|
-
onReady() {
|
|
87
|
-
//模拟从服务器获取数据
|
|
88
|
-
this.getServerData()
|
|
89
|
-
|
|
90
|
-
//模拟v-for数据变化
|
|
91
|
-
setTimeout(() => {
|
|
92
|
-
this.listA=[
|
|
93
|
-
{id:"xlsldkfjiw1",type:'area',chartData:JSON.parse(JSON.stringify(demodata.Column))},
|
|
94
|
-
{id:"docldkfjiw2",type:'line',chartData:JSON.parse(JSON.stringify(demodata.Line))},
|
|
95
|
-
{id:"pptldkfjiw3",type:'column',chartData:JSON.parse(JSON.stringify(demodata.Column))}
|
|
96
|
-
]
|
|
97
|
-
this.listB=[
|
|
98
|
-
{id:"xlsldkfjiw4b",type:'area',chartData:JSON.parse(JSON.stringify(demodata.Column))},
|
|
99
|
-
{id:"docldkfjiw5b",type:'line',chartData:JSON.parse(JSON.stringify(demodata.Line))},
|
|
100
|
-
{id:"pptldkfjiw6b",type:'column',chartData:JSON.parse(JSON.stringify(demodata.Column))}
|
|
101
|
-
]
|
|
102
|
-
},5000)
|
|
103
|
-
},
|
|
104
|
-
onPageScroll(e) {
|
|
105
|
-
this.pageScrollTop = e.scrollTop
|
|
106
|
-
},
|
|
107
|
-
methods: {
|
|
108
|
-
getServerData() {
|
|
109
|
-
setTimeout(() => {
|
|
110
|
-
//因部分数据格式一样,这里不同图表引用同一数据源的话,需要深拷贝一下构造不同的对象
|
|
111
|
-
//开发者需要自行处理服务器返回的数据,应与标准数据格式一致,注意series的data数值应为数字格式
|
|
112
|
-
this.chartsDataColumn1=JSON.parse(JSON.stringify(demodata.Column))
|
|
113
|
-
|
|
114
|
-
this.listA=[
|
|
115
|
-
{id:"xlsldkfjiw1",type:'line',chartData:JSON.parse(JSON.stringify(demodata.Line))},
|
|
116
|
-
{id:"docldkfjiw2",type:'column',chartData:JSON.parse(JSON.stringify(demodata.Column))},
|
|
117
|
-
{id:"pptldkfjiw3",type:'area',chartData:JSON.parse(JSON.stringify(demodata.Line))}
|
|
118
|
-
]
|
|
119
|
-
|
|
120
|
-
this.listB=[
|
|
121
|
-
{id:"xlsldkfjiw4b",type:'line',chartData:JSON.parse(JSON.stringify(demodata.Line))},
|
|
122
|
-
{id:"docldkfjiw5b",type:'column',chartData:JSON.parse(JSON.stringify(demodata.Column))},
|
|
123
|
-
{id:"pptldkfjiw6b",type:'area',chartData:JSON.parse(JSON.stringify(demodata.Line))}
|
|
124
|
-
]
|
|
125
|
-
}, 1500);
|
|
126
|
-
},
|
|
127
|
-
openfixed(){
|
|
128
|
-
this.fixedzt = !this.fixedzt
|
|
129
|
-
},
|
|
130
|
-
openabsolute(){
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
</script>
|
|
136
|
-
|
|
137
|
-
<style>
|
|
138
|
-
.content {
|
|
139
|
-
display: flex;
|
|
140
|
-
flex-direction: column;
|
|
141
|
-
flex: 1;
|
|
142
|
-
}
|
|
143
|
-
.charts-box {
|
|
144
|
-
width: 100%;
|
|
145
|
-
height: 300px;
|
|
146
|
-
}
|
|
147
|
-
.botton-box{
|
|
148
|
-
display: flex;
|
|
149
|
-
align-items: center;
|
|
150
|
-
justify-content: center;
|
|
151
|
-
height: 80px;
|
|
152
|
-
}
|
|
153
|
-
.fix-class{
|
|
154
|
-
position: fixed;
|
|
155
|
-
top:0;
|
|
156
|
-
height: 100vh;
|
|
157
|
-
width: 100vw;
|
|
158
|
-
background: rgba(0,0,0,0.3);
|
|
159
|
-
}
|
|
160
|
-
.fix-bottom{
|
|
161
|
-
position: fixed;
|
|
162
|
-
bottom:0;
|
|
163
|
-
height: 400px;
|
|
164
|
-
width: 100vw;
|
|
165
|
-
border-radius: 15px 15px 0px 0px;
|
|
166
|
-
background: #FFFFFF;
|
|
167
|
-
}
|
|
168
|
-
.close-title{
|
|
169
|
-
border-bottom: 1px solid #999999;
|
|
170
|
-
text-align: center;
|
|
171
|
-
line-height: 30px;
|
|
172
|
-
height: 30px;
|
|
173
|
-
}
|
|
174
|
-
</style>
|
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view class="content">
|
|
3
|
-
<qiun-title-bar title="localdata渲染图表1+点击获取索引"/>
|
|
4
|
-
<view class="charts-box">
|
|
5
|
-
<!-- 只需绑定@getIndex即可获取点击索引 -->
|
|
6
|
-
<qiun-data-charts type="column" :localdata="chartsDatalocaldataA" @getIndex="getIndex"/>
|
|
7
|
-
</view>
|
|
8
|
-
<qiun-title-bar title="localdata渲染图表2+禁用鼠标移动"/>
|
|
9
|
-
<view class="charts-box">
|
|
10
|
-
<qiun-data-charts type="pie" :localdata="chartsDatalocaldataB" :onmouse="false"/>
|
|
11
|
-
</view>
|
|
12
|
-
<qiun-title-bar title="渲染完成后显示自定义tooltip" />
|
|
13
|
-
<view class="charts-box">
|
|
14
|
-
<!-- 渲染完成后进行操作图表,需要绑定@complete事件,然后在@complete事件中进行操作 -->
|
|
15
|
-
<qiun-data-charts
|
|
16
|
-
type="column"
|
|
17
|
-
:chartData="chartsDataColumn1"
|
|
18
|
-
@complete="complete"
|
|
19
|
-
/>
|
|
20
|
-
</view>
|
|
21
|
-
<qiun-title-bar title="跟手tooltip示例" />
|
|
22
|
-
<view class="charts-box" >
|
|
23
|
-
<!-- 开启onmovetip后,建议同时开启canvas2d模式(需要传canvasId),否则在小程序端会很卡。开启onmovetip功能的前提是需要开启ontouch,并且关闭图表滚动条,即:opts="{enableScroll: false}" -->
|
|
24
|
-
<qiun-data-charts
|
|
25
|
-
type="column"
|
|
26
|
-
:opts="{enableScroll: false}"
|
|
27
|
-
canvasId="canvas2dNeedId"
|
|
28
|
-
:chartData="chartsDataColumn1"
|
|
29
|
-
:canvas2d="true"
|
|
30
|
-
:ontouch="true"
|
|
31
|
-
:onmovetip="true"
|
|
32
|
-
@getTouchMove="getTouchMove"
|
|
33
|
-
/>
|
|
34
|
-
</view>
|
|
35
|
-
<qiun-title-bar title="固定位置显示tooltip+禁用图例点击" />
|
|
36
|
-
<view class="charts-box">
|
|
37
|
-
<!-- 这个demo演示自定义tooltip的样式及增加额外的数据,例如换行等 -->
|
|
38
|
-
<qiun-data-charts
|
|
39
|
-
type="line"
|
|
40
|
-
:opts="{extra:{tooltip:{showArrow: false,borderWidth: 1,borderRadius:8,borderColor: '#FF0000',bgColor: '#FFFFFF',bgOpacity: 0.9,fontColor: '#000000',splitLine: false}}}"
|
|
41
|
-
:chartData="chartsDataColumn1"
|
|
42
|
-
:tapLegend="false"
|
|
43
|
-
:tooltipCustom="{x:2,y:2}"
|
|
44
|
-
/>
|
|
45
|
-
</view>
|
|
46
|
-
<qiun-title-bar title="自定义tooltip(textList换行),内置方法" />
|
|
47
|
-
<view class="charts-box">
|
|
48
|
-
<!-- 需要关闭组件的tooltip,即:tooltipShow="false",然后在@getIndex中调用uCharts的showTooltip方法,注意,APP端不能实现,其他端需要引用config-ucharts.js作为实例承载的中间件。 -->
|
|
49
|
-
<!-- 如果需要做跟手tooltip,需要在@getTouchMove事件中调用,注意需要添加防抖,可参考组件内防抖方法,否则会导致逻辑层与视图层频繁通信造成卡顿 -->
|
|
50
|
-
<qiun-data-charts
|
|
51
|
-
type="line"
|
|
52
|
-
:tooltipShow="false"
|
|
53
|
-
:chartData="chartsDataColumn1"
|
|
54
|
-
@getIndex="showMyTooltip"
|
|
55
|
-
/>
|
|
56
|
-
</view>
|
|
57
|
-
<qiun-title-bar title="自定义tooltip(textList换行),opts参数" />
|
|
58
|
-
<view class="charts-box">
|
|
59
|
-
<!-- 需要关闭组件的tooltip,即:tooltipShow="false",然后在@getIndex中改变opts来实现tooltip,注意,APP端不能实现,其他端需要引用config-ucharts.js作为实例承载的中间件。 -->
|
|
60
|
-
<qiun-data-charts
|
|
61
|
-
type="line"
|
|
62
|
-
:opts="optsTooltip"
|
|
63
|
-
:animation="false"
|
|
64
|
-
:tooltipShow="false"
|
|
65
|
-
:chartData="chartsDataColumn1"
|
|
66
|
-
@getIndex="showOptsTooltip"
|
|
67
|
-
/>
|
|
68
|
-
</view>
|
|
69
|
-
<qiun-title-bar title="强制展示错误信息"/>
|
|
70
|
-
<button class="uni-button" type="default" @click="changeErrorMessage">点击展示错误信息</button>
|
|
71
|
-
<view class="charts-box">
|
|
72
|
-
<qiun-data-charts type="line" :chartData="chartsDataLine1" :errorMessage="errorMessage" :errorReload="false" @error="error"/>
|
|
73
|
-
</view>
|
|
74
|
-
<qiun-title-bar title="uCharts保存为图片"/>
|
|
75
|
-
<button class="uni-button" type="default" @click="createImage('createImageUCharts')">点击保存为图片</button>
|
|
76
|
-
<view class="charts-box">
|
|
77
|
-
<qiun-data-charts type="area" ref="createImageUCharts" :chartData="chartsDataLine1" @getImage="getImage"/>
|
|
78
|
-
</view>
|
|
79
|
-
</view>
|
|
80
|
-
</template>
|
|
81
|
-
|
|
82
|
-
<script>
|
|
83
|
-
//下面是演示数据,您的项目不需要引用,数据需要您从服务器自行获取
|
|
84
|
-
import demodata from '@/mockdata/demodata.json';
|
|
85
|
-
|
|
86
|
-
//下面是uCharts的配置文件及qiun-data-charts组件的公用中转参数,可以从本配置文件中获取uCharts实例、opts配置、format配置(APP端因采用renderjs无法从此配置文件获取uCharts实例)
|
|
87
|
-
//***并不是所有的页面都需要引用这个文件***引入这个configjs是为了获取组件的uCharts实例,从而操作uCharts的一些方法,例如手动显示tooltip及一些其他uCharts包含的方法及事件。
|
|
88
|
-
//再说一遍,只能在H5内使用,APP不行,APP不行,APP不行(如果需要自定义tooltip,也可以通过opts中传递tooltip参数来实现模拟显示tooltip,详见showOptsTooltip方法)
|
|
89
|
-
import uCharts from '@/uni_modules/qiun-data-charts/js_sdk/u-charts/config-ucharts.js';
|
|
90
|
-
|
|
91
|
-
export default {
|
|
92
|
-
data() {
|
|
93
|
-
return {
|
|
94
|
-
//注意如果使用localdata数据格式,默认值的类型应该是数组
|
|
95
|
-
chartsDatalocaldataA:[],
|
|
96
|
-
chartsDatalocaldataB:[],
|
|
97
|
-
//注意如果使用localdata数据格式,默认值的类型应该是数组
|
|
98
|
-
chartsDataColumn1:{},
|
|
99
|
-
chartsDataLine1:{},
|
|
100
|
-
errorMessage:"自定义的错误信息,关闭点击重新加载",
|
|
101
|
-
//在opts中拼接tooltip
|
|
102
|
-
optsTooltip:{}
|
|
103
|
-
};
|
|
104
|
-
},
|
|
105
|
-
onLoad() {
|
|
106
|
-
//模拟从服务器获取数据
|
|
107
|
-
this.getServerData()
|
|
108
|
-
},
|
|
109
|
-
methods: {
|
|
110
|
-
getServerData() {
|
|
111
|
-
setTimeout(() => {
|
|
112
|
-
//因部分数据格式一样,这里不同图表引用同一数据源的话,需要深拷贝一下构造不同的对象
|
|
113
|
-
//开发者需要自行处理服务器返回的数据,应与标准数据格式一致,注意series的data数值应为数字格式
|
|
114
|
-
this.chartsDatalocaldataA=JSON.parse(JSON.stringify(demodata.localdata))
|
|
115
|
-
this.chartsDatalocaldataB=JSON.parse(JSON.stringify(demodata.localdataB))
|
|
116
|
-
this.chartsDataColumn1=JSON.parse(JSON.stringify(demodata.Column))
|
|
117
|
-
this.chartsDataLine1=JSON.parse(JSON.stringify(demodata.Line))
|
|
118
|
-
}, 1500);
|
|
119
|
-
},
|
|
120
|
-
complete(e) {
|
|
121
|
-
console.log("渲染完成事件",e);
|
|
122
|
-
//uCharts.instance[e.id]代表当前的图表实例(除APP端,APP不可在组件外调用uCharts的实例)
|
|
123
|
-
console.log("uCharts实例",uCharts.instance[e.id]);
|
|
124
|
-
//uCharts.option[e.id]代表当前的图表的opts(除APP端,APP不可在组件外调用uCharts的实例)
|
|
125
|
-
console.log("uCharts的option",uCharts.option[e.id]);
|
|
126
|
-
//下面展示渲染完成后,通过实例调用uCharts的showToolTip方法,有了uCharts实例,您也可以在其他地方调用图表的方法及数据(除APP端,APP因采用renderjs,无法获取uCharts实例)
|
|
127
|
-
// #ifndef APP-PLUS
|
|
128
|
-
//如果需要tooltip换行显示,也可以参照本示例,关闭组件本身的tooltip功能,即:tooltipShow="false",然后在@getIndex事件中,通过uCharts.instance[e.id].showToolTip()方法来自定义。
|
|
129
|
-
let textList = [
|
|
130
|
-
{ text: '默认显示的tooltip', color: null },
|
|
131
|
-
{ text: '类别1:某个值xxx', color: '#2fc25b' },
|
|
132
|
-
{ text: '类别2:某个值xxx', color: '#facc14' },
|
|
133
|
-
{ text: '类别3:某个值xxx', color: '#f04864' }
|
|
134
|
-
];
|
|
135
|
-
//这里指定了changedTouches的x和y坐标,当指定index索引时,x值会被自动修正到正确位置,给0即可,主要是y的坐标值
|
|
136
|
-
uCharts.instance[e.id].showToolTip(
|
|
137
|
-
{ changedTouches: [{ x: 0, y: 100 }] },
|
|
138
|
-
{
|
|
139
|
-
index: 3,
|
|
140
|
-
textList: textList
|
|
141
|
-
}
|
|
142
|
-
);
|
|
143
|
-
// #endif
|
|
144
|
-
},
|
|
145
|
-
getIndex(e){
|
|
146
|
-
console.log("获取点击索引事件",e);
|
|
147
|
-
},
|
|
148
|
-
//APP端因为拿不到uCharts的实例,只能通过opts传参的方法来实现tooltip
|
|
149
|
-
showOptsTooltip(e){
|
|
150
|
-
console.log("获取点击索引事件",e);
|
|
151
|
-
//先拿到点击索引,您可以根据索引拼接一下textList
|
|
152
|
-
let currentIndex = e.currentIndex.index;
|
|
153
|
-
if(currentIndex > -1){
|
|
154
|
-
let textList = [
|
|
155
|
-
{text:"我是一个自定义标题"+this.chartsDataColumn1.categories[currentIndex],color:null},
|
|
156
|
-
{ text: '类别1:'+this.chartsDataColumn1.series[0].data[currentIndex], color: '#2fc25b' },
|
|
157
|
-
{ text: '类别2:'+this.chartsDataColumn1.series[1].data[currentIndex], color: '#facc14' },
|
|
158
|
-
];
|
|
159
|
-
this.optsTooltip={
|
|
160
|
-
tooltip:{
|
|
161
|
-
index:currentIndex,
|
|
162
|
-
offset:{
|
|
163
|
-
x:e.opts.chartData.xAxisPoints[currentIndex]+e.opts.chartData.xAxisData.eachSpacing/2,//这里的x坐标为了与x轴categories中的点位对齐,我调用的opts中的参数
|
|
164
|
-
y:e.event.y,//y坐标,用的是点击的点位的y值
|
|
165
|
-
},
|
|
166
|
-
textList:textList
|
|
167
|
-
},
|
|
168
|
-
update:true
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
//非APP端可以通过uCharts实例来调用uCharts方法来实现自定义tooltip
|
|
173
|
-
showMyTooltip(e){
|
|
174
|
-
console.log("获取点击索引事件",e);
|
|
175
|
-
//拿到canvasId后即e.id,可以通过uCharts.instance[e.id]代表当前的图表实例(除APP端,APP不可在组件外调用uCharts的实例)
|
|
176
|
-
console.log("获取uCharts实例",uCharts.instance[e.id]);
|
|
177
|
-
//uCharts.option[e.id]代表当前的图表的opts(除APP端,APP不可在组件外调用uCharts的实例)
|
|
178
|
-
console.log("uCharts的option",uCharts.option[e.id]);
|
|
179
|
-
//从option(opts)中获取数据
|
|
180
|
-
let categories = uCharts.option[e.id].categories;
|
|
181
|
-
let series = uCharts.option[e.id].series;
|
|
182
|
-
//e.currentIndex是点击的的点位索引值
|
|
183
|
-
let index = e.currentIndex.index;//注意v2.1.2版本后,e.currentIndex是对象,而e.currentIndex.index是索引值,如果是时间轴图表,index在多个series的情况下会是数组
|
|
184
|
-
//自行通过uCharts的实例调用showToolTip方法(APP端不能实现,无法通过renderjs获取到uCharts实例)
|
|
185
|
-
// #ifndef APP-PLUS
|
|
186
|
-
//如果需要tooltip换行显示,也可以参照本示例,关闭组件本身的tooltip功能,即:tooltipShow="false",然后在@getIndex事件中,通过uCharts.instance[e.id].showToolTip()方法来自定义。
|
|
187
|
-
let textList = [{ text: categories[index] + "年收入情况", color: null }];
|
|
188
|
-
for (let i = 0; i < series.length; i++) {
|
|
189
|
-
textList.push({text: "自定义" + series[i].name + ":" + series[i].data[index] + "美元", color: series[i].color})
|
|
190
|
-
}
|
|
191
|
-
//changedTouches是点击的坐标值
|
|
192
|
-
uCharts.instance[e.id].showToolTip(
|
|
193
|
-
{ changedTouches: [e.event] },
|
|
194
|
-
{
|
|
195
|
-
index: index,
|
|
196
|
-
textList: textList
|
|
197
|
-
}
|
|
198
|
-
);
|
|
199
|
-
// #endif
|
|
200
|
-
|
|
201
|
-
},
|
|
202
|
-
getTouchMove(e){
|
|
203
|
-
console.log("获取TouchMove",e);
|
|
204
|
-
},
|
|
205
|
-
changeErrorMessage(){
|
|
206
|
-
this.errorMessage="自定义错误信息,关闭点击重新加载"+Math.floor(Math.random() * 1000)
|
|
207
|
-
},
|
|
208
|
-
createImage(refid){
|
|
209
|
-
this.$refs[refid].getImage();
|
|
210
|
-
},
|
|
211
|
-
getImage(e){
|
|
212
|
-
console.log(e);
|
|
213
|
-
},
|
|
214
|
-
error(e){
|
|
215
|
-
console.log("组件传递过来的错误信息",e);
|
|
216
|
-
//TODO something 重新加载或者其他你想干的事
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
};
|
|
220
|
-
</script>
|
|
221
|
-
|
|
222
|
-
<style>
|
|
223
|
-
.content {
|
|
224
|
-
display: flex;
|
|
225
|
-
flex-direction: column;
|
|
226
|
-
flex: 1;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
.charts-box {
|
|
230
|
-
width: 100%;
|
|
231
|
-
height: 300px;
|
|
232
|
-
}
|
|
233
|
-
</style>
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view class="content">
|
|
3
|
-
<view class="uni-tabs__header">
|
|
4
|
-
<view class="uni-tabs__nav-wrap">
|
|
5
|
-
<view class="uni-tabs__nav-scroll">
|
|
6
|
-
<scroll-view class="uni-tabs__nav" :scroll-x="true">
|
|
7
|
-
<block v-for="(item, index) in menus" :key="index">
|
|
8
|
-
<view @click="switchTab(item.value)" :class="{'is-active':currentTab===item.value}" class="uni-tabs__item">{{item.text}}</view>
|
|
9
|
-
</block>
|
|
10
|
-
</scroll-view>
|
|
11
|
-
</view>
|
|
12
|
-
</view>
|
|
13
|
-
</view>
|
|
14
|
-
<view v-show="currentTab==='ucharts1'">
|
|
15
|
-
<!-- 如果tab切换的父容器使用了v-show来控制显示,组件上需绑定reshow属性用于强制重新渲染图表。如组件父元素没有v-show,则不必传此参数。-->
|
|
16
|
-
<qiun-title-bar title="基本柱状图"/>
|
|
17
|
-
<view class="charts-box">
|
|
18
|
-
<!-- 这里因为是页面初始化默认显示的,如果不给reshow也会显示,切换回来也不会变成白板,但切换到其他tab后,改变了窗口尺寸再切换回来后,没有reshow则不会根据改变后的窗口自动适应(除非在当前tab显示的情况下再变更窗口大小才会自适应),所以建议加上reshow属性 -->
|
|
19
|
-
<qiun-data-charts type="column" :chartData="chartsDataColumn1" />
|
|
20
|
-
</view>
|
|
21
|
-
<qiun-title-bar title="堆叠柱状图"/>
|
|
22
|
-
<view class="charts-box">
|
|
23
|
-
<!-- 这个图加了reshow属性,上图没加,可以对比一下差异 -->
|
|
24
|
-
<qiun-data-charts type="column" :opts="{extra:{column:{type:'stack'}}}" :chartData="chartsDataColumn2" :reshow="currentTab==='ucharts1'"/>
|
|
25
|
-
</view>
|
|
26
|
-
|
|
27
|
-
</view>
|
|
28
|
-
<view v-if="currentTab==='ucharts2'">
|
|
29
|
-
<!-- 第二个选项卡页面,用v-if控制则不需要加reshow,父元素使用v-if后,会导致组件重新加载,造成资源浪费 -->
|
|
30
|
-
<qiun-title-bar title="基本饼状图"/>
|
|
31
|
-
<view class="charts-box">
|
|
32
|
-
<qiun-data-charts type="pie" :chartData="chartsDataPie1"/>
|
|
33
|
-
</view>
|
|
34
|
-
<qiun-title-bar title="环形图"/>
|
|
35
|
-
<view class="charts-box">
|
|
36
|
-
<qiun-data-charts type="ring" :opts="{extra:{ring:{ringWidth: 60,linearType:'custom'}}}" :chartData="chartsDataRing1"/>
|
|
37
|
-
</view>
|
|
38
|
-
</view>
|
|
39
|
-
<view v-show="currentTab==='echarts1'">
|
|
40
|
-
<qiun-title-bar title="基本折线图"/>
|
|
41
|
-
<view class="charts-box">
|
|
42
|
-
<qiun-data-charts type="line" :chartData="chartsDataLine1" :echartsH5="true" :echartsApp="true" :reshow="currentTab==='echarts1'"/>
|
|
43
|
-
</view>
|
|
44
|
-
<qiun-title-bar title="基本柱状图" />
|
|
45
|
-
<view class="charts-box">
|
|
46
|
-
<qiun-data-charts type="column" :chartData="chartsDataColumn1" :echartsH5="true" :echartsApp="true" :reshow="currentTab==='echarts1'"/>
|
|
47
|
-
</view>
|
|
48
|
-
</view>
|
|
49
|
-
<!-- ECharts如果父元素用了v-if,因renderjs与逻辑层通信不同步,可能会导致初始化时监听不到prop变化,不能成功初始化,虽然组件内使用延时200ms的方法返回逻辑层强制重新读取数据,但这不是正确的解决问题的办法,并且父元素使用了 v-if 会导致组件重新加载,造成资源浪费,强烈建议将v-if改成v-show!!! -->
|
|
50
|
-
<view v-if="currentTab==='echarts2'">
|
|
51
|
-
<qiun-title-bar title="基本柱状图"/>
|
|
52
|
-
<view class="charts-box">
|
|
53
|
-
<qiun-data-charts type="column" :chartData="chartsDataColumn1" :echartsH5="true" :echartsApp="true" :reshow="currentTab==='echarts2'"/>
|
|
54
|
-
</view>
|
|
55
|
-
<qiun-title-bar title="基本折线图" />
|
|
56
|
-
<view class="charts-box">
|
|
57
|
-
<qiun-data-charts type="line" :chartData="chartsDataLine1" :echartsH5="true" :echartsApp="true" :reshow="currentTab==='echarts2'"/>
|
|
58
|
-
</view>
|
|
59
|
-
</view>
|
|
60
|
-
</view>
|
|
61
|
-
</template>
|
|
62
|
-
|
|
63
|
-
<script>
|
|
64
|
-
//下面是演示数据,您的项目不需要引用,数据需要您从服务器自行获取
|
|
65
|
-
import demodata from '@/mockdata/demodata.json';
|
|
66
|
-
|
|
67
|
-
export default {
|
|
68
|
-
data() {
|
|
69
|
-
return {
|
|
70
|
-
chartsDataColumn1:{},
|
|
71
|
-
chartsDataColumn2:{},
|
|
72
|
-
chartsDataPie1:{},
|
|
73
|
-
chartsDataRing1:{},
|
|
74
|
-
chartsDataLine1:{},
|
|
75
|
-
chartsDataLine2:{},
|
|
76
|
-
menus:[{text:"uCharts图1",value:"ucharts1"},{text:"uCharts图2",value:"ucharts2"},{text:"ECharts图1",value:"echarts1"},{text:"ECharts图2",value:"echarts2"}],
|
|
77
|
-
currentTab: 'ucharts1',
|
|
78
|
-
};
|
|
79
|
-
},
|
|
80
|
-
onLoad() {
|
|
81
|
-
//模拟从服务器获取数据
|
|
82
|
-
this.getServerData()
|
|
83
|
-
},
|
|
84
|
-
methods: {
|
|
85
|
-
getServerData() {
|
|
86
|
-
setTimeout(() => {
|
|
87
|
-
//因部分数据格式一样,这里不同图表引用同一数据源的话,需要深拷贝一下构造不同的对象
|
|
88
|
-
//开发者需要自行处理服务器返回的数据,应与标准数据格式一致,注意series的data数值应为数字格式
|
|
89
|
-
this.chartsDataColumn1=JSON.parse(JSON.stringify(demodata.Column))
|
|
90
|
-
this.chartsDataColumn2=JSON.parse(JSON.stringify(demodata.Column))
|
|
91
|
-
this.chartsDataPie1=JSON.parse(JSON.stringify(demodata.PieA))
|
|
92
|
-
this.chartsDataRing1=JSON.parse(JSON.stringify(demodata.PieA))
|
|
93
|
-
this.chartsDataLine1=JSON.parse(JSON.stringify(demodata.Line))
|
|
94
|
-
this.chartsDataLine2=JSON.parse(JSON.stringify(demodata.Line))
|
|
95
|
-
}, 1500);
|
|
96
|
-
},
|
|
97
|
-
switchTab(tab) {
|
|
98
|
-
this.currentTab = tab
|
|
99
|
-
},
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
</script>
|
|
103
|
-
|
|
104
|
-
<style>
|
|
105
|
-
.content {
|
|
106
|
-
display: flex;
|
|
107
|
-
flex-direction: column;
|
|
108
|
-
flex: 1;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.charts-box {
|
|
112
|
-
width: 100%;
|
|
113
|
-
height: 300px;
|
|
114
|
-
}
|
|
115
|
-
</style>
|