@tekkare/romulus 0.1.11 → 0.1.12
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
CHANGED
|
@@ -15,12 +15,18 @@ const props = withDefaults(defineProps<{
|
|
|
15
15
|
/** Marche d'escalier : prix, taux de remboursement, decisions datees. */
|
|
16
16
|
step?: boolean
|
|
17
17
|
smooth?: boolean
|
|
18
|
+
/**
|
|
19
|
+
* Libelles des axes gauche et droit. A fournir des qu'une serie porte
|
|
20
|
+
* `axis: 1` : deux unites sur un graphe sans libelle d'axe se lisent mal.
|
|
21
|
+
*/
|
|
22
|
+
axisLabels?: [string, string]
|
|
18
23
|
height?: keyof typeof RM_CHART_HEIGHTS | number
|
|
19
24
|
description?: string
|
|
20
25
|
}>(), {
|
|
21
26
|
area: false,
|
|
22
27
|
step: false,
|
|
23
28
|
smooth: true,
|
|
29
|
+
axisLabels: undefined,
|
|
24
30
|
height: 'standard',
|
|
25
31
|
description: undefined,
|
|
26
32
|
})
|
|
@@ -33,6 +39,7 @@ const option = computed(() =>
|
|
|
33
39
|
step: props.step,
|
|
34
40
|
smooth: props.smooth,
|
|
35
41
|
decal: decal.value,
|
|
42
|
+
axisLabels: props.axisLabels,
|
|
36
43
|
}),
|
|
37
44
|
)
|
|
38
45
|
</script>
|
|
@@ -100,6 +100,13 @@ export interface RmSeriesInput {
|
|
|
100
100
|
color?: string;
|
|
101
101
|
/** Cle d'empilement : deux series avec la meme cle s'empilent. */
|
|
102
102
|
stack?: string;
|
|
103
|
+
/**
|
|
104
|
+
* Axe des ordonnees, 0 a gauche et 1 a droite. A n'utiliser que pour deux
|
|
105
|
+
* series d'UNITES differentes : deux axes sur la meme unite laissent croire
|
|
106
|
+
* a un ecart qui n'existe pas. Le libelle de chaque axe est alors
|
|
107
|
+
* obligatoire, sinon le lecteur ne sait pas quelle courbe lire ou.
|
|
108
|
+
*/
|
|
109
|
+
axis?: 0 | 1;
|
|
103
110
|
}
|
|
104
111
|
/** Bar chart vertical, une ou plusieurs series, empilable. */
|
|
105
112
|
export declare function rmBarVerticalOption(categories: (string | number)[], series: RmSeriesInput[], theme: RmChartTheme, palette: string[], decal?: boolean): {
|
|
@@ -279,6 +286,8 @@ export declare function rmLineOption(categories: (string | number)[], series: Rm
|
|
|
279
286
|
step?: boolean;
|
|
280
287
|
smooth?: boolean;
|
|
281
288
|
decal?: boolean;
|
|
289
|
+
/** Libelles des deux axes, requis des qu'une serie porte `axis: 1`. */
|
|
290
|
+
axisLabels?: [string, string];
|
|
282
291
|
}): {
|
|
283
292
|
legend: {
|
|
284
293
|
top: number;
|
|
@@ -288,6 +297,13 @@ export declare function rmLineOption(categories: (string | number)[], series: Rm
|
|
|
288
297
|
fontFamily: string;
|
|
289
298
|
};
|
|
290
299
|
} | undefined;
|
|
300
|
+
grid: {
|
|
301
|
+
left: number;
|
|
302
|
+
right: number;
|
|
303
|
+
top: number;
|
|
304
|
+
bottom: number;
|
|
305
|
+
containLabel: boolean;
|
|
306
|
+
};
|
|
291
307
|
xAxis: {
|
|
292
308
|
splitLine: {
|
|
293
309
|
show: boolean;
|
|
@@ -307,6 +323,16 @@ export declare function rmLineOption(categories: (string | number)[], series: Rm
|
|
|
307
323
|
data: (string | number)[];
|
|
308
324
|
};
|
|
309
325
|
yAxis: {
|
|
326
|
+
type: string;
|
|
327
|
+
name: string | undefined;
|
|
328
|
+
nameLocation: string;
|
|
329
|
+
nameGap: number;
|
|
330
|
+
nameTextStyle: {
|
|
331
|
+
fontSize: number;
|
|
332
|
+
color: string;
|
|
333
|
+
fontFamily: string;
|
|
334
|
+
align: string;
|
|
335
|
+
};
|
|
310
336
|
axisLabel: {
|
|
311
337
|
fontSize: number;
|
|
312
338
|
color: string;
|
|
@@ -322,11 +348,61 @@ export declare function rmLineOption(categories: (string | number)[], series: Rm
|
|
|
322
348
|
color: string;
|
|
323
349
|
};
|
|
324
350
|
};
|
|
351
|
+
} | ({
|
|
325
352
|
type: string;
|
|
326
|
-
|
|
353
|
+
name: string | undefined;
|
|
354
|
+
nameLocation: string;
|
|
355
|
+
nameGap: number;
|
|
356
|
+
nameTextStyle: {
|
|
357
|
+
fontSize: number;
|
|
358
|
+
color: string;
|
|
359
|
+
fontFamily: string;
|
|
360
|
+
align: string;
|
|
361
|
+
};
|
|
362
|
+
axisLabel: {
|
|
363
|
+
fontSize: number;
|
|
364
|
+
color: string;
|
|
365
|
+
fontFamily: string;
|
|
366
|
+
};
|
|
367
|
+
axisLine: {
|
|
368
|
+
lineStyle: {
|
|
369
|
+
color: string;
|
|
370
|
+
};
|
|
371
|
+
};
|
|
372
|
+
splitLine: {
|
|
373
|
+
lineStyle: {
|
|
374
|
+
color: string;
|
|
375
|
+
};
|
|
376
|
+
};
|
|
377
|
+
} | {
|
|
378
|
+
splitLine: {
|
|
379
|
+
show: boolean;
|
|
380
|
+
};
|
|
381
|
+
type: string;
|
|
382
|
+
name: string | undefined;
|
|
383
|
+
nameLocation: string;
|
|
384
|
+
nameGap: number;
|
|
385
|
+
nameTextStyle: {
|
|
386
|
+
fontSize: number;
|
|
387
|
+
color: string;
|
|
388
|
+
fontFamily: string;
|
|
389
|
+
align: string;
|
|
390
|
+
};
|
|
391
|
+
axisLabel: {
|
|
392
|
+
fontSize: number;
|
|
393
|
+
color: string;
|
|
394
|
+
fontFamily: string;
|
|
395
|
+
};
|
|
396
|
+
axisLine: {
|
|
397
|
+
lineStyle: {
|
|
398
|
+
color: string;
|
|
399
|
+
};
|
|
400
|
+
};
|
|
401
|
+
})[];
|
|
327
402
|
series: {
|
|
328
403
|
type: string;
|
|
329
404
|
name: string | undefined;
|
|
405
|
+
yAxisIndex: 0 | 1 | undefined;
|
|
330
406
|
data: (number | null)[];
|
|
331
407
|
smooth: boolean;
|
|
332
408
|
step: string | undefined;
|
|
@@ -364,13 +440,6 @@ export declare function rmLineOption(categories: (string | number)[], series: Rm
|
|
|
364
440
|
textStyle: {
|
|
365
441
|
fontFamily: string;
|
|
366
442
|
};
|
|
367
|
-
grid: {
|
|
368
|
-
left: number;
|
|
369
|
-
right: number;
|
|
370
|
-
top: number;
|
|
371
|
-
bottom: number;
|
|
372
|
-
containLabel: boolean;
|
|
373
|
-
};
|
|
374
443
|
tooltip: {
|
|
375
444
|
trigger: string;
|
|
376
445
|
backgroundColor: string;
|
|
@@ -90,6 +90,16 @@ export function rmBaseOption(theme, decal = false) {
|
|
|
90
90
|
}
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
|
+
const valueAxis = (theme, label) => ({
|
|
94
|
+
type: "value",
|
|
95
|
+
name: label,
|
|
96
|
+
nameLocation: "end",
|
|
97
|
+
nameGap: 12,
|
|
98
|
+
nameTextStyle: { fontSize: 10, color: theme.dimmedColor, fontFamily: FONT, align: "left" },
|
|
99
|
+
axisLabel: { fontSize: 11, color: theme.mutedColor, fontFamily: FONT },
|
|
100
|
+
axisLine: { lineStyle: { color: theme.axisLine } },
|
|
101
|
+
splitLine: { lineStyle: { color: theme.splitLine } }
|
|
102
|
+
});
|
|
93
103
|
const axisCommon = (theme) => ({
|
|
94
104
|
axisLabel: { fontSize: 11, color: theme.mutedColor, fontFamily: FONT },
|
|
95
105
|
axisLine: { lineStyle: { color: theme.axisLine } },
|
|
@@ -135,17 +145,27 @@ export function rmBarHorizontalOption(labels, values, theme, palette, decal = fa
|
|
|
135
145
|
};
|
|
136
146
|
}
|
|
137
147
|
export function rmLineOption(categories, series, theme, palette, options = {}) {
|
|
138
|
-
const { area = false, step = false, smooth = true, decal = false } = options;
|
|
148
|
+
const { area = false, step = false, smooth = true, decal = false, axisLabels } = options;
|
|
149
|
+
const dual = series.some((s) => s.axis === 1);
|
|
139
150
|
return {
|
|
140
151
|
...rmBaseOption(theme, decal),
|
|
141
|
-
|
|
152
|
+
// Legende obligatoire en double axe : sans elle, rien ne dit quelle courbe
|
|
153
|
+
// se lit sur quel axe.
|
|
154
|
+
legend: series.length > 1 || dual ? { top: 0, textStyle: { color: theme.mutedColor, fontSize: 11, fontFamily: FONT } } : void 0,
|
|
155
|
+
grid: { left: 48, right: dual ? 56 : 16, top: dual ? 40 : 24, bottom: 36, containLabel: true },
|
|
142
156
|
xAxis: { type: "category", data: categories, ...axisCommon(theme), splitLine: { show: false }, boundaryGap: false },
|
|
143
|
-
yAxis:
|
|
157
|
+
yAxis: dual ? [
|
|
158
|
+
valueAxis(theme, axisLabels?.[0]),
|
|
159
|
+
// Le second axe ne rejoue pas la grille : deux grilles superposees
|
|
160
|
+
// rendent le fond illisible.
|
|
161
|
+
{ ...valueAxis(theme, axisLabels?.[1]), splitLine: { show: false } }
|
|
162
|
+
] : valueAxis(theme, axisLabels?.[0]),
|
|
144
163
|
series: series.map((s, i) => {
|
|
145
164
|
const color = s.color ?? palette[i % palette.length];
|
|
146
165
|
return {
|
|
147
166
|
type: "line",
|
|
148
167
|
name: s.name,
|
|
168
|
+
yAxisIndex: dual ? s.axis ?? 0 : void 0,
|
|
149
169
|
data: s.data,
|
|
150
170
|
smooth: step ? false : smooth,
|
|
151
171
|
step: step ? "end" : void 0,
|