@tekkare/romulus 0.1.40 → 0.1.42
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
|
@@ -11,7 +11,11 @@ import { rmCompact, rmNumber } from '../utils/format'
|
|
|
11
11
|
const props = withDefaults(defineProps<{
|
|
12
12
|
categories: (string | number)[]
|
|
13
13
|
series: RmSeriesInput[]
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* Remplissage degrade sous la courbe. Laisse libre, il se pose tout seul
|
|
16
|
+
* jusqu'a cinq courbes et se retire au-dela, ou les zones se recouvrent.
|
|
17
|
+
* `true` ou `false` tranche a la place de la regle.
|
|
18
|
+
*/
|
|
15
19
|
area?: boolean
|
|
16
20
|
/** Marche d'escalier : prix, taux de remboursement, decisions datees. */
|
|
17
21
|
step?: boolean
|
|
@@ -47,13 +51,13 @@ const props = withDefaults(defineProps<{
|
|
|
47
51
|
height?: keyof typeof RM_CHART_HEIGHTS | number
|
|
48
52
|
description?: string
|
|
49
53
|
}>(), {
|
|
50
|
-
area:
|
|
54
|
+
area: undefined,
|
|
51
55
|
step: false,
|
|
52
56
|
smooth: true,
|
|
53
57
|
axisLabels: undefined,
|
|
54
58
|
valueLabels: false,
|
|
55
59
|
hideValueAxis: false,
|
|
56
|
-
legendPosition: '
|
|
60
|
+
legendPosition: 'bottom',
|
|
57
61
|
startAtZero: false,
|
|
58
62
|
numberFormat: undefined,
|
|
59
63
|
height: 'standard',
|
|
@@ -136,13 +136,21 @@ export interface RmSeriesInput {
|
|
|
136
136
|
/** Bar chart vertical, une ou plusieurs series, empilable. */
|
|
137
137
|
export declare function rmBarVerticalOption(categories: (string | number)[], series: RmSeriesInput[], theme: RmChartTheme, palette: string[], decal?: boolean): {
|
|
138
138
|
legend: {
|
|
139
|
-
|
|
139
|
+
bottom: number;
|
|
140
|
+
left: string;
|
|
140
141
|
textStyle: {
|
|
141
142
|
color: string;
|
|
142
143
|
fontSize: number;
|
|
143
144
|
fontFamily: string;
|
|
144
145
|
};
|
|
145
146
|
} | undefined;
|
|
147
|
+
grid: {
|
|
148
|
+
bottom: number;
|
|
149
|
+
left: number;
|
|
150
|
+
right: number;
|
|
151
|
+
top: number;
|
|
152
|
+
containLabel: boolean;
|
|
153
|
+
};
|
|
146
154
|
xAxis: {
|
|
147
155
|
splitLine: {
|
|
148
156
|
show: boolean;
|
|
@@ -199,13 +207,6 @@ export declare function rmBarVerticalOption(categories: (string | number)[], ser
|
|
|
199
207
|
textStyle: {
|
|
200
208
|
fontFamily: string;
|
|
201
209
|
};
|
|
202
|
-
grid: {
|
|
203
|
-
left: number;
|
|
204
|
-
right: number;
|
|
205
|
-
top: number;
|
|
206
|
-
bottom: number;
|
|
207
|
-
containLabel: boolean;
|
|
208
|
-
};
|
|
209
210
|
tooltip: {
|
|
210
211
|
trigger: string;
|
|
211
212
|
backgroundColor: string;
|
|
@@ -307,6 +308,10 @@ export declare function rmBarHorizontalOption(labels: string[], values: (number
|
|
|
307
308
|
};
|
|
308
309
|
/** Line ou area chart. `step` produit la marche d'escalier des series de prix. */
|
|
309
310
|
export declare function rmLineOption(categories: (string | number)[], series: RmSeriesInput[], theme: RmChartTheme, palette: string[], options?: {
|
|
311
|
+
/**
|
|
312
|
+
* Remplissage degrade sous la courbe. Non precise : automatique jusqu'a
|
|
313
|
+
* AREA_MAX_SERIES courbes.
|
|
314
|
+
*/
|
|
310
315
|
area?: boolean;
|
|
311
316
|
step?: boolean;
|
|
312
317
|
smooth?: boolean;
|
|
@@ -325,7 +330,12 @@ export declare function rmLineOption(categories: (string | number)[], series: Rm
|
|
|
325
330
|
* graphe ne porte plus aucun chiffre.
|
|
326
331
|
*/
|
|
327
332
|
hideValueAxis?: boolean;
|
|
328
|
-
/**
|
|
333
|
+
/**
|
|
334
|
+
* Position de la legende. Par defaut sous le graphe : la carte porte deja
|
|
335
|
+
* son titre en haut, et une legende juste dessous se lit comme un
|
|
336
|
+
* sous-titre. En bas, elle se lit comme ce qu'elle est, la cle des
|
|
337
|
+
* couleurs, une fois la courbe regardee.
|
|
338
|
+
*/
|
|
329
339
|
legendPosition?: 'top' | 'bottom';
|
|
330
340
|
/**
|
|
331
341
|
* Ancre l'axe a zero quand toutes les valeurs sont positives. Sans ca
|
|
@@ -120,7 +120,10 @@ const axisCommon = (theme) => ({
|
|
|
120
120
|
export function rmBarVerticalOption(categories, series, theme, palette, decal = false) {
|
|
121
121
|
return {
|
|
122
122
|
...rmBaseOption(theme, decal),
|
|
123
|
-
legend: series.length > 1 ? {
|
|
123
|
+
legend: series.length > 1 ? { bottom: 0, left: "center", textStyle: { color: theme.mutedColor, fontSize: 11, fontFamily: FONT } } : void 0,
|
|
124
|
+
// La legende passee sous le graphe prend sa place dans la gouttiere basse,
|
|
125
|
+
// sinon elle recouvre les libelles de l'axe des abscisses.
|
|
126
|
+
grid: { ...rmBaseOption(theme, decal).grid, bottom: series.length > 1 ? 56 : 36 },
|
|
124
127
|
xAxis: { type: "category", data: categories, ...axisCommon(theme), splitLine: { show: false } },
|
|
125
128
|
yAxis: { type: "value", ...axisCommon(theme) },
|
|
126
129
|
series: series.map((s, i) => ({
|
|
@@ -158,17 +161,19 @@ export function rmBarHorizontalOption(labels, values, theme, palette, decal = fa
|
|
|
158
161
|
}
|
|
159
162
|
export function rmLineOption(categories, series, theme, palette, options = {}) {
|
|
160
163
|
const {
|
|
161
|
-
area
|
|
164
|
+
area,
|
|
162
165
|
step = false,
|
|
163
166
|
smooth = true,
|
|
164
167
|
decal = false,
|
|
165
168
|
axisLabels,
|
|
166
169
|
valueLabels = false,
|
|
167
170
|
hideValueAxis = false,
|
|
168
|
-
legendPosition = "
|
|
171
|
+
legendPosition = "bottom",
|
|
169
172
|
startAtZero = false,
|
|
170
173
|
valueFormatter
|
|
171
174
|
} = options;
|
|
175
|
+
const AREA_MAX_SERIES = 5;
|
|
176
|
+
const filled = area ?? series.length <= AREA_MAX_SERIES;
|
|
172
177
|
const dual = series.some((s) => s.axis === 1);
|
|
173
178
|
const bottomLegend = legendPosition === "bottom";
|
|
174
179
|
const format = (value) => valueFormatter ? valueFormatter(value) : String(value);
|
|
@@ -222,7 +227,9 @@ export function rmLineOption(categories, series, theme, palette, options = {}) {
|
|
|
222
227
|
// second marqueur au meme endroit. On l'annule par sa taille et non
|
|
223
228
|
// par `symbol: 'none'` : ECharts accroche les etiquettes aux
|
|
224
229
|
// symboles, les supprimer supprime aussi les etiquettes.
|
|
225
|
-
|
|
230
|
+
// Le point est la cible de survol : trop petit, l'infobulle se derobe
|
|
231
|
+
// et les series courtes n'ont plus de reperes lisibles.
|
|
232
|
+
symbolSize: valueLabels ? 0 : 8,
|
|
226
233
|
label: valueLabels ? {
|
|
227
234
|
show: true,
|
|
228
235
|
position: "top",
|
|
@@ -237,7 +244,7 @@ export function rmLineOption(categories, series, theme, palette, options = {}) {
|
|
|
237
244
|
} : void 0,
|
|
238
245
|
lineStyle: { color, width: 2.5 },
|
|
239
246
|
itemStyle: { color },
|
|
240
|
-
areaStyle:
|
|
247
|
+
areaStyle: filled ? {
|
|
241
248
|
color: {
|
|
242
249
|
type: "linear",
|
|
243
250
|
x: 0,
|