Currently, I am in the process of developing an application that utilizes d3, dc, and crossfilter for rendering charts.
- crossfilter2: v1.4.6
- d3: v3.5.17
- dc: v2.2.1
I have been working on adjusting the Y scale to display only whole numbers without decimals.
When testing my application in development mode using 'ng serve', everything works as expected:
https://i.sstatic.net/iiV5e.png
However, when I build the app in production mode, the Y scale does not behave the same way:
https://i.sstatic.net/o74Ge.png
The difference seems to stem from whether I use 'ng serve' or 'ng build --prod.'
The snippet of code responsible for setting the ticks is:
/* grpProductType is a crossfilter.Group*/
const maxY = d3.max(d3.values(grpProductType))(1)[0]?.value;
if (maxY < 7) {
/* dcStepsByProductType is a dc.BarChart */
dcStepsByProductType.yAxis().ticks(maxY);
}
After some investigation, I found that the issue is related to a specific property in the angular.json file under:
projects => [app name] => architect => build => configurations => production => optimization => scripts
If this property is set to true, the error occurs, but if it's false, the app runs smoothly.
Logs when the value is true (error): https://i.sstatic.net/u4NG5.png
Logs when the value is false (working correctly): https://i.sstatic.net/uMD4a.png
The discrepancy appears to be related to the return value from invoking the 'all' function.
My question now is, what could potentially be causing this discrepancy?