@icij/murmur-next 4.0.1 → 4.0.3
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/lib/components/AccordionStep.vue +53 -42
- package/lib/components/AccordionWrapper.vue +25 -24
- package/lib/components/ActiveTextTruncate.vue +44 -22
- package/lib/components/AdvancedLinkForm.vue +96 -46
- package/lib/components/Brand.vue +30 -23
- package/lib/components/BrandExpansion.vue +12 -3
- package/lib/components/ConfirmButton.vue +30 -26
- package/lib/components/ContentPlaceholder.vue +11 -7
- package/lib/components/CustomPagination.vue +50 -32
- package/lib/components/DigitsInput.vue +64 -60
- package/lib/components/DonateForm.vue +112 -83
- package/lib/components/EmbedForm.vue +37 -21
- package/lib/components/EmbeddableFooter.vue +14 -10
- package/lib/components/FollowUsPopover.vue +42 -40
- package/lib/components/GenericFooter.vue +98 -23
- package/lib/components/GenericHeader.vue +66 -29
- package/lib/components/HapticCopy.vue +41 -29
- package/lib/components/ImddbHeader.vue +113 -92
- package/lib/components/OrdinalLegend.vue +43 -20
- package/lib/components/RangePicker.vue +63 -42
- package/lib/components/ResponsiveIframe.vue +9 -2
- package/lib/components/ScaleLegend.vue +56 -18
- package/lib/components/SecretInput.vue +7 -8
- package/lib/components/SelectableDropdown.vue +119 -74
- package/lib/components/SharingOptions.vue +93 -36
- package/lib/components/SharingOptionsLink.vue +11 -5
- package/lib/components/SignUpForm.vue +44 -23
- package/lib/components/SlideUpDown.vue +7 -2
- package/lib/components/TexturedDeck.vue +24 -14
- package/lib/components/TinyPagination.vue +35 -22
- package/lib/composables/chart.ts +174 -157
- package/lib/composables/resizeObserver.ts +29 -29
- package/lib/composables/sendEmail.ts +53 -42
- package/lib/config.default.ts +17 -10
- package/lib/config.ts +34 -27
- package/lib/datavisualisations/BarChart.vue +48 -42
- package/lib/datavisualisations/ColumnChart.vue +133 -89
- package/lib/datavisualisations/LineChart.vue +79 -57
- package/lib/datavisualisations/StackedBarChart.vue +116 -68
- package/lib/datavisualisations/StackedColumnChart.vue +196 -115
- package/lib/enums.ts +25 -15
- package/lib/i18n.ts +3 -3
- package/lib/keys.ts +2 -2
- package/lib/main.ts +14 -10
- package/lib/maps/ChoroplethMap.vue +299 -160
- package/lib/maps/ChoroplethMapAnnotation.vue +29 -18
- package/lib/maps/SymbolMap.vue +194 -123
- package/lib/shims-bootstrap-vue.d.ts +1 -1
- package/lib/shims-vue.d.ts +3 -3
- package/lib/styles/functions.scss +10 -6
- package/lib/styles/lib.scss +2 -4
- package/lib/styles/mixins.scss +8 -8
- package/lib/styles/utilities.scss +1 -1
- package/lib/styles/variables.scss +24 -18
- package/lib/types.ts +26 -10
- package/lib/utils/animation.ts +4 -4
- package/lib/utils/assets.ts +31 -28
- package/lib/utils/clipboard.ts +16 -10
- package/lib/utils/iframe-resizer.ts +18 -13
- package/lib/utils/placeholder.ts +54 -23
- package/lib/utils/placeholderTypes.ts +3 -3
- package/package.json +7 -2
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
1
|
<script lang="ts">
|
|
4
2
|
// import { VBTooltip } from 'bootstrap-vue/esm/directives/tooltip/tooltip'
|
|
5
3
|
import * as d3 from 'd3'
|
|
@@ -9,8 +7,15 @@ import get from 'lodash/get'
|
|
|
9
7
|
import identity from 'lodash/identity'
|
|
10
8
|
import sortBy from 'lodash/sortBy'
|
|
11
9
|
import without from 'lodash/without'
|
|
12
|
-
import {
|
|
13
|
-
|
|
10
|
+
import {
|
|
11
|
+
ComponentPublicInstance,
|
|
12
|
+
computed,
|
|
13
|
+
defineComponent,
|
|
14
|
+
ref,
|
|
15
|
+
nextTick,
|
|
16
|
+
watch
|
|
17
|
+
} from 'vue'
|
|
18
|
+
import { chartProps, getChartProps, useChart } from '@/composables/chart.js'
|
|
14
19
|
|
|
15
20
|
export default defineComponent({
|
|
16
21
|
name: 'StackedColumnChart',
|
|
@@ -71,7 +76,7 @@ export default defineComponent({
|
|
|
71
76
|
*/
|
|
72
77
|
xAxisTickFormat: {
|
|
73
78
|
type: [Function, String],
|
|
74
|
-
default: ()=>identity
|
|
79
|
+
default: () => identity
|
|
75
80
|
},
|
|
76
81
|
/**
|
|
77
82
|
* Function to apply to format y axis ticks (bars value). It can be a
|
|
@@ -79,7 +84,7 @@ export default defineComponent({
|
|
|
79
84
|
*/
|
|
80
85
|
yAxisTickFormat: {
|
|
81
86
|
type: [Function, String],
|
|
82
|
-
default: ()=>identity
|
|
87
|
+
default: () => identity
|
|
83
88
|
},
|
|
84
89
|
/**
|
|
85
90
|
* Padding on y axis ticks
|
|
@@ -151,11 +156,17 @@ export default defineComponent({
|
|
|
151
156
|
default: null
|
|
152
157
|
},
|
|
153
158
|
/**
|
|
154
|
-
|
|
159
|
+
* Function to define tooltip content.
|
|
155
160
|
*/
|
|
156
161
|
tooltipDisplay: {
|
|
157
162
|
type: Function,
|
|
158
|
-
default:
|
|
163
|
+
default: ({
|
|
164
|
+
formattedKey,
|
|
165
|
+
formattedValue
|
|
166
|
+
}: {
|
|
167
|
+
formattedKey: string
|
|
168
|
+
formattedValue: string
|
|
169
|
+
}): string => {
|
|
159
170
|
return `<h6 class="mb-0">${formattedKey}</h6><div>${formattedValue}</div>`
|
|
160
171
|
}
|
|
161
172
|
},
|
|
@@ -167,7 +178,7 @@ export default defineComponent({
|
|
|
167
178
|
},
|
|
168
179
|
...chartProps()
|
|
169
180
|
},
|
|
170
|
-
setup(props,{emit}){
|
|
181
|
+
setup(props, { emit }) {
|
|
171
182
|
const width = ref(0)
|
|
172
183
|
const height = ref(0)
|
|
173
184
|
const leftAxisHeight = ref(0)
|
|
@@ -182,12 +193,14 @@ export default defineComponent({
|
|
|
182
193
|
loadedData,
|
|
183
194
|
d3Formatter,
|
|
184
195
|
dataHasHighlights
|
|
185
|
-
} = useChart(el, getChartProps(props), {emit}, isLoaded, setSizes)
|
|
196
|
+
} = useChart(el, getChartProps(props), { emit }, isLoaded, setSizes)
|
|
186
197
|
const sortedData = computed(() => {
|
|
187
198
|
if (!isLoaded.value) {
|
|
188
199
|
return []
|
|
189
200
|
}
|
|
190
|
-
return !props.sortBy
|
|
201
|
+
return !props.sortBy
|
|
202
|
+
? loadedData.value
|
|
203
|
+
: sortBy(loadedData.value, props.sortBy)
|
|
191
204
|
})
|
|
192
205
|
|
|
193
206
|
const discoveredKeys = computed((): any[] => {
|
|
@@ -200,41 +213,58 @@ export default defineComponent({
|
|
|
200
213
|
return without(keys(loadedData.value[0]), props.labelField)
|
|
201
214
|
})
|
|
202
215
|
const colorScale = computed(() => {
|
|
203
|
-
return d3
|
|
216
|
+
return d3
|
|
217
|
+
.scaleOrdinal()
|
|
218
|
+
.domain(discoveredKeys.value)
|
|
219
|
+
.range(props.barColors)
|
|
204
220
|
})
|
|
205
221
|
|
|
206
222
|
const hasHighlights = computed(() => {
|
|
207
223
|
return !!highlightedKeys.value.length
|
|
208
224
|
})
|
|
209
225
|
|
|
210
|
-
// different
|
|
226
|
+
// different
|
|
211
227
|
|
|
212
|
-
const hasColumnHighlights= computed(() => {
|
|
228
|
+
const hasColumnHighlights = computed(() => {
|
|
213
229
|
return !!props.columnHighlights.length
|
|
214
230
|
})
|
|
215
|
-
const leftScale= computed(() =>{
|
|
216
|
-
return d3
|
|
231
|
+
const leftScale = computed(() => {
|
|
232
|
+
return d3
|
|
233
|
+
.scaleLinear()
|
|
234
|
+
.domain([0, maxRowValue.value])
|
|
235
|
+
.range([leftAxisHeight.value, 0])
|
|
217
236
|
})
|
|
218
237
|
|
|
219
|
-
const leftAxis= computed(
|
|
238
|
+
const leftAxis = computed(
|
|
239
|
+
() => {
|
|
220
240
|
return d3
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
241
|
+
.axisLeft(leftScale.value)
|
|
242
|
+
.tickFormat((d) => d3Formatter(d, props.yAxisTickFormat))
|
|
243
|
+
.tickSize(width.value - leftAxisLabelsWidth.value)
|
|
244
|
+
.tickPadding(props.yAxisTickPadding)
|
|
245
|
+
} /*, {cache: false}*/
|
|
246
|
+
)
|
|
247
|
+
const leftAxisLabelsWidth = computed(
|
|
248
|
+
() => {
|
|
227
249
|
const selector = '.stacked-column-chart__left-axis__canvas .tick text'
|
|
228
250
|
const defaultWidth = 0
|
|
229
|
-
return
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
251
|
+
return (
|
|
252
|
+
elementsMaxBBox({ selector, defaultWidth }).width +
|
|
253
|
+
props.yAxisTickPadding
|
|
254
|
+
)
|
|
255
|
+
} /*, {cache: false}*/
|
|
256
|
+
)
|
|
257
|
+
|
|
258
|
+
const leftAxisCanvas = computed(() => {
|
|
259
|
+
return d3
|
|
260
|
+
.select(el.value)
|
|
261
|
+
.select('.stacked-column-chart__left-axis__canvas')
|
|
234
262
|
})
|
|
235
|
-
const paddedStyle= computed(() => {
|
|
263
|
+
const paddedStyle = computed(() => {
|
|
236
264
|
return {
|
|
237
|
-
marginLeft: props.noDirectLabeling
|
|
265
|
+
marginLeft: props.noDirectLabeling
|
|
266
|
+
? `${leftAxisLabelsWidth.value + props.yAxisTickPadding}px`
|
|
267
|
+
: 0
|
|
238
268
|
}
|
|
239
269
|
})
|
|
240
270
|
const barTooltipDelay = computed(() => {
|
|
@@ -242,26 +272,29 @@ export default defineComponent({
|
|
|
242
272
|
})
|
|
243
273
|
const maxRowValue = computed(() => {
|
|
244
274
|
return (
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
275
|
+
props.maxValue ||
|
|
276
|
+
(d3.max(loadedData.value || [], (datum, i) => {
|
|
277
|
+
return totalRowValue(i)
|
|
278
|
+
}) as number)
|
|
249
279
|
)
|
|
250
280
|
})
|
|
251
281
|
|
|
252
|
-
function
|
|
253
|
-
if(!el.value
|
|
282
|
+
function setSizes() {
|
|
283
|
+
if (!el.value) {
|
|
254
284
|
return
|
|
255
285
|
}
|
|
256
286
|
width.value = el.value.offsetWidth
|
|
257
|
-
height.value =
|
|
287
|
+
height.value =
|
|
288
|
+
props.fixedHeight !== null
|
|
289
|
+
? props.fixedHeight
|
|
290
|
+
: width.value * baseHeightRatio.value
|
|
258
291
|
}
|
|
259
|
-
function groupName(key:string) {
|
|
292
|
+
function groupName(key: string) {
|
|
260
293
|
const index = discoveredKeys.value.indexOf(key)
|
|
261
294
|
return props.groups[index] || key
|
|
262
295
|
}
|
|
263
296
|
|
|
264
|
-
function highlight(key:string) {
|
|
297
|
+
function highlight(key: string) {
|
|
265
298
|
highlightedKeys.value = [key]
|
|
266
299
|
}
|
|
267
300
|
|
|
@@ -269,10 +302,13 @@ export default defineComponent({
|
|
|
269
302
|
clearTimeout(highlightTimeout.value)
|
|
270
303
|
const delay = props.restoreHighlightDelay
|
|
271
304
|
// Delay the restoration so it can be cancelled by a new highlight
|
|
272
|
-
highlightTimeout.value = setTimeout(
|
|
305
|
+
highlightTimeout.value = setTimeout(
|
|
306
|
+
() => (highlightedKeys.value = props.highlights),
|
|
307
|
+
delay
|
|
308
|
+
)
|
|
273
309
|
}
|
|
274
310
|
|
|
275
|
-
function delayHighlight(key:string) {
|
|
311
|
+
function delayHighlight(key: string) {
|
|
276
312
|
clearTimeout(highlightTimeout.value)
|
|
277
313
|
// Reduce the delay to zero if there is already an highlighted key
|
|
278
314
|
const isDelayed = !hasHighlights.value
|
|
@@ -280,27 +316,29 @@ export default defineComponent({
|
|
|
280
316
|
highlightTimeout.value = setTimeout(() => highlight(key), delay)
|
|
281
317
|
}
|
|
282
318
|
|
|
283
|
-
function isHighlighted(key:string) {
|
|
319
|
+
function isHighlighted(key: string) {
|
|
284
320
|
return highlightedKeys.value.indexOf(key) > -1
|
|
285
321
|
}
|
|
286
322
|
|
|
287
|
-
function isColumnHighlighted(i:string|number) {
|
|
323
|
+
function isColumnHighlighted(i: string | number) {
|
|
288
324
|
const column = get(sortedData.value, [i, props.labelField], null)
|
|
289
|
-
return
|
|
325
|
+
return (
|
|
326
|
+
props.columnHighlights.includes(column) && !highlightedKeys.value.length
|
|
327
|
+
)
|
|
290
328
|
}
|
|
291
329
|
|
|
292
|
-
function totalRowValue(i:string|number) {
|
|
293
|
-
return d3.sum(discoveredKeys.value, (key:string) => {
|
|
330
|
+
function totalRowValue(i: string | number) {
|
|
331
|
+
return d3.sum(discoveredKeys.value, (key: string) => {
|
|
294
332
|
return sortedData.value[i][key]
|
|
295
333
|
})
|
|
296
334
|
}
|
|
297
335
|
|
|
298
|
-
function barStyle(i:string|number, key:string) {
|
|
336
|
+
function barStyle(i: string | number, key: string) {
|
|
299
337
|
const value = sortedData.value[i][key]
|
|
300
338
|
let totalWidth = props.relative ? totalRowValue(i) : maxRowValue.value
|
|
301
|
-
if(!totalWidth){
|
|
302
|
-
|
|
303
|
-
|
|
339
|
+
if (!totalWidth) {
|
|
340
|
+
console.error('totalWidth as divider cannot be ' + totalWidth)
|
|
341
|
+
totalWidth = 100
|
|
304
342
|
}
|
|
305
343
|
const height = `${100 * (value / totalWidth)}%`
|
|
306
344
|
const backgroundColor = colorScale.value(key)
|
|
@@ -308,30 +346,38 @@ export default defineComponent({
|
|
|
308
346
|
return { maxWidth, height, backgroundColor }
|
|
309
347
|
}
|
|
310
348
|
|
|
311
|
-
function barTitle(i:string|number, key:string) {
|
|
349
|
+
function barTitle(i: string | number, key: string) {
|
|
312
350
|
const value = sortedData.value[i][key]
|
|
313
351
|
const formattedValue = d3Formatter(value, props.yAxisTickFormat)
|
|
314
352
|
const formattedKey = groupName(key)
|
|
315
353
|
return props.tooltipDisplay({ value, formattedValue, key, formattedKey })
|
|
316
354
|
}
|
|
317
355
|
|
|
318
|
-
async function stackBarAndValue(i:string|number) {
|
|
356
|
+
async function stackBarAndValue(i: string | number) {
|
|
319
357
|
if (!sortedData.value) {
|
|
320
358
|
return []
|
|
321
359
|
}
|
|
322
360
|
await nextTick()
|
|
323
361
|
|
|
324
362
|
// Collect sizes first
|
|
325
|
-
const stack = discoveredKeys.value.map((key:string) => {
|
|
363
|
+
const stack = discoveredKeys.value.map((key: string) => {
|
|
326
364
|
const { bar, row, value } = queryBarAndValue(i as number, key)
|
|
327
|
-
if(!bar || !row || !value){
|
|
328
|
-
throw new Error(
|
|
365
|
+
if (!bar || !row || !value) {
|
|
366
|
+
throw new Error('Empty values for bar, row or value')
|
|
329
367
|
}
|
|
330
368
|
const barEdge = bar.getBoundingClientRect().top + bar.offsetHeight
|
|
331
369
|
const barHeight = bar.offsetHeight
|
|
332
370
|
const rowEdge = row.getBoundingClientRect().top + row.offsetHeight
|
|
333
371
|
const valueHeight = value.offsetHeight
|
|
334
|
-
return {
|
|
372
|
+
return {
|
|
373
|
+
key,
|
|
374
|
+
barEdge,
|
|
375
|
+
barHeight,
|
|
376
|
+
rowEdge,
|
|
377
|
+
valueHeight,
|
|
378
|
+
overflow: false,
|
|
379
|
+
pushed: false
|
|
380
|
+
}
|
|
335
381
|
})
|
|
336
382
|
// Infer value's display
|
|
337
383
|
return stack.map((desc, index) => {
|
|
@@ -339,41 +385,45 @@ export default defineComponent({
|
|
|
339
385
|
if (index > 0) {
|
|
340
386
|
const prevDesc = stack[index - 1]
|
|
341
387
|
const bothValuesHeight = desc.valueHeight + prevDesc.valueHeight
|
|
342
|
-
desc.overflow =
|
|
388
|
+
desc.overflow =
|
|
389
|
+
desc.overflow ||
|
|
390
|
+
(prevDesc.overflow && desc.barHeight < bothValuesHeight)
|
|
343
391
|
}
|
|
344
|
-
desc.pushed =
|
|
392
|
+
desc.pushed =
|
|
393
|
+
desc.barEdge + desc.valueHeight > desc.rowEdge && desc.overflow
|
|
345
394
|
return desc
|
|
346
395
|
})
|
|
347
396
|
}
|
|
348
397
|
|
|
349
|
-
function queryBarAndValue(i:number, key:string) {
|
|
398
|
+
function queryBarAndValue(i: number, key: string) {
|
|
350
399
|
if (!sortedData.value) {
|
|
351
400
|
return {}
|
|
352
401
|
}
|
|
353
402
|
const rowSelector = '.stacked-column-chart__groups__item'
|
|
354
|
-
const row = el.value?.querySelectorAll(rowSelector)[i]
|
|
403
|
+
const row = el.value?.querySelectorAll(rowSelector)[i] as HTMLElement
|
|
355
404
|
const barSelector = `.stacked-column-chart__groups__item__bars__item--${key}`
|
|
356
405
|
const bar = row.querySelector(barSelector) as HTMLElement
|
|
357
|
-
const valueSelector =
|
|
358
|
-
|
|
406
|
+
const valueSelector =
|
|
407
|
+
'.stacked-column-chart__groups__item__bars__item__value'
|
|
408
|
+
const value = bar.querySelector(valueSelector) as HTMLElement
|
|
359
409
|
return { bar, row, value }
|
|
360
410
|
}
|
|
361
411
|
|
|
362
|
-
function isHidden(i:string|number, key:string) {
|
|
412
|
+
function isHidden(i: string | number, key: string) {
|
|
363
413
|
return props.hideEmptyValues && !sortedData.value[i][key]
|
|
364
414
|
}
|
|
365
415
|
|
|
366
|
-
function hasValueOverflow(i:string|number, key:string) {
|
|
416
|
+
function hasValueOverflow(i: string | number, key: string) {
|
|
367
417
|
const stack = stackBarAndValue(i)
|
|
368
418
|
return find(stack, { key })?.overflow
|
|
369
419
|
}
|
|
370
420
|
|
|
371
|
-
function hasValuePushed(i:string|number, key:string) {
|
|
421
|
+
function hasValuePushed(i: string | number, key: string) {
|
|
372
422
|
const stack = stackBarAndValue(i)
|
|
373
423
|
return find(stack, { key })?.pushed
|
|
374
424
|
}
|
|
375
425
|
|
|
376
|
-
function hasValueHidden(i:string|number, key:string) {
|
|
426
|
+
function hasValueHidden(i: string | number, key: string) {
|
|
377
427
|
const keyIndex = discoveredKeys.value.indexOf(key)
|
|
378
428
|
const nextKey = discoveredKeys.value[keyIndex + 1]
|
|
379
429
|
if (!nextKey) {
|
|
@@ -387,16 +437,21 @@ export default defineComponent({
|
|
|
387
437
|
function formatYDatum(d: string) {
|
|
388
438
|
return d3Formatter(d, props.yAxisTickFormat)
|
|
389
439
|
}
|
|
390
|
-
watch(
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
440
|
+
watch(
|
|
441
|
+
() => props.highlights,
|
|
442
|
+
(newHighlights) => {
|
|
443
|
+
highlightedKeys.value = newHighlights
|
|
444
|
+
}
|
|
445
|
+
)
|
|
446
|
+
watch(sortedData, async (newVal) => {
|
|
447
|
+
await nextTick()
|
|
448
|
+
// This must be set after the column have been rendered
|
|
449
|
+
const element = el.value?.querySelector(
|
|
450
|
+
'.stacked-column-chart__groups__item__bars'
|
|
451
|
+
)
|
|
452
|
+
leftAxisHeight.value = (element as HTMLElement).offsetHeight
|
|
453
|
+
//@ts-ignore
|
|
454
|
+
leftAxisCanvas.value.call(leftAxis.value)
|
|
400
455
|
})
|
|
401
456
|
|
|
402
457
|
return {
|
|
@@ -427,73 +482,93 @@ export default defineComponent({
|
|
|
427
482
|
restoreHighlights
|
|
428
483
|
}
|
|
429
484
|
}
|
|
430
|
-
|
|
431
485
|
})
|
|
432
486
|
</script>
|
|
433
487
|
<template>
|
|
434
488
|
<div
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
489
|
+
ref="el"
|
|
490
|
+
:style="{ height: `${height}px` }"
|
|
491
|
+
class="stacked-column-chart d-flex flex-column"
|
|
492
|
+
:class="{
|
|
439
493
|
'stacked-column-chart--social-mode': socialMode,
|
|
440
|
-
'stacked-column-chart--has-highlights':
|
|
494
|
+
'stacked-column-chart--has-highlights':
|
|
495
|
+
hasHighlights || hasColumnHighlights,
|
|
441
496
|
'stacked-column-chart--no-direct-labeling': noDirectLabeling
|
|
442
497
|
}"
|
|
443
498
|
>
|
|
444
499
|
<ul v-if="!hideLegend" class="stacked-column-chart__legend list-inline">
|
|
445
500
|
<li
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
501
|
+
v-for="key in discoveredKeys"
|
|
502
|
+
:key="key"
|
|
503
|
+
class="stacked-column-chart__legend__item list-inline-item d-inline-flex"
|
|
504
|
+
:class="{
|
|
450
505
|
'stacked-column-chart__legend__item--highlighted': isHighlighted(key)
|
|
451
506
|
}"
|
|
452
|
-
|
|
453
|
-
|
|
507
|
+
@mouseover="delayHighlight(key)"
|
|
508
|
+
@mouseleave="restoreHighlights()"
|
|
454
509
|
>
|
|
455
|
-
<span
|
|
510
|
+
<span
|
|
511
|
+
class="stacked-column-chart__legend__item__box"
|
|
512
|
+
:style="{ 'background-color': colorScale(key) }"
|
|
513
|
+
/>
|
|
456
514
|
{{ groupName(key) }}
|
|
457
515
|
</li>
|
|
458
516
|
</ul>
|
|
459
517
|
<div class="d-flex flex-grow-1 position-relative overflow-hidden">
|
|
460
518
|
<svg
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
519
|
+
v-show="noDirectLabeling"
|
|
520
|
+
:width="width + 'px'"
|
|
521
|
+
:height="height + 'px'"
|
|
522
|
+
class="stacked-column-chart__left-axis"
|
|
465
523
|
>
|
|
466
|
-
<g
|
|
524
|
+
<g
|
|
525
|
+
class="stacked-column-chart__left-axis__canvas"
|
|
526
|
+
:transform="`translate(${width}, 0)`"
|
|
527
|
+
/>
|
|
467
528
|
</svg>
|
|
468
|
-
<div
|
|
529
|
+
<div
|
|
530
|
+
class="stacked-column-chart__groups d-flex flex-grow-1"
|
|
531
|
+
:style="paddedStyle"
|
|
532
|
+
>
|
|
469
533
|
<div
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
534
|
+
v-for="(datum, i) in sortedData"
|
|
535
|
+
:key="i"
|
|
536
|
+
class="stacked-column-chart__groups__item flex-grow-1 d-flex flex-column text-center"
|
|
473
537
|
>
|
|
474
538
|
<div
|
|
475
|
-
|
|
539
|
+
class="stacked-column-chart__groups__item__bars flex-grow-1 d-flex flex-column-reverse px-1 justify-content-start align-items-center"
|
|
476
540
|
>
|
|
477
541
|
<div
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
:
|
|
482
|
-
|
|
483
|
-
:
|
|
542
|
+
v-for="(key, j) in discoveredKeys"
|
|
543
|
+
:key="j"
|
|
544
|
+
v-b-tooltip.html="{
|
|
545
|
+
delay: barTooltipDelay,
|
|
546
|
+
disabled: noTooltips,
|
|
547
|
+
title: barTitle(i, key)
|
|
548
|
+
}"
|
|
549
|
+
:style="barStyle(i, key)"
|
|
550
|
+
class="stacked-column-chart__groups__item__bars__item"
|
|
551
|
+
:class="{
|
|
484
552
|
[`stacked-column-chart__groups__item__bars__item--${key}`]: true,
|
|
485
553
|
[`stacked-column-chart__groups__item__bars__item--${j}n`]: true,
|
|
486
|
-
'stacked-column-chart__groups__item__bars__item--hidden':
|
|
554
|
+
'stacked-column-chart__groups__item__bars__item--hidden':
|
|
555
|
+
isHidden(i, key),
|
|
487
556
|
'stacked-column-chart__groups__item__bars__item--highlighted':
|
|
488
557
|
isHighlighted(key) || isColumnHighlighted(i),
|
|
489
|
-
'stacked-column-chart__groups__item__bars__item--value-overflow':
|
|
490
|
-
|
|
491
|
-
'stacked-column-chart__groups__item__bars__item--value-
|
|
558
|
+
'stacked-column-chart__groups__item__bars__item--value-overflow':
|
|
559
|
+
hasValueOverflow(i, key),
|
|
560
|
+
'stacked-column-chart__groups__item__bars__item--value-pushed':
|
|
561
|
+
hasValuePushed(i, key),
|
|
562
|
+
'stacked-column-chart__groups__item__bars__item--value-hidden':
|
|
563
|
+
hasValueHidden(i, key)
|
|
492
564
|
}"
|
|
493
|
-
|
|
494
|
-
|
|
565
|
+
@mouseover="delayHighlight(key)"
|
|
566
|
+
@mouseleave="restoreHighlights()"
|
|
495
567
|
>
|
|
496
|
-
<div
|
|
568
|
+
<div
|
|
569
|
+
v-show="!noDirectLabeling"
|
|
570
|
+
class="stacked-column-chart__groups__item__bars__item__value"
|
|
571
|
+
>
|
|
497
572
|
{{ formatYDatum(datum[key]) }}
|
|
498
573
|
</div>
|
|
499
574
|
</div>
|
|
@@ -513,7 +588,9 @@ export default defineComponent({
|
|
|
513
588
|
.stacked-column-chart {
|
|
514
589
|
$muted-group-opacity: 0.2;
|
|
515
590
|
$muted-group-filter: grayscale(30%) brightness(10%);
|
|
516
|
-
$muted-group-transition:
|
|
591
|
+
$muted-group-transition:
|
|
592
|
+
opacity 0.3s,
|
|
593
|
+
filter 0.3s;
|
|
517
594
|
$colors: $primary, $info, $warning;
|
|
518
595
|
$quantile: 3;
|
|
519
596
|
|
|
@@ -610,8 +687,12 @@ export default defineComponent({
|
|
|
610
687
|
visibility: hidden;
|
|
611
688
|
}
|
|
612
689
|
|
|
613
|
-
.stacked-column-chart:not(.stacked-column-chart--has-highlights)
|
|
614
|
-
|
|
690
|
+
.stacked-column-chart:not(.stacked-column-chart--has-highlights)
|
|
691
|
+
&--value-hidden
|
|
692
|
+
&__value,
|
|
693
|
+
.stacked-column-chart:not(.stacked-column-chart--has-highlights)
|
|
694
|
+
&--value-pushed
|
|
695
|
+
&__value {
|
|
615
696
|
visibility: hidden;
|
|
616
697
|
}
|
|
617
698
|
|
package/lib/enums.ts
CHANGED
|
@@ -1,25 +1,35 @@
|
|
|
1
1
|
export enum BrandMode {
|
|
2
|
-
|
|
2
|
+
Short = 'short',
|
|
3
|
+
Medium = 'medium',
|
|
4
|
+
Long = 'long'
|
|
3
5
|
}
|
|
4
6
|
|
|
5
7
|
export enum TooltipPlacement {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
Top = 'top',
|
|
9
|
+
Topleft = 'topleft',
|
|
10
|
+
Topright = 'topright',
|
|
11
|
+
Right = 'right',
|
|
12
|
+
Righttop = 'righttop',
|
|
13
|
+
Rightbottom = 'rightbottom',
|
|
14
|
+
Bottom = 'bottom',
|
|
15
|
+
Bottomleft = 'bottomleft',
|
|
16
|
+
Bottomright = 'bottomright',
|
|
17
|
+
Left = 'left',
|
|
18
|
+
Lefttop = 'lefttop',
|
|
19
|
+
Leftbottom = 'leftbottom'
|
|
10
20
|
}
|
|
11
21
|
|
|
12
22
|
export enum DeckTexture {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
23
|
+
Silk = 'silk',
|
|
24
|
+
Brick = 'brick',
|
|
25
|
+
Rock = 'rock',
|
|
26
|
+
Sand = 'sand',
|
|
27
|
+
Crack = 'crack',
|
|
28
|
+
Carbon = 'carbon'
|
|
19
29
|
}
|
|
20
30
|
|
|
21
31
|
export enum Size {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
32
|
+
sm = 'sm',
|
|
33
|
+
md = 'md',
|
|
34
|
+
lg = 'lg'
|
|
35
|
+
}
|
package/lib/i18n.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {createI18n,I18n} from 'vue-i18n'
|
|
1
|
+
import { createI18n, I18n } from 'vue-i18n'
|
|
2
2
|
|
|
3
3
|
import fr from '@/locales/fr.json'
|
|
4
4
|
import en from '@/locales/en.json'
|
|
@@ -7,9 +7,9 @@ export const locale: string = 'en'
|
|
|
7
7
|
export const fallbackLocale: string = 'en'
|
|
8
8
|
// https://vue-i18n.intlify.dev/guide/advanced/composition.html#implicit-with-injected-properties-and-functions
|
|
9
9
|
export const i18n: I18n = createI18n({
|
|
10
|
-
warnHtmlMessage:false,
|
|
10
|
+
warnHtmlMessage: false,
|
|
11
11
|
globalInjection: true,
|
|
12
|
-
legacy:false,
|
|
12
|
+
legacy: false,
|
|
13
13
|
locale,
|
|
14
14
|
fallbackLocale,
|
|
15
15
|
messages: { fr, en }
|
package/lib/keys.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const AccordionKey = Symbol('Accordion')
|
|
2
|
-
export const ParentKey = Symbol('Parent')
|
|
1
|
+
export const AccordionKey = Symbol('Accordion')
|
|
2
|
+
export const ParentKey = Symbol('Parent')
|