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.

How do charts know how to update themselves?

See original GitHub issue

Let’s say I have a chart with a specific dimension and group, such as:

var gender = xf.dimension(function (d) { return d.gender; }),
    genders = gender.group().reduceSum(function (d) { return d.interactions; })

Then I have another chart, which when interacted with (perhaps a pie chart click), it alters the first chart. How does the first chart know that it needs to update based on the value click on the pie chart? I’d imagine it must somehow know about the interactions property in order to rerun the reduce function such as:

// this runs inside the chart
group = group.reduceSum(function (d) {
  if (d.key == valueClicked) return d.interactions;
  else return 0;
})

Do interactions in DC.js actually involve rerunning the reduce functions or does it do it in some other way?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
gordonwoodhullcommented, Apr 11, 2016

In fact, one dimension’s filter will only change the groups on other dimensions, and not the groups on that dimension. It’s documented, but the documentation is very terse.

Note: a grouping intersects the crossfilter’s current filters, except for the associated dimension’s filter. Thus, group methods consider only records that satisfy every filter except this dimension’s filter. So, if the crossfilter of payments is filtered by type and total, then group by total only observes the filter by type.

https://github.com/crossfilter/crossfilter/wiki/API-Reference#dimension_group

I’m going to close this, because there isn’t really a dc.js request here. But hopefully this will help others.

0reactions
lmatteiscommented, Apr 11, 2016

I did not know that calling dimension.filter() for one dimension would also change other groups! Wish this was better documented on crossfilter’s site. Thanks this really cleared it for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Excel Tips: How to Make Charts Auto Update - GCF Global
Luckily, there is an easier way. Simply format your source data as a table, then create a chart based on that table. When...
Read more >
How to Create Self-Updating Microsoft Excel Charts in 3 Easy ...
Self -updating Excel charts are huge timesavers. Use these steps to add new data and watch them automatically show up in a chart....
Read more >
Update the data in an existing chart - Microsoft Support
Changes you make will instantly show up in the chart. Right-click the item you want to change and input the data--or type a...
Read more >
How to auto update a chart after entering new data in Excel?
1. Select the data range and click Table under Insert tab, see screenshot: · 2. In the Create Table dialog box, if your...
Read more >
Automatically Updating Graphs in Word or PowerPoint
I'm giving it away because I love you and I want to make your life easier). This is how you link Excel to...
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