Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

例子"一个页面中多个图表"第二次无法进入 #128

Closed
2 tasks done
jason19659 opened this issue Apr 8, 2018 · 6 comments
Closed
2 tasks done

例子"一个页面中多个图表"第二次无法进入 #128

jason19659 opened this issue Apr 8, 2018 · 6 comments
Labels
bug Something isn't working

Comments

@jason19659
Copy link

jason19659 commented Apr 8, 2018

提问前应该做的事

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

需提供的信息

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

简单描述问题:

例子 “一个页面多个图表”第二次无法进入,
编译例子,
点击“一个页面中多个图表”例子,
点击 <返回
再次点击“一个页面中多个图表”例子,
报错

VM232:1 jsEnginScriptError
Converting circular structure to JSON
TypeError: Converting circular structure to JSON
    at JSON.stringify (<anonymous>)
    at Object.a [as publish] (http://127.0.0.1:55037/appservice/appservice:1228:8044)
    at c (http://127.0.0.1:55037/appservice/__dev__/WAService.js:16:7000)
    at t.sendData (http://127.0.0.1:55037/appservice/__dev__/WAService.js:16:7566)
    at z (http://127.0.0.1:55037/appservice/__dev__/WAService.js:16:4901)
    at Object.t.addView (http://127.0.0.1:55037/appservice/__dev__/WAService.js:16:6005)
    at Function.value (http://127.0.0.1:55037/appservice/__dev__/WAService.js:18:1346)
    at B (http://127.0.0.1:55037/appservice/__dev__/WAService.js:17:11379)
    at L (http://127.0.0.1:55037/appservice/__dev__/WAService.js:17:12665)
    at G (http://127.0.0.1:55037/appservice/__dev__/WAService.js:17:13986)

并且小程序发生进入到很奇怪的状态,编译库1.9.91

@jason19659 jason19659 changed the title 例子一个页面多个图标第二次无法进入 例子"一个页面中多个图表"第二次无法进入 Apr 8, 2018
@Ovilia Ovilia added the bug Something isn't working label Apr 9, 2018
@chaangliu
Copy link

chaangliu commented May 2, 2018

遇到了同样的问题。
----update 20180503 已修复----
详见pull request:
#174
或者我fork的分支:
https://github.com/LarryLawrence/echarts-for-weixin/tree/echarts-for-weixin-pull-request

具体原因可能涉及底层实现,希望能告知以便学习,谢谢~

@cc-holly
Copy link

cc-holly commented May 8, 2018

多个图表你们能展示多个吗?我复制粘贴官网的例子,然后再加了一个图,我发现第三个图展现不出来,前两个图表能正常展示是怎么回事?

@chaangliu
Copy link

@cc-holly 可以展示多个的。猜测你应该是忘记在wxml里添加多个ec-canvas了,或者数据没有加载成功。

@Ovilia
Copy link
Member

Ovilia commented May 8, 2018

#174 已修复

@Ovilia Ovilia closed this as completed May 8, 2018
@cc-holly
Copy link

cc-holly commented May 9, 2018

还是不行,
我的wxml是这么写的:





数据我是直接写死的,用的官网上的例子(三个都是,因为先实验一下):
import * as echarts from '../../ec-canvas/echarts';
Page({
data: {
ecBar: {
onInit: function (canvas, width, height) {
const barChart = echarts.init(canvas, null, {
width: width,
height: height
});
canvas.setChart(barChart);
barChart.setOption(getBarOption());
return barChart;
}
},

ecScatter: {
  onInit: function (canvas, width, height) {
    const scatterChart = echarts.init(canvas, null, {
      width: width,
      height: height
    });
    canvas.setChart(scatterChart);
    scatterChart.setOption(getScatterOption());

    return scatterChart;
  }
},

ecLine:{
  onInit:function(canvas,width,height){
    const lineChart = echarts.init(canvas,null,{
      width:width,
      height:height
    });
    canvas.setChart(lineChart);
    lineChart.setOption(getLineOption());
    return lineChart;
  }
}

},

onReady() {
}
});

function getBarOption() {
return {
title:{
text:'图一'
},
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
series: [{
data: [820, 932, 901, 934, 1290, 1330, 1320],
type: 'line'
}]
}
}

function getScatterOption() {
return {
title:{
text:'图二'
},
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
series: [{
data: [820, 932, 901, 934, 1290, 1330, 1320],
type: 'line',
smooth: true
}]
};
}

function getLineOption(){
return {
xAxis: {
type: 'category',
boundaryGap: false,
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
series: [{
data: [820, 932, 901, 934, 1290, 1330, 1320],
type: 'line',
areaStyle: {}
}]
}
}
然后只显示两个,第三个我检查元素,高度是0,不知道是咋回事

@cc-holly
Copy link

cc-holly commented May 9, 2018

已经解决,要在wxss里面设置height:50%;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants