File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -185,6 +185,8 @@ custom Stimulus controller:
185
185
console .log (event .detail .config );
186
186
187
187
// For instance you can format Y axis
188
+ // To avoid overriding existing config, you should distinguish 3 cases:
189
+ // # 1. No existing scales config => add a new scales config
188
190
event .detail .config .options .scales = {
189
191
y: {
190
192
ticks: {
@@ -194,6 +196,20 @@ custom Stimulus controller:
194
196
},
195
197
},
196
198
};
199
+ // # 2. Existing scales config without Y axis config => add new Y axis config
200
+ event .detail .config .options .scales .y = {
201
+ ticks: {
202
+ callback : function (value , index , values ) {
203
+ /* ... */
204
+ },
205
+ },
206
+ };
207
+ // # 3. Existing Y axis config => update it
208
+ event .detail .config .options .scales .y .ticks = {
209
+ callback : function (value , index , values ) {
210
+ /* ... */
211
+ },
212
+ };
197
213
}
198
214
199
215
_onConnect (event ) {
You can’t perform that action at this time.
0 commit comments