@icij/murmur-next 4.1.2 → 4.1.4
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/lib/datavisualisations/ColumnChart.vue.d.ts +3 -8
- package/dist/lib/murmur.css +1 -1
- package/dist/lib/murmur.js +4876 -4886
- package/dist/lib/murmur.js.map +1 -1
- package/dist/lib/murmur.umd.cjs +26 -26
- package/dist/lib/murmur.umd.cjs.map +1 -1
- package/lib/datavisualisations/ColumnChart.vue +24 -79
- package/lib/datavisualisations/StackedColumnChart.vue +0 -4
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { ComponentPublicInstance, computed, defineComponent, PropType, ref, watch } from 'vue'
|
|
2
|
+
import { ComponentPublicInstance, computed, defineComponent, getCurrentInstance, PropType, ref, watch } from 'vue'
|
|
3
3
|
import { identity, iteratee, sortBy } from 'lodash'
|
|
4
4
|
import * as d3 from 'd3'
|
|
5
5
|
import { chartProps, getChartProps, useChart } from '@/composables/chart'
|
|
@@ -306,6 +306,9 @@ export default defineComponent({
|
|
|
306
306
|
.ticks(props.yAxisTicks)
|
|
307
307
|
})
|
|
308
308
|
|
|
309
|
+
const activeBar = computed((): ColumnBar => bars.value[shownTooltip.value] ?? null)
|
|
310
|
+
const activeBarId = computed((): string => columnUniqueId(shownTooltip.value))
|
|
311
|
+
|
|
309
312
|
function formatXDatum(d: any) {
|
|
310
313
|
return d3Formatter(d, props.xAxisTickFormat)
|
|
311
314
|
}
|
|
@@ -351,11 +354,10 @@ export default defineComponent({
|
|
|
351
354
|
.attr('x2', padded.value.width)
|
|
352
355
|
}
|
|
353
356
|
|
|
354
|
-
function
|
|
355
|
-
|
|
356
|
-
const
|
|
357
|
-
|
|
358
|
-
return { top, left }
|
|
357
|
+
function columnUniqueId(i: number) {
|
|
358
|
+
// @ts-ignore
|
|
359
|
+
const { uid } = getCurrentInstance()
|
|
360
|
+
return `column-${uid}-${i}`
|
|
359
361
|
}
|
|
360
362
|
|
|
361
363
|
function highlighted(datum: any): boolean {
|
|
@@ -369,6 +371,9 @@ export default defineComponent({
|
|
|
369
371
|
|
|
370
372
|
return {
|
|
371
373
|
el,
|
|
374
|
+
activeBar,
|
|
375
|
+
activeBarId,
|
|
376
|
+
columnUniqueId,
|
|
372
377
|
dataHasHighlights,
|
|
373
378
|
width,
|
|
374
379
|
height,
|
|
@@ -379,7 +384,6 @@ export default defineComponent({
|
|
|
379
384
|
bars,
|
|
380
385
|
select,
|
|
381
386
|
highlighted,
|
|
382
|
-
barTooltipStyle,
|
|
383
387
|
formatYDatum,
|
|
384
388
|
formatXDatum
|
|
385
389
|
}
|
|
@@ -434,37 +438,27 @@ export default defineComponent({
|
|
|
434
438
|
class="column-chart__columns__item__placeholder"
|
|
435
439
|
/>
|
|
436
440
|
<rect
|
|
437
|
-
:height="bar.height"
|
|
441
|
+
:height="Math.max(bar.height, 0.1)"
|
|
438
442
|
:width="bar.width"
|
|
439
443
|
:y="bar.y"
|
|
444
|
+
:id="columnUniqueId(index)"
|
|
440
445
|
class="column-chart__columns__item__bar"
|
|
441
446
|
/>
|
|
442
447
|
</g>
|
|
443
448
|
</g>
|
|
444
449
|
</svg>
|
|
445
|
-
<
|
|
446
|
-
<
|
|
447
|
-
<
|
|
448
|
-
<
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
>
|
|
454
|
-
<slot name="tooltip" v-bind="bar">
|
|
455
|
-
<h6 class="column-chart__tooltips__item__wrapper__heading mb-0">
|
|
456
|
-
{{ formatXDatum(bar.datum[timeseriesKey]) }}
|
|
457
|
-
</h6>
|
|
458
|
-
<div class="column-chart__tooltips__item__wrapper__value">
|
|
459
|
-
{{ formatYDatum(bar.datum[seriesName]) }}
|
|
460
|
-
</div>
|
|
461
|
-
</slot>
|
|
462
|
-
</div>
|
|
463
|
-
</transition>
|
|
450
|
+
<template v-if="!noTooltips && activeBar">
|
|
451
|
+
<b-tooltip :target="activeBarId" teleport-to="body" manual :model-value="true" class="column-chart__tooltip">
|
|
452
|
+
<slot name="tooltip" v-bind="activeBar">
|
|
453
|
+
<h6 class="column-chart__tooltip__heading mb-0">
|
|
454
|
+
{{ formatXDatum(activeBar.datum[timeseriesKey]) }}
|
|
455
|
+
</h6>
|
|
456
|
+
<div class="column-chart__tooltip__value">
|
|
457
|
+
{{ formatYDatum(activeBar.datum[seriesName]) }}
|
|
464
458
|
</div>
|
|
465
|
-
</
|
|
466
|
-
</
|
|
467
|
-
</
|
|
459
|
+
</slot>
|
|
460
|
+
</b-tooltip>
|
|
461
|
+
</template>
|
|
468
462
|
</div>
|
|
469
463
|
</template>
|
|
470
464
|
|
|
@@ -519,54 +513,5 @@ export default defineComponent({
|
|
|
519
513
|
display: none;
|
|
520
514
|
}
|
|
521
515
|
}
|
|
522
|
-
|
|
523
|
-
&__tooltips {
|
|
524
|
-
pointer-events: none;
|
|
525
|
-
position: absolute;
|
|
526
|
-
top: 0;
|
|
527
|
-
left: 0;
|
|
528
|
-
|
|
529
|
-
&__item {
|
|
530
|
-
$tooltip-bg: $body-emphasis-color;
|
|
531
|
-
|
|
532
|
-
display: inline-flex;
|
|
533
|
-
text-align: center;
|
|
534
|
-
flex-direction: row;
|
|
535
|
-
align-items: flex-end;
|
|
536
|
-
justify-content: flex-start;
|
|
537
|
-
position: absolute;
|
|
538
|
-
transform: translate(-50%, -100%);
|
|
539
|
-
margin-top: -0.5 * $tooltip-arrow-width;
|
|
540
|
-
|
|
541
|
-
&__wrapper {
|
|
542
|
-
max-width: $tooltip-max-width;
|
|
543
|
-
background: rgba($tooltip-bg, $tooltip-opacity);
|
|
544
|
-
border-radius: $tooltip-border-radius;
|
|
545
|
-
color: $tooltip-color;
|
|
546
|
-
margin: 0;
|
|
547
|
-
padding: $tooltip-padding-y $tooltip-padding-x;
|
|
548
|
-
|
|
549
|
-
&.fade-enter-active,
|
|
550
|
-
&.fade-leave-active {
|
|
551
|
-
transition: $transition-fade;
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
&.fade-enter-from,
|
|
555
|
-
&.fade-leave-to {
|
|
556
|
-
opacity: 0;
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
&:after {
|
|
560
|
-
content: '';
|
|
561
|
-
border: ($tooltip-arrow-width * 0.5) solid transparent;
|
|
562
|
-
border-top-color: rgba($tooltip-bg, $tooltip-opacity);
|
|
563
|
-
transform: translateX(-50%);
|
|
564
|
-
position: absolute;
|
|
565
|
-
left: 50%;
|
|
566
|
-
top: 100%;
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
516
|
}
|
|
572
517
|
</style>
|
|
@@ -21,10 +21,6 @@ import { useQueryObserver } from '@/composables/queryObserver.js'
|
|
|
21
21
|
|
|
22
22
|
export default defineComponent({
|
|
23
23
|
name: 'StackedColumnChart',
|
|
24
|
-
// directives: {
|
|
25
|
-
// 'b-tooltip': VBTooltip
|
|
26
|
-
// },
|
|
27
|
-
//mixins: [chart],
|
|
28
24
|
props: {
|
|
29
25
|
/**
|
|
30
26
|
* Field of each object containing data (for each group)
|