Const app=getApp ();
The function initChart (canvas, width, height) {
Const chart=echarts. Init (canvas, null, {
Width: the width,
Height: height
});
Canvas. SetChart (chart);
Var option={
BackgroundColor: "# FFF",
Color: [" # 37 a2da ", "# 67 e0e3", "# 9 fe6b8"],
Tooltip: {
The trigger: 'axis'
},
Legend: {
Data: [' A ', 'B', 'C']
},
The grid: {
ContainLabel: true
},
XAxis: {
Type: 'category',
BoundaryGap: false,
Data: [' on Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday ' ']
},
YAxis: {
X: 'center',
Type: 'value'
},
Series: [{
Name: 'A commodity,
Type: 'the line',
Smooth: true,
Data: [18, 36, 65, 30, 78, 40, 33]
}, {
Name: 'B' goods,
Type: 'the line',
Smooth: true,
Data: [12, 50, 51, 35, 70, 30, 20]
}, {
Commodity name: 'C',
Type: 'the line',
Smooth: true,
Data: [10, 30, 31, 50, 40, 20, 10]
}]
};
Chart. SetOption (option);
Return chart;
}
Page ({
OnShareAppMessage: function (res) {
Return {
Title: 'ECharts can used in WeChat applet! '
Path: '/pages/index/index,
Success: the function () {},
Fail: the function () {}
}
},
Data: {
Ec: {
The onInit: initChart
}
},
OnReady () {
}
});
No such thing as an error
CodePudding user response:
Json{
"UsingComponents" : {
"Ec - canvas" : "../../ec - canvas/ec - canvas
"}
}
WXML
CodePudding user response:
Is there anyone passing bosses can solve ohooCodePudding user response:
The problems lie in the app. WXSSModified to him, you would have been displayed, I met you and you the same question
* *//* * app. WXSS
The container {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
Display: flex;
The flex - direction: the column;
The align - items: center;
The justify - content: space - between;
box-sizing: border-box;
}
CodePudding user response: