123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- import * as echarts from '../../ec-canvas/echarts';
- var app = getApp()
- function initChart(canvas, width, height, dpr) {
- const chart = echarts.init(canvas, null, {
- width: width,
- height: height,
- devicePixelRatio: dpr // new
- });
- canvas.setChart(chart);
- var option = {
- title: {
- text: '测试下面legend的红色区域不应被裁剪',
- left: 'center'
- },
- color: ["#37A2DA", "#67E0E3", "#9FE6B8"],
- legend: {
- data: ['A', 'B', 'C'],
- top: 50,
- left: 'center',
- backgroundColor: 'red',
- z: 100
- },
- grid: {
- containLabel: true
- },
- tooltip: {
- show: true,
- trigger: 'axis'
- },
- xAxis: {
- type: 'category',
- boundaryGap: false,
- data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
- // show: false
- },
- yAxis: {
- x: 'center',
- type: 'value',
- splitLine: {
- lineStyle: {
- type: 'dashed'
- }
- }
- // show: false
- },
- series: [{
- name: 'A',
- type: 'line',
- smooth: true,
- data: [18, 36, 65, 30, 78, 40, 33]
- }, {
- name: 'B',
- type: 'line',
- smooth: true,
- data: [12, 50, 51, 35, 70, 30, 20]
- }, {
- name: 'C',
- type: 'line',
- smooth: true,
- data: [10, 30, 31, 50, 40, 20, 10]
- }]
- };
- chart.setOption(option);
- return chart;
- }
- Page({
- data: {
- // 页面配置
- winWidth: 0,
- winHeight: 0,
- // tab切换
- currentTab: 0,
- array:[
- {
- title:'AppL',
- subtitle:"APPL INC",
- Increase:"1.22",
- digital:"33"
- }
- ],
- ec: {
- onInit: initChart
- }
- },
- onLoad: function() {
- var that = this;
- // 获取系统信息
- wx.getSystemInfo({
- success: function(res) {
- that.setData({
- winWidth: res.windowWidth,
- winHeight: res.windowHeight
- });
- }
- });
- },
- // 滑动切换tab
- bindChange: function(e) {
- var that = this;
- that.setData({
- currentTab: e.detail.current
- });
- },
- // 点击tab切换
- swichNav: function(e) {
- var that = this;
- if (this.data.currentTab === e.target.dataset.current) {
- return false;
- } else {
- that.setData({
- currentTab: e.target.dataset.current
- })
- }
- }
- })
|