为什么 Vega 3 不能与 Angular2 一起使用?
Why Vega 3 is not working with Angular2?
我正在尝试使用 Vega v3 into a very basic Angular v2 skeleton (using typescript v2 and webpack v2), but obtaining unexpected behavior, which I will try to explain below (from here I will omit versions, but the reference will be those specified here).
首先,捆绑版本对我不起作用,所以我决定包含 a provided example and using Vega modules directly.
中列出的所有依赖项
其次,有三个官方示例规范 (first spec, second spec, third spec) 用于测试所描述的设置。
三、运行the base Vega drawing methods chain后每个规格,结果有两种:
- first spec, throws the following error:
EXCEPTION: Error in ./VegaPlotComponent class VegaPlotComponent_Host - inline template:0:0 caused by: Cannot read property 'orient' of undefined
which breaks entire Angular app. Full stack trace here.
- second spec & third spec create a
width="9", height="9"
svg square without apparent reason (2nd spec plot size, 3rd spec plot size)如图1和图2所示
图 1. Vega 图-Angular 组件 DOM 片段检查(开发工具)。
图 2. Vega 图 - Angular 组件 DOM 片段选择(渲染视图)。
那么,为什么 Vega 3 不能与 Angular2 一起使用?
我创建 an issue at the official github repo 同一周我在这里发布了这个问题,但他们像六个月前一样关闭了它,因为自从我询问以来已经发生了重大变化。
目前有很多库可以做到这一点。
我正在尝试使用 Vega v3 into a very basic Angular v2 skeleton (using typescript v2 and webpack v2), but obtaining unexpected behavior, which I will try to explain below (from here I will omit versions, but the reference will be those specified here).
首先,捆绑版本对我不起作用,所以我决定包含 a provided example and using Vega modules directly.
中列出的所有依赖项
其次,有三个官方示例规范 (first spec, second spec, third spec) 用于测试所描述的设置。
三、运行the base Vega drawing methods chain后每个规格,结果有两种:
- first spec, throws the following error:
EXCEPTION: Error in ./VegaPlotComponent class VegaPlotComponent_Host - inline template:0:0 caused by: Cannot read property 'orient' of undefined
which breaks entire Angular app. Full stack trace here. - second spec & third spec create a
width="9", height="9"
svg square without apparent reason (2nd spec plot size, 3rd spec plot size)如图1和图2所示
- first spec, throws the following error:
图 1. Vega 图-Angular 组件 DOM 片段检查(开发工具)。
图 2. Vega 图 - Angular 组件 DOM 片段选择(渲染视图)。
那么,为什么 Vega 3 不能与 Angular2 一起使用?
我创建 an issue at the official github repo 同一周我在这里发布了这个问题,但他们像六个月前一样关闭了它,因为自从我询问以来已经发生了重大变化。
目前有很多库可以做到这一点。