echarts-for-weixin icon indicating copy to clipboard operation
echarts-for-weixin copied to clipboard

云开发读取动态数据后tooltip失效

Open dearfaint opened this issue 3 years ago • 0 comments

提问前应该做的事

请确保提问前做了以下事,将完成的项目的 [] 改为 [x]

  • [x] 我已通读过 README
  • [x] 我已阅读过 FAQ

需提供的信息

将符合项的 [] 改为 [x],并补充需要的信息:

简单描述问题:

使用官方例子折线图可以正常显示tooltip 把官方的option数据整个写进云数据库读取后,tooltip失效 image

js部分

`import * as echarts from '../../../ec-canvas/echarts'; const app = getApp(); //自编改造 const db=wx.cloud.database()

async function initChart(canvas, width, height, dpr) { const option = (await db.collection('chart').where({ _id:"859059a5619615200697934416d78434" }).get()).data[0]

const chart = echarts.init(canvas, null, { width: width, height: height, devicePixelRatio: dpr // new }); canvas.setChart(chart); chart.setOption(option); return chart; }

Page({ onShareAppMessage: function (res) { return { title: 'ECharts 可以在微信小程序中使用啦!', path: '/pages/index/index', success: function () { }, fail: function () { } } }, data: { ec: { onInit: initChart } },

onReady() { } }); `

wxml部分

<view class="container"> <ec-canvas type="2d" id="mychart-dom-line" canvas-id="mychart-line" ec="{{ ec }}"></ec-canvas> </view>

wxss部分

` .container{ padding-top:70rpx; width:100%; height:1200rpx;

} ec-canvas { width: 100%; height: 100%; } `

数据库部分

image

预期效果:

图表显示tooltip

实际效果:

image

复现环境:

  • [x] 在微信开发工具中存在该问题
  • [x] 在真机上存在该问题

dearfaint avatar Nov 22 '21 08:11 dearfaint