You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: GEMINI.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,6 +43,9 @@ This is a legacy AngularJS 1.x wrapper for Chart.js. It has recently been modern
43
43
-**Scale Configuration**: All examples have been updated to the v4 object-based scale syntax.
44
44
-**Mixed Chart Transparency**: When creating mixed-type charts (e.g., Bar + Line), ensure that bar transparency is explicitly set in the `chart-dataset-override` using `backgroundColor` with an alpha channel (e.g., `rgba(69, 183, 205, 0.2)`). This prevents the library's default color logic from potentially applying a solid color over the intended transparent bar.
45
45
-**Test-Driven Refactoring**: The `ChartJs` service is returned as a fresh object from `$get` instead of an object with getters. This ensures compatibility with mocking libraries like **Sinon**, which can have issues spying on or stubbing getter properties.
46
+
-**Performance Optimization (Shallow Watches)**:
47
+
- By default, directives now use `$watchCollection` (shallow) for data attributes to avoid the high overhead of recursive deep-equality checks on large datasets.
48
+
-**Opt-in Deep Watch**: If deep mutations are required, users can set `chart-dataset-watch-deep="true"` on the directive or `datasetWatchDeep: true` globally via `ChartJsProvider`.
46
49
47
50
## Deployment & Versioning
48
51
-**Trunk-Based**: Work happens on `main`. Current modernization is stabilized on `release/v3.0.0-rc.1`.
Copy file name to clipboardExpand all lines: README.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,6 +73,7 @@ Here are the options for all directives:
73
73
-`chart-plugins`: (default: `[]`): array of [Chart.js plugins](http://www.chartjs.org/docs/latest/developers/plugins.html)
74
74
-`chart-display-when-no-data`: (default: `false`): whether to create the chart even if data is empty or undefined
75
75
-`chart-force-update`: (default: `false`): whether to force a chart update even if data references have not changed
76
+
-`chart-dataset-watch-deep`: (default: `false`): whether to use recursive deep watching ($watch with objectEquality: true) for data. By default, the library uses $watchCollection for better performance with large datasets.
76
77
77
78
There is another directive `chart-base` that takes an extra attribute `chart-type` to define the type
Copy file name to clipboardExpand all lines: docs/MIGRATION.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -96,3 +96,7 @@ If you are using TypeScript, `angular-chart.js` now provides built-in types. Not
96
96
-**Global `Chart`**: The library no longer attempts to auto-inject Chart.js; it expects the `Chart` class to be available in the environment.
97
97
-**Encapsulated Defaults**: The library no longer mutates `Chart.defaults`. Opinionated defaults are now internal to `ChartJsProvider`. If you relied on `angular-chart.js` to configure other non-Angular charts globally, you must now configure them manually in `Chart.defaults`.
98
98
-**Events**: Event arguments (like `points` in `chart-click`) now match the Chart.js 4.x `ActiveElement` structure.
99
+
-**Watch Strategy (Performance)**:
100
+
-**Default**: The library now uses `$watchCollection` (shallow watch) for `chart-data`, `chart-labels`, etc. This significantly improves performance for large datasets.
101
+
-**Action Required**: If you were mutating nested arrays/objects *without* changing the top-level reference, the chart will no longer update automatically.
102
+
-**Workaround**: Either update the array reference (preferred) or enable deep watching via `chart-dataset-watch-deep="true"` or `ChartJsProvider.setOptions({datasetWatchDeep: true})`.
0 commit comments