You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
vue3项目在单独的组件中引入bar,引入方式如下'2',柱形图可以正常渲染出来,但是点击图例控制台会报错,进而导致图片无法再次点击
1、报错信息:
BarView.js?67cc:148 Uncaught TypeError: Cannot read property 'getBaseAxis' of undefined
at BarView._renderNormal (BarView.js?67cc:148)
at BarView.render (BarView.js?67cc:112)
at Task.progress (Chart.js?e887:196)
at Task._doProgress (task.js?9fbc:187)
at Task.perform (task.js?9fbc:153)
at eval (echarts.js?1be7:1639)
at GlobalModel.eval (Global.js?7e63:549)
at Array.forEach ()
at each (util.js?6d8b:206)
at GlobalModel.eachSeries (Global.js?7e63:546)
2、vue组件内引入bar的方式
// 引入 echarts 核心模块,核心模块提供了 echarts 使用必须要的接口。
import * as echarts from 'echarts/core'
// 引入柱状图图表,图表后缀都为 Chart
import {
BarChart
} from 'echarts/charts'
// 引入提示框,标题,直角坐标系组件,组件后缀都为 Component
import {
TitleComponent,
TooltipComponent,
LegendComponent,
GridComponent
} from 'echarts/components'
// 引入 Canvas 渲染器,注意引入 CanvasRenderer 或者 SVGRenderer 是必须的一步
import {
CanvasRenderer
} from 'echarts/renderers'
Hi! We've received your issue and please be patient to get responded. 🎉
The average response time is expected to be within one day for weekdays.
In the meanwhile, please make sure that you have posted enough image to demo your request. You may also check out the API and chart option to get the answer.
If you don't get helped for a long time (over a week) or have an urgent question to ask, you may also send an email to dev@echarts.apache.org. Please attach the issue link if it's a technical question.
If you are interested in the project, you may also subscribe our mailing list.
@zhangqiangzgz It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people, we'd like to suggest using English next time. 🤗
TRANSLATED
TITLE
After clicking the legend, the legend click interaction cannot be used normally
BODY
Version
5.0.2
steps to reproduce
The Vue3 project introduces BAR in a separate component, the introduction method is '2', the column chart can be rendered normally, but click on the legend console to report the error, causing the picture to click again.
1, error message:
Barview.js? 67cc: 148 uncaunht typeerror: Cannot Read Property 'getBaseaxis' of undefined
AT barview._rendernormal (barview.js? 67cc: 148)
AT Barview.render (barview.js? 67cc: 112)
AT Task.Progress (Chart.js? E887: 196)
AT task._doprogress (task.js? 9fbc: 187)
At task.perform (Task.js? 9fbc: 153)
At evAl (Echarts.js? 1BE7: 1639)
At globalmodel.eval (global.js? 7e63: 549)
AT ARRAY.FOREACH ()
AT Each (Util.js? 6D8B: 206)
AT GlobalModel.eachSeries (Global.js? 7e63: 546)
2, the way to introduce BAR in the VUE component
// Introduce the Echarts core module, the core module provides the interface that Echarts uses must have.
Import * as echarts from 'Echarts / Core'
// introduce the histogram chart, the chart suffix is Chart
IMPORT {
Barchart
} from 'Echarts / Charts'
// Introduce the prompt box, title, right angle coordinate component, component suffix is Component
IMPORT {
TitleComponent,
TooltipComponent,
LegendComponent,
Gridcomponent
} from 'Echarts / Components'
// introduce the Canvas renderer, pay attention to introducing CanvasRenderer or svgrenderer is a must
IMPORT {
Canvasrenderer
} from 'echarts / renderers'
// Register must have the components
Echarts.USE
[
BARCHART,
TitleComponent,
TooltipComponent,
LegendComponent,
Gridcomponent,
Canvasrenderer
]
)
What is expected?
Click on the legend without reporting, the legend can be used by clicking interaction.
What is actually happens?
Click on the legend console to report the wrong legend, click interaction, it is not possible to use.
Cylindrical configuration and other code transplant from the original written in Demo, Demo is used in the Echarts official website to be customized by Script In HTML, Demo is used, and there is no image.
Activity
echarts-bot commentedon Feb 24, 2021
Hi! We've received your issue and please be patient to get responded. 🎉
The average response time is expected to be within one day for weekdays.
In the meanwhile, please make sure that you have posted enough image to demo your request. You may also check out the API and chart option to get the answer.
If you don't get helped for a long time (over a week) or have an urgent question to ask, you may also send an email to dev@echarts.apache.org. Please attach the issue link if it's a technical question.
If you are interested in the project, you may also subscribe our mailing list.
Have a nice day! 🍵
echarts-bot commentedon Feb 24, 2021
@zhangqiangzgz It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people, we'd like to suggest using English next time. 🤗
TRANSLATED
TITLE
After clicking the legend, the legend click interaction cannot be used normally
BODY
Version
5.0.2
steps to reproduce
The Vue3 project introduces BAR in a separate component, the introduction method is '2', the column chart can be rendered normally, but click on the legend console to report the error, causing the picture to click again.
1, error message:
Barview.js? 67cc: 148 uncaunht typeerror: Cannot Read Property 'getBaseaxis' of undefined
AT barview._rendernormal (barview.js? 67cc: 148)
AT Barview.render (barview.js? 67cc: 112)
AT Task.Progress (Chart.js? E887: 196)
AT task._doprogress (task.js? 9fbc: 187)
At task.perform (Task.js? 9fbc: 153)
At evAl (Echarts.js? 1BE7: 1639)
At globalmodel.eval (global.js? 7e63: 549)
AT ARRAY.FOREACH ()
AT Each (Util.js? 6D8B: 206)
AT GlobalModel.eachSeries (Global.js? 7e63: 546)
2, the way to introduce BAR in the VUE component
// Introduce the Echarts core module, the core module provides the interface that Echarts uses must have.
Import * as echarts from 'Echarts / Core'
// introduce the histogram chart, the chart suffix is Chart
IMPORT {
Barchart
} from 'Echarts / Charts'
// Introduce the prompt box, title, right angle coordinate component, component suffix is Component
IMPORT {
TitleComponent,
TooltipComponent,
LegendComponent,
Gridcomponent
} from 'Echarts / Components'
// introduce the Canvas renderer, pay attention to introducing CanvasRenderer or svgrenderer is a must
IMPORT {
Canvasrenderer
} from 'echarts / renderers'
// Register must have the components
Echarts.USE
[
BARCHART,
TitleComponent,
TooltipComponent,
LegendComponent,
Gridcomponent,
Canvasrenderer
]
)
What is expected?
Click on the legend without reporting, the legend can be used by clicking interaction.
What is actually happens?
Click on the legend console to report the wrong legend, click interaction, it is not possible to use.
Cylindrical configuration and other code transplant from the original written in Demo, Demo is used in the Echarts official website to be customized by Script In HTML, Demo is used, and there is no image.
zhangqiangzgz commentedon Feb 25, 2021
vue3项目中通过全部/按需两种方式引入echarts,使用官方的配置数据https://echarts.apache.org/examples/zh/editor.html?c=bar-y-category渲染柱形图,点击图例时会出现相同的报错。
[-]点击图例报错后图例点击交互无法正常使用[/-][+]vue3项目点击图例报错后图例点击交互无法正常使用[/+]echarts-bot commentedon Feb 25, 2021
@zhangqiangzgz Please provide a demo for the issue either with https://codepen.io/Ovilia/pen/dyYWXWM , https://www.makeapie.com/editor.html or https://codesandbox.io/s/mystifying-bash-2uthz.
zhangqiangzgz commentedon Mar 1, 2021
参考#14342回复,目前这个问题解决了。
问题原因:vue3项目中echarts.init()创建的实例定义为响应式。经过测试,vue2的写法在data中定义chartInstance或者vue3的写法通过ref定义chartInstance,都会出现该问题。
问题解决:
vue3中echarts.init()创建的实例定义为普通非响应式变量,例如let chartInstance = echars.init()
另外,
vue3项目中通过reactive定义chartInstance,不会出现该问题。
vue2项目中可以在data中定义chartInstance,然后this.chartInstance = echarts.init(),不会出现该问题。
plainheart commentedon Mar 6, 2021
或者可以使用 shallowRef 既然解决了 这个issue 就关闭了。