溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

mpvue中如何使用使用wx-charts圖表插件

發布時間:2021-07-09 11:00:08 來源:億速云 閱讀:186 作者:Leah 欄目:大數據

今天就跟大家聊聊有關mpvue中如何使用使用wx-charts圖表插件,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結了以下內容,希望大家根據這篇文章可以有所收獲。

步驟


git clone git@github.com:xiaolin3303/wx-charts.git

在clone下來的dist文件夾獲得wxcharts-min.js(混淆版本),如果需要進行二次開發,可以使用wxcharts.js然后修改 內容,達到定制化的目的,修改完后可以利用在線混淆進行重新混淆使用。


<!--/src/pages/bar/bar.vue template中內容 --><canvas canvas-id="areaCanvas" class="canvas" @touchstart="touchHandler"></canvas>

// /src/pages/bar/bar.vue script中內容var wxCharts = require('@/lib/wxcharts-min.js');  //該路徑為該js文件在你項目中的路徑export default {	name: "bar",
	data() {		return {			bar: null
		}
	},		
	mounted: function (e) {		var windowWidth = 320;		try {			var res = wx.getSystemInfoSync();
			windowWidth = res.windowWidth;
		} catch (e) {			console.error('getSystemInfoSync failed!');
		}			
		this.bar = new wxCharts({			canvasId: 'areaCanvas',			type: 'area',			categories: ['1', '2', '3', '4', '5', '6'],			animation: true,			series: [{				name: '成交量1',				data: [32, 45, null, 56, 33, 34],				format: function (val) {					return val.toFixed(2) + '萬';
				}
			}],			yAxis: {				title: '成交金額 (萬元)',				format: function (val) {					return val.toFixed(2);
				},				min: 0,					fontColor: '#8085e9',					gridColor: '#8085e9',					titleFontColor: '#f7a35c'
				},				xAxis: {					fontColor: '#7cb5ec',					gridColor: '#7cb5ec'
				},				extra: {					legendTextColor: '#cb2431'
				},				width: windowWidth,				height: 200
			});
		},		methods: {			touchHandler: function (e) {				console.log(this.bar.getCurrentDataIndex(e));				this.bar.showToolTip(e);
			}   
		}
	}

看完上述內容,你們對mpvue中如何使用使用wx-charts圖表插件有進一步的了解嗎?如果還想了解更多知識或者相關內容,請關注億速云行業資訊頻道,感謝大家的支持。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女