@tekkare/romulus 0.1.141 → 0.1.142
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/dist/module.json +1 -1
- package/dist/runtime/utils/chart.d.ts +13 -22
- package/dist/runtime/utils/chart.js +7 -3
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -94,6 +94,7 @@ export declare function rmBaseOption(theme: RmChartTheme, decal?: boolean): {
|
|
|
94
94
|
borderWidth: number;
|
|
95
95
|
};
|
|
96
96
|
};
|
|
97
|
+
export declare const rmTooltipTrigger: (count: number) => "axis" | "item";
|
|
97
98
|
export declare function rmLegend(theme: RmChartTheme, count: number, position?: 'top' | 'bottom'): {
|
|
98
99
|
pageIconSize?: number | undefined;
|
|
99
100
|
pageIconColor?: string | undefined;
|
|
@@ -177,6 +178,17 @@ export interface RmSeriesInput {
|
|
|
177
178
|
}
|
|
178
179
|
/** Bar chart vertical, une ou plusieurs series, empilable. */
|
|
179
180
|
export declare function rmBarVerticalOption(categories: (string | number)[], series: RmSeriesInput[], theme: RmChartTheme, palette: string[], decal?: boolean): {
|
|
181
|
+
tooltip: {
|
|
182
|
+
trigger: string;
|
|
183
|
+
backgroundColor: string;
|
|
184
|
+
textStyle: {
|
|
185
|
+
color: string;
|
|
186
|
+
fontFamily: string;
|
|
187
|
+
fontSize: number;
|
|
188
|
+
};
|
|
189
|
+
borderColor: string;
|
|
190
|
+
borderWidth: number;
|
|
191
|
+
};
|
|
180
192
|
legend: {
|
|
181
193
|
pageIconSize?: number | undefined;
|
|
182
194
|
pageIconColor?: string | undefined;
|
|
@@ -282,17 +294,6 @@ export declare function rmBarVerticalOption(categories: (string | number)[], ser
|
|
|
282
294
|
textStyle: {
|
|
283
295
|
fontFamily: string;
|
|
284
296
|
};
|
|
285
|
-
tooltip: {
|
|
286
|
-
trigger: string;
|
|
287
|
-
backgroundColor: string;
|
|
288
|
-
textStyle: {
|
|
289
|
-
color: string;
|
|
290
|
-
fontFamily: string;
|
|
291
|
-
fontSize: number;
|
|
292
|
-
};
|
|
293
|
-
borderColor: string;
|
|
294
|
-
borderWidth: number;
|
|
295
|
-
};
|
|
296
297
|
};
|
|
297
298
|
/** Bar chart horizontal, avec valeur affichee en bout de barre. */
|
|
298
299
|
export declare function rmBarHorizontalOption(labels: string[], values: (number | null)[], theme: RmChartTheme, palette: string[], decal?: boolean, formatter?: (value: number) => string): {
|
|
@@ -422,17 +423,7 @@ export declare function rmLineOption(categories: (string | number)[], series: Rm
|
|
|
422
423
|
valueFormatter?: (value: number) => string;
|
|
423
424
|
}): {
|
|
424
425
|
tooltip: {
|
|
425
|
-
|
|
426
|
-
backgroundColor: string;
|
|
427
|
-
textStyle: {
|
|
428
|
-
color: string;
|
|
429
|
-
fontFamily: string;
|
|
430
|
-
fontSize: number;
|
|
431
|
-
};
|
|
432
|
-
borderColor: string;
|
|
433
|
-
borderWidth: number;
|
|
434
|
-
} | {
|
|
435
|
-
valueFormatter: (value: unknown) => string;
|
|
426
|
+
valueFormatter?: ((value: unknown) => string) | undefined;
|
|
436
427
|
trigger: string;
|
|
437
428
|
backgroundColor: string;
|
|
438
429
|
textStyle: {
|
|
@@ -90,6 +90,8 @@ export function rmBaseOption(theme, decal = false) {
|
|
|
90
90
|
}
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
|
+
const TOOLTIP_AXIS_MIN_SERIES = 10;
|
|
94
|
+
export const rmTooltipTrigger = (count) => count < TOOLTIP_AXIS_MIN_SERIES ? "item" : "axis";
|
|
93
95
|
const LEGEND_MAX_INLINE = 6;
|
|
94
96
|
const LEGEND_NAME_MAX = 38;
|
|
95
97
|
const LEGEND_NAME_TAIL = 12;
|
|
@@ -141,6 +143,7 @@ const axisCommon = (theme) => ({
|
|
|
141
143
|
export function rmBarVerticalOption(categories, series, theme, palette, decal = false) {
|
|
142
144
|
return {
|
|
143
145
|
...rmBaseOption(theme, decal),
|
|
146
|
+
tooltip: { ...rmBaseOption(theme, decal).tooltip, trigger: rmTooltipTrigger(series.length) },
|
|
144
147
|
legend: series.length > 1 ? rmLegend(theme, series.length) : void 0,
|
|
145
148
|
// La legende passee sous le graphe prend sa place dans la gouttiere basse,
|
|
146
149
|
// sinon elle recouvre les libelles de l'axe des abscisses.
|
|
@@ -205,10 +208,11 @@ export function rmLineOption(categories, series, theme, palette, options = {}) {
|
|
|
205
208
|
const base = rmBaseOption(theme, decal);
|
|
206
209
|
return {
|
|
207
210
|
...base,
|
|
208
|
-
tooltip:
|
|
211
|
+
tooltip: {
|
|
209
212
|
...base.tooltip,
|
|
210
|
-
|
|
211
|
-
|
|
213
|
+
trigger: rmTooltipTrigger(series.length),
|
|
214
|
+
...valueFormatter ? { valueFormatter: (value) => typeof value === "number" ? format(value) : "" } : {}
|
|
215
|
+
},
|
|
212
216
|
// Legende obligatoire en double axe : sans elle, rien ne dit quelle courbe
|
|
213
217
|
// se lit sur quel axe.
|
|
214
218
|
legend: series.length > 1 || dual ? rmLegend(theme, series.length, legendPosition) : void 0,
|