Dav*_*e B 6 angularjs ngx-charts
我正在设置折线图的一个简单示例,但它因未定义错误的 getColor 失败。如果我删除 [results] 数据,图表会显示,但随后会因丢失数据而失败。不知道如何追踪这个问题?
使用 ngx-charts 12.0.1 我从https://github.com/marjan-georgiev/Angular-CLI-ngx-charts-Demo复制了示例代码,然后在下面的示例中显示的主页中添加了第二个图表。
我尝试删除尽可能多的变量以获得结果。
标签:
<div style="height: 100px">
<ngx-charts-line-chart
[view]="view"
[results]="single"
class="chart-container"
[scheme]="colorScheme"
[legend]="showLegend"
[gradient]="gradient"
[xAxis]="showXAxis"
[yAxis]="showYAxis"
[showXAxisLabel]="showXAxisLabel"
[showYAxisLabel]="showYAxisLabel"
[xAxisLabel]="xAxisLabel"
[yAxisLabel]="yAxisLabel"
(select)="onSelect($event)"
(activate)="onActivate($event)"
(deactivate)="onDeactivate($event)"
>
</ngx-charts-line-chart>
</div>
component data:
single: any[] = [
{
name: "Germany",
value: 8940000
},
{
name: "USA",
value: 5000000
},
{
name: "France",
value: 7200000
},
{
name: "Mars",
value: 720000
}
];
colorScheme = {
domain: ["#5AA454", "#A10A28", "#C7B42C", "#AAAAAA"]
};
Console Error with [results]:
ERROR TypeError: Cannot read property 'getColor' of undefined
at Object.eval [as updateDirectives] (LineSeriesComponent.html:14)
Console Error without [results]:
The chart is build on the page and, of course, empty. The following
error shows up when I click on any portion of the empty chart.
Error: <rect> attribute x: Expected length, "NaN".
platform-browser:1973
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
981 次 |
| 最近记录: |