Ngx-charts: Passing an array of items to `activeEntries` has no effect on the chart

Created on 16 Aug 2018  路  6Comments  路  Source: swimlane/ngx-charts

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 - use StackOverflow (add the ngx-charts tag) or the gitter chat for support questions

Current behavior
Passing an array of values to the activeEntires input on the Horizontal Bar chart has no effect whatsoever.

Expected behavior
I'd expect the items passed to the input to be highlighted.

Reproduction of the problem
The items I pass have the same exact structure than the ones I pass to the [results] input ({name: string, value:number}). The entries are displayed the right way, but adding items to the array passed to [activeEntries] has no effect on the chart. This array is populated on execution time by clicking items in the chart and adding them to it (I've cheked and this works properly). However, I also tried to specify values at init time and does that not work eiter.

  • ngx-charts version: 7.4.0 (I tried most recent versions just to check though and this was still an issue"

  • Angular version: 5.0.0

  • Browser: All

  • Language: Typescript 2.5.3

Most helpful comment

I can't get activeEntries to work for vertical bar charts, pie charts, line charts, or bubble charts either.

All 6 comments

I can't get activeEntries to work for vertical bar charts, pie charts, line charts, or bubble charts either.

+1

Same here, can't get it work on vertical bar chart
Only works on line chart

@trust2065 How did you get it to work on line charts?

I pass in my data and nothing is highlighted

activeEntries = [
    { name: 'date string', value: 85 }
]

Same here

@misteki @clarke94 @matt-lethargic I have this working for vertical stacked charts. I think the documentation for "activeEntries" is sorely lacking, as it does not specify at all what it's expecting. For a stacked vertical bar chart, this function is run for each series/item in the chart:

SeriesVerticalComponent.prototype.isActive = function (entry) {
        if (!this.activeEntries)
            return false;
        var item = this.activeEntries.find(function (d) {
            return entry.name === d.name && entry.series === d.series;
        });
        return item !== undefined;
    };

What you need to pass into activeEntries is just an array of [{name:"",series:""],]" where series is the name of the top level series, and name is the name of the specific entry in the nested series, lol-

Was this page helpful?
0 / 5 - 0 ratings

Related issues

achimha picture achimha  路  3Comments

ianfdk picture ianfdk  路  3Comments

kakalos12 picture kakalos12  路  4Comments

workfel picture workfel  路  3Comments

tobigit picture tobigit  路  4Comments