cats-charts 0.0.53 → 0.0.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +122 -0
- package/assets/images/legend_left.svg +3 -0
- package/assets/images/legend_right.svg +3 -0
- package/fesm2022/cats-charts.mjs +645 -61
- package/fesm2022/cats-charts.mjs.map +1 -1
- package/index.d.ts +216 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -188,9 +188,131 @@ LineChartConfig {
|
|
|
188
188
|
legendFontSize?: number;
|
|
189
189
|
legendContainerWidth?: number; // 0-1
|
|
190
190
|
legendIndicatorHeight?: number; // number value is in px
|
|
191
|
+
|
|
192
|
+
customLegend?: ChartLegendConfig<LineChartConfig['series'][number]>;
|
|
193
|
+
|
|
191
194
|
}
|
|
192
195
|
```
|
|
193
196
|
|
|
197
|
+
### CustomLegend
|
|
198
|
+
|
|
199
|
+
```ts
|
|
200
|
+
type customLegend = {
|
|
201
|
+
enabled?: boolean;
|
|
202
|
+
|
|
203
|
+
// layout/positioning
|
|
204
|
+
layout?: 'horizontal' | 'vertical';
|
|
205
|
+
position?: 'top' | 'bottom' | 'left' | 'right';
|
|
206
|
+
align?: 'start' | 'center' | 'end';
|
|
207
|
+
|
|
208
|
+
// selection behavior
|
|
209
|
+
selectionMode?: 'multiple' | 'single' | 'exclusive';
|
|
210
|
+
|
|
211
|
+
// scrolling / pagination
|
|
212
|
+
scrollable?: boolean;
|
|
213
|
+
maxHeight?: string;
|
|
214
|
+
maxWidth?: string;
|
|
215
|
+
pageSize?: number;
|
|
216
|
+
showPagination?: boolean;
|
|
217
|
+
|
|
218
|
+
// disabling items
|
|
219
|
+
disabled?: boolean;
|
|
220
|
+
disabledNames?: string[];
|
|
221
|
+
|
|
222
|
+
// accessibility / styling
|
|
223
|
+
className?: string;
|
|
224
|
+
ariaLabel?: string;
|
|
225
|
+
legendTextColor?: string;
|
|
226
|
+
legendFontSize?: number;
|
|
227
|
+
|
|
228
|
+
// icon rendering
|
|
229
|
+
icon?: ChartLegendIcon | ((series: TSeries, index: number) => ChartLegendIcon);
|
|
230
|
+
|
|
231
|
+
icons?: Record<string, ChartLegendIcon>;
|
|
232
|
+
|
|
233
|
+
// label formatting
|
|
234
|
+
formatter?: (name: string, item: ChartLegendItem) => string;
|
|
235
|
+
tooltipFormatter?: (item: ChartLegendItem) => string;
|
|
236
|
+
|
|
237
|
+
// grouping
|
|
238
|
+
groupBy?: (item: ChartLegendItem) => string | undefined;
|
|
239
|
+
|
|
240
|
+
// custom Angular template
|
|
241
|
+
itemTemplate?: TemplateRef<ChartLegendTemplateContext>;
|
|
242
|
+
|
|
243
|
+
// virtualization (advanced)
|
|
244
|
+
virtualize?: boolean;
|
|
245
|
+
virtualItemHeight?: number;
|
|
246
|
+
|
|
247
|
+
// hover behavior linking
|
|
248
|
+
hoverLink?: boolean;
|
|
249
|
+
};
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### CustomLegend Example
|
|
253
|
+
|
|
254
|
+
```ts
|
|
255
|
+
customLegend?: {
|
|
256
|
+
// enable/disable legend UI
|
|
257
|
+
enabled?: boolean;
|
|
258
|
+
|
|
259
|
+
// layout
|
|
260
|
+
layout?: 'horizontal' | 'vertical';
|
|
261
|
+
position?: 'top' | 'bottom' | 'left' | 'right';
|
|
262
|
+
align?: 'start' | 'center' | 'end';
|
|
263
|
+
|
|
264
|
+
// selection behavior
|
|
265
|
+
selectionMode?: 'multiple' | 'single' | 'exclusive';
|
|
266
|
+
|
|
267
|
+
// scrolling/pagination
|
|
268
|
+
scrollable?: boolean;
|
|
269
|
+
maxHeight?: string;
|
|
270
|
+
maxWidth?: string;
|
|
271
|
+
pageSize?: number;
|
|
272
|
+
showPagination?: boolean;
|
|
273
|
+
|
|
274
|
+
// disabling items
|
|
275
|
+
disabled?: boolean;
|
|
276
|
+
disabledNames?: string[];
|
|
277
|
+
|
|
278
|
+
// styling & accessibility
|
|
279
|
+
className?: string;
|
|
280
|
+
ariaLabel?: string;
|
|
281
|
+
legendTextColor?: string;
|
|
282
|
+
legendFontSize?: number;
|
|
283
|
+
|
|
284
|
+
// icon configuration
|
|
285
|
+
// - either a static icon
|
|
286
|
+
// - or a function that returns an icon per series/index
|
|
287
|
+
icon?:
|
|
288
|
+
| ChartLegendIcon
|
|
289
|
+
| ((series: TSeries, index: number) => ChartLegendIcon);
|
|
290
|
+
|
|
291
|
+
// mapping of icon names -> icon types
|
|
292
|
+
icons?: Record<string, ChartLegendIcon>;
|
|
293
|
+
|
|
294
|
+
// text formatting
|
|
295
|
+
formatter?: (name: string, item: ChartLegendItem) => string;
|
|
296
|
+
|
|
297
|
+
// tooltip formatting
|
|
298
|
+
tooltipFormatter?: (item: ChartLegendItem) => string;
|
|
299
|
+
|
|
300
|
+
// grouping
|
|
301
|
+
groupBy?: (item: ChartLegendItem) => string | undefined;
|
|
302
|
+
|
|
303
|
+
// custom Angular template (advanced)
|
|
304
|
+
itemTemplate?: TemplateRef<ChartLegendTemplateContext>;
|
|
305
|
+
|
|
306
|
+
// virtualization (advanced)
|
|
307
|
+
virtualize?: boolean;
|
|
308
|
+
virtualItemHeight?: number;
|
|
309
|
+
|
|
310
|
+
// hover linking (advanced)
|
|
311
|
+
hoverLink?: boolean;
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
```
|
|
315
|
+
|
|
194
316
|
## Pie and Donut chart config
|
|
195
317
|
|
|
196
318
|
```ts
|