dc-js / dc.js

Multi-Dimensional charting built to work natively with crossfilter rendered with d3.js
Apache License 2.0
7.42k stars 1.81k forks source link

DataCount issues improper warning #1854

Open onelesd opened 2 years ago

onelesd commented 2 years ago

The following code triggers a warning to the console even though dataCount.dimension() is never directly called.

const chart = document.querySelector('#data-count')
const group = ndx.groupAll()

dc.dataCount(chart).crossfilter(ndx).groupAll(group).html({
  some: '%filter-count of %total-count',
  all: '%total-count',
})

dcChart.render()
Screen Shot 2022-01-05 at 7 06 44 PM
kum-deepak commented 2 years ago

Tested this snippet with dc@4, was unable to reproduce this issue. Which version of dc are you using?

onelesd commented 2 years ago

The warning seems to be triggered by a call to dc.filterAll().

"node_modules/dc": {
  "version": "4.2.7",
  "resolved": "https://registry.npmjs.org/dc/-/dc-4.2.7.tgz",
  "integrity": "sha512-83vzVpBmXFCW7V2uVhBolcPX22d19k4GV7zJWu8jkyNhMstAb/XYl2Eld3Kp71eLD8YM9RsIRgtrmLViQeZTuQ==",
  "dependencies": {
    "d3": "^6.6.2"
  }
},
kum-deepak commented 2 years ago

Many thanks for the added details. This indeed is the case. The dashboard on http://dc-js.github.io/dc.js/ displays this behavior.

The BaseMixin code snippet that calls .dimension() is:

    applyFilters (filters) {
        if (this.dimension() && this.dimension().filter) {
            const fs = this._filterHandler(this.dimension(), filters);
            if (fs) {
                filters = fs;
            }
        }
        return filters;
    }

It will definitely be fixed in the dc-v5, we need to investigate if we can fix it in v4 easily.