ngx-charts: Error: Cannot read property 'getColor' of undefined - Stacked Area Chart

I’m submitting a … (check one with “x”)

[x] bug report => search github for a similar issue or PR before submitting [ ] feature request [ ] support request => Please do not submit support request here

I’m trying to display a Stacked Area Chart

<ngx-charts-bar-horizontal-stacked
   [view]="[400, 300]"
   [results]="results"
   [xAxis]="true"
   [yAxis]="true"
   [legend]="true"
   [legendPosition]="'below'"
   [scheme]="colorScheme"
   [xAxisLabel]="'Date'"
   [yAxisLabel]="'Number'"
   [showXAxisLabel]="true"
   [showYAxisLabel]="true">
</ngx-charts-bar-horizontal-stacked>

Current behavior

In browser logs:

ERROR TypeError: Cannot read property 'getColor' of undefined
    at Object.eval [as updateDirectives] (AreaSeriesComponent.html:6)
    at Object.debugUpdateDirectives [as updateDirectives] (core.js:39364)
    at checkAndUpdateView (core.js:38376)
    at callViewAction (core.js:38742)
    at execComponentViewsAction (core.js:38670)
    at checkAndUpdateView (core.js:38383)
    at callViewAction (core.js:38742)
    at execEmbeddedViewsAction (core.js:38699)
    at checkAndUpdateView (core.js:38377)
    at callViewAction (core.js:38742)

Expected behavior

Display the Stacked Area Chart in browser.

Please tell us about your environment:

  • macOS Mojave: version 10.14.6
  • Google Chrome: version 77.0.3865.90 (Official Build) (64-bit)
  • @swimlane/ngx-charts: ^12.0.1
  • Angular: 8.1.3

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 8
  • Comments: 15 (1 by maintainers)

Most upvoted comments

We’re seeing this as well using ngx-charts-line-chart and ngx-charts in version 11.2.0. The issue only appears in a production build, not in a dev build.

I believe this may be related to #1288. It appears the downgrade mentioned there fixes our issue.

Can anyone who resolved the issue post their packages.json here please?

@oliveirabc check for “d3-time-format” as a sub-dependency of “d3” in your package-lock.json file.

This issue can also be reproduced when passing SingleSeries data into a chart that only takes MultiSeries