question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Passing an array of items to `activeEntries` has no effect on the chart

See original GitHub issue

I’m submitting a … (check one with “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

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:25
  • Comments:6

github_iconTop GitHub Comments

10reactions
DonaldAlancommented, Oct 26, 2018

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

1reaction
chriszrccommented, Feb 19, 2021

@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-

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to highlight activeEntries in ngrx-charts - Stack Overflow
i found that activeEntries must be set to an array of objects, which contain the names of series you want to highlight.
Read more >
swimlane/ngx-charts - Gitter
Basically my problem is that passing data to the activeEntries seems to have no effect whatsoever in the chart... I'd just like to...
Read more >
Passing Arrays as Function Arguments in C - Tutorialspoint
If you want to pass a single-dimension array as an argument in a function, you would have to declare a formal parameter in...
Read more >
A practical use of useEffect - nSoft
If item is checked, add the toggled item to the array ... no second argument – the effect will run every time the...
Read more >
Active Record Associations - Ruby on Rails Guides
In Rails, an association is a connection between two Active Record models. ... We pass id: false to create_table because that table does...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found