@internetarchive/histogram-date-range 1.3.2 → 1.4.0-alpha-webdev7756.1
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/demo/index.html +20 -0
- package/dist/demo/js/list-histogram-wrapper.d.ts +20 -0
- package/dist/demo/js/list-histogram-wrapper.js +59 -0
- package/dist/demo/js/list-histogram-wrapper.js.map +1 -0
- package/dist/demo/js/lit-histogram-wrapper.d.ts +21 -0
- package/dist/demo/js/lit-histogram-wrapper.js +73 -0
- package/dist/demo/js/lit-histogram-wrapper.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/src/histogram-date-range.d.ts +27 -0
- package/dist/src/histogram-date-range.js +301 -245
- package/dist/src/histogram-date-range.js.map +1 -1
- package/dist/test/histogram-date-range.test.js +221 -179
- package/dist/test/histogram-date-range.test.js.map +1 -1
- package/docs/demo/index.html +20 -0
- package/docs/dist/src/histogram-date-range.js +44 -12
- package/index.ts +3 -0
- package/package.json +1 -1
- package/src/histogram-date-range.ts +1172 -1110
- package/test/histogram-date-range.test.ts +992 -935
- package/dist/src/dayjs/fix-first-century-years.d.ts +0 -2
- package/dist/src/dayjs/fix-first-century-years.js +0 -25
- package/dist/src/dayjs/fix-first-century-years.js.map +0 -1
- package/dist/src/dayjs/fix-two-digit-dates.d.ts +0 -2
- package/dist/src/dayjs/fix-two-digit-dates.js +0 -25
- package/dist/src/dayjs/fix-two-digit-dates.js.map +0 -1
- package/dist/src/histogram-date-range copy.d.ts +0 -214
- package/dist/src/histogram-date-range copy.js +0 -1018
- package/dist/src/histogram-date-range copy.js.map +0 -1
|
@@ -19,8 +19,16 @@ const TOOLTIP_HEIGHT = 30;
|
|
|
19
19
|
const DATE_FORMAT = 'YYYY';
|
|
20
20
|
const MISSING_DATA = 'no data';
|
|
21
21
|
const UPDATE_DEBOUNCE_DELAY_MS = 0;
|
|
22
|
+
const TOOLTIP_LABEL = 'item';
|
|
22
23
|
// this constant is not set up to be overridden
|
|
23
24
|
const SLIDER_CORNER_SIZE = 4;
|
|
25
|
+
/**
|
|
26
|
+
* Map from bar scaling preset options to the corresponding function they represent
|
|
27
|
+
*/
|
|
28
|
+
const BAR_SCALING_PRESET_FNS = {
|
|
29
|
+
linear: (binValue) => binValue,
|
|
30
|
+
logarithmic: (binValue) => Math.log1p(binValue),
|
|
31
|
+
};
|
|
24
32
|
// these CSS custom props can be overridden from the HTML that is invoking this component
|
|
25
33
|
const sliderColor = css `var(--histogramDateRangeSliderColor, #4B65FE)`;
|
|
26
34
|
const selectedRangeColor = css `var(--histogramDateRangeSelectedRangeColor, #DBE0FF)`;
|
|
@@ -67,6 +75,26 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
67
75
|
* - `year`: Same as `month`, but snapping to year boundaries instead of months.
|
|
68
76
|
*/
|
|
69
77
|
this.binSnapping = 'none';
|
|
78
|
+
/**
|
|
79
|
+
* What label to use on tooltips to identify the type of data being represented.
|
|
80
|
+
* Defaults to `'item(s)'`.
|
|
81
|
+
*/
|
|
82
|
+
this.tooltipLabel = TOOLTIP_LABEL;
|
|
83
|
+
/**
|
|
84
|
+
* A function or preset value indicating how the height of each bar relates to its
|
|
85
|
+
* corresponding bin value. Current presets available are 'logarithmic' and 'linear',
|
|
86
|
+
* but a custom function may be provided instead if other behavior is desired.
|
|
87
|
+
*
|
|
88
|
+
* The default scaling (`'logarithmic'`) uses the logarithm of each bin value, yielding
|
|
89
|
+
* more prominent bars for smaller values. This ensures that even when the difference
|
|
90
|
+
* between the min & max values is large, small values are unlikely to completely disappear
|
|
91
|
+
* visually. However, the cost is that bars have less noticeable variation among values of
|
|
92
|
+
* a similar magnitude, and their heights are not a direct representation of the bin values.
|
|
93
|
+
*
|
|
94
|
+
* The `'linear'` preset option instead sizes the bars in linear proportion to their bin
|
|
95
|
+
* values.
|
|
96
|
+
*/
|
|
97
|
+
this.barScaling = 'logarithmic';
|
|
70
98
|
// internal reactive properties not exposed as attributes
|
|
71
99
|
this._tooltipOffsetX = 0;
|
|
72
100
|
this._tooltipOffsetY = 0;
|
|
@@ -138,7 +166,8 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
138
166
|
changedProps.has('maxSelectedDate') ||
|
|
139
167
|
changedProps.has('width') ||
|
|
140
168
|
changedProps.has('height') ||
|
|
141
|
-
changedProps.has('binSnapping')
|
|
169
|
+
changedProps.has('binSnapping') ||
|
|
170
|
+
changedProps.has('barScaling')) {
|
|
142
171
|
this.handleDataUpdate();
|
|
143
172
|
}
|
|
144
173
|
}
|
|
@@ -226,13 +255,22 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
226
255
|
return this.snapToNextSecond(timestamp);
|
|
227
256
|
}
|
|
228
257
|
}
|
|
258
|
+
/**
|
|
259
|
+
* Function to scale bin values, whether from a preset or a provided custom function.
|
|
260
|
+
*/
|
|
261
|
+
get barScalingFunction() {
|
|
262
|
+
if (typeof this.barScaling === 'string') {
|
|
263
|
+
return BAR_SCALING_PRESET_FNS[this.barScaling];
|
|
264
|
+
}
|
|
265
|
+
return this.barScaling;
|
|
266
|
+
}
|
|
229
267
|
calculateHistData() {
|
|
230
268
|
const { bins, height, dateRangeMS, _numBins, _minDateMS } = this;
|
|
231
269
|
const minValue = Math.min(...this.bins);
|
|
232
270
|
const maxValue = Math.max(...this.bins);
|
|
233
271
|
// if there is no difference between the min and max values, use a range of
|
|
234
272
|
// 1 because log scaling will fail if the range is 0
|
|
235
|
-
const valueRange = minValue === maxValue ? 1 :
|
|
273
|
+
const valueRange = minValue === maxValue ? 1 : this.barScalingFunction(maxValue);
|
|
236
274
|
const valueScale = height / valueRange;
|
|
237
275
|
const dateScale = dateRangeMS / _numBins;
|
|
238
276
|
return bins.map((v, i) => {
|
|
@@ -249,9 +287,8 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
249
287
|
: `${tooltipStart} - ${tooltipEnd}`;
|
|
250
288
|
return {
|
|
251
289
|
value: v,
|
|
252
|
-
//
|
|
253
|
-
|
|
254
|
-
height: Math.floor(Math.log1p(v) * valueScale),
|
|
290
|
+
// apply the configured scaling function to the bin value before determining bar height
|
|
291
|
+
height: Math.floor(this.barScalingFunction(v) * valueScale),
|
|
255
292
|
binStart,
|
|
256
293
|
binEnd,
|
|
257
294
|
tooltip,
|
|
@@ -379,7 +416,7 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
379
416
|
const target = e.currentTarget;
|
|
380
417
|
const x = target.x.baseVal.value + this.sliderWidth / 2;
|
|
381
418
|
const dataset = target.dataset;
|
|
382
|
-
const itemsText =
|
|
419
|
+
const itemsText = `${this.tooltipLabel}${dataset.numItems !== '1' ? 's' : ''}`;
|
|
383
420
|
const formattedNumItems = Number(dataset.numItems).toLocaleString();
|
|
384
421
|
const tooltipPadding = 2;
|
|
385
422
|
const bufferHeight = 9;
|
|
@@ -395,9 +432,9 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
395
432
|
window.scrollX;
|
|
396
433
|
// Place the tooltip (with arrow) just above the top of the histogram bars
|
|
397
434
|
this._tooltipOffsetY = histogramY - heightAboveHistogram + window.scrollY;
|
|
398
|
-
this._tooltipContent = html `
|
|
399
|
-
${formattedNumItems} ${itemsText}<br />
|
|
400
|
-
${dataset.tooltip}
|
|
435
|
+
this._tooltipContent = html `
|
|
436
|
+
${formattedNumItems} ${itemsText}<br />
|
|
437
|
+
${dataset.tooltip}
|
|
401
438
|
`;
|
|
402
439
|
(_b = (_a = this._tooltip).showPopover) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
403
440
|
}
|
|
@@ -594,25 +631,25 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
594
631
|
// border-radius); used as part of a SVG quadratic curve. see
|
|
595
632
|
// https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#curve_commands
|
|
596
633
|
const cs = SLIDER_CORNER_SIZE;
|
|
597
|
-
const sliderShape = `
|
|
598
|
-
M${this.minSliderX},0
|
|
599
|
-
h-${this.sliderWidth - cs}
|
|
600
|
-
q-${cs},0 -${cs},${cs}
|
|
601
|
-
v${this.height - cs * 2}
|
|
602
|
-
q0,${cs} ${cs},${cs}
|
|
603
|
-
h${this.sliderWidth - cs}
|
|
634
|
+
const sliderShape = `
|
|
635
|
+
M${this.minSliderX},0
|
|
636
|
+
h-${this.sliderWidth - cs}
|
|
637
|
+
q-${cs},0 -${cs},${cs}
|
|
638
|
+
v${this.height - cs * 2}
|
|
639
|
+
q0,${cs} ${cs},${cs}
|
|
640
|
+
h${this.sliderWidth - cs}
|
|
604
641
|
`;
|
|
605
642
|
return this.generateSliderSVG(this.minSliderX, 'slider-min', sliderShape);
|
|
606
643
|
}
|
|
607
644
|
get maxSliderTemplate() {
|
|
608
645
|
const cs = SLIDER_CORNER_SIZE;
|
|
609
|
-
const sliderShape = `
|
|
610
|
-
M${this.maxSliderX},0
|
|
611
|
-
h${this.sliderWidth - cs}
|
|
612
|
-
q${cs},0 ${cs},${cs}
|
|
613
|
-
v${this.height - cs * 2}
|
|
614
|
-
q0,${cs} -${cs},${cs}
|
|
615
|
-
h-${this.sliderWidth - cs}
|
|
646
|
+
const sliderShape = `
|
|
647
|
+
M${this.maxSliderX},0
|
|
648
|
+
h${this.sliderWidth - cs}
|
|
649
|
+
q${cs},0 ${cs},${cs}
|
|
650
|
+
v${this.height - cs * 2}
|
|
651
|
+
q0,${cs} -${cs},${cs}
|
|
652
|
+
h-${this.sliderWidth - cs}
|
|
616
653
|
`;
|
|
617
654
|
return this.generateSliderSVG(this.maxSliderX, 'slider-max', sliderShape);
|
|
618
655
|
}
|
|
@@ -625,38 +662,38 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
625
662
|
draggable: !this.disabled,
|
|
626
663
|
dragging: this._isDragging,
|
|
627
664
|
});
|
|
628
|
-
return svg `
|
|
629
|
-
<svg
|
|
630
|
-
id=${id}
|
|
631
|
-
class=${sliderClasses}
|
|
632
|
-
@pointerdown=${this.drag}
|
|
633
|
-
>
|
|
634
|
-
<path d="${sliderShape} z" fill="${sliderColor}" />
|
|
635
|
-
<rect
|
|
636
|
-
x="${sliderPositionX - this.sliderWidth * k + this.sliderWidth * 0.4 * k}"
|
|
637
|
-
y="${this.height / 3}"
|
|
638
|
-
width="1"
|
|
639
|
-
height="${this.height / 3}"
|
|
640
|
-
fill="white"
|
|
641
|
-
/>
|
|
642
|
-
<rect
|
|
643
|
-
x="${sliderPositionX - this.sliderWidth * k + this.sliderWidth * 0.6 * k}"
|
|
644
|
-
y="${this.height / 3}"
|
|
645
|
-
width="1"
|
|
646
|
-
height="${this.height / 3}"
|
|
647
|
-
fill="white"
|
|
648
|
-
/>
|
|
649
|
-
</svg>
|
|
665
|
+
return svg `
|
|
666
|
+
<svg
|
|
667
|
+
id=${id}
|
|
668
|
+
class=${sliderClasses}
|
|
669
|
+
@pointerdown=${this.drag}
|
|
670
|
+
>
|
|
671
|
+
<path d="${sliderShape} z" fill="${sliderColor}" />
|
|
672
|
+
<rect
|
|
673
|
+
x="${sliderPositionX - this.sliderWidth * k + this.sliderWidth * 0.4 * k}"
|
|
674
|
+
y="${this.height / 3}"
|
|
675
|
+
width="1"
|
|
676
|
+
height="${this.height / 3}"
|
|
677
|
+
fill="white"
|
|
678
|
+
/>
|
|
679
|
+
<rect
|
|
680
|
+
x="${sliderPositionX - this.sliderWidth * k + this.sliderWidth * 0.6 * k}"
|
|
681
|
+
y="${this.height / 3}"
|
|
682
|
+
width="1"
|
|
683
|
+
height="${this.height / 3}"
|
|
684
|
+
fill="white"
|
|
685
|
+
/>
|
|
686
|
+
</svg>
|
|
650
687
|
`;
|
|
651
688
|
}
|
|
652
689
|
get selectedRangeTemplate() {
|
|
653
|
-
return svg `
|
|
654
|
-
<rect
|
|
655
|
-
x="${this.minSliderX}"
|
|
656
|
-
y="0"
|
|
657
|
-
width="${this.maxSliderX - this.minSliderX}"
|
|
658
|
-
height="${this.height}"
|
|
659
|
-
fill="${selectedRangeColor}"
|
|
690
|
+
return svg `
|
|
691
|
+
<rect
|
|
692
|
+
x="${this.minSliderX}"
|
|
693
|
+
y="0"
|
|
694
|
+
width="${this.maxSliderX - this.minSliderX}"
|
|
695
|
+
height="${this.height}"
|
|
696
|
+
fill="${selectedRangeColor}"
|
|
660
697
|
/>`;
|
|
661
698
|
}
|
|
662
699
|
get histogramTemplate() {
|
|
@@ -674,22 +711,30 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
674
711
|
// between adjacent bars (eg when viewing the tooltips or when trying to
|
|
675
712
|
// extend the range by clicking on a bar)
|
|
676
713
|
const barStyle = `stroke-dasharray: 0 ${barWidth} ${barHeight} ${barWidth} 0 ${barHeight}`;
|
|
677
|
-
const bar = svg `
|
|
678
|
-
<rect
|
|
679
|
-
class="bar"
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
@
|
|
686
|
-
@
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
data-
|
|
690
|
-
data-bin-
|
|
691
|
-
data-
|
|
692
|
-
|
|
714
|
+
const bar = svg `
|
|
715
|
+
<rect
|
|
716
|
+
class="bar-pointer-target"
|
|
717
|
+
x=${x}
|
|
718
|
+
y="0"
|
|
719
|
+
width=${barWidth}
|
|
720
|
+
height=${this.height}
|
|
721
|
+
@pointerenter=${this.showTooltip}
|
|
722
|
+
@pointerleave=${this.hideTooltip}
|
|
723
|
+
@click=${this.handleBarClick}
|
|
724
|
+
fill="transparent"
|
|
725
|
+
data-num-items=${data.value}
|
|
726
|
+
data-bin-start=${data.binStart}
|
|
727
|
+
data-bin-end=${data.binEnd}
|
|
728
|
+
data-tooltip=${data.tooltip}
|
|
729
|
+
/>
|
|
730
|
+
<rect
|
|
731
|
+
class="bar"
|
|
732
|
+
style=${barStyle}
|
|
733
|
+
x=${x}
|
|
734
|
+
y=${this.height - barHeight}
|
|
735
|
+
width=${barWidth}
|
|
736
|
+
height=${barHeight}
|
|
737
|
+
fill=${barFill}
|
|
693
738
|
/>`;
|
|
694
739
|
x += xScale;
|
|
695
740
|
return bar;
|
|
@@ -729,31 +774,31 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
729
774
|
* https://lit.dev/docs/templates/directives/#live
|
|
730
775
|
*/
|
|
731
776
|
get minInputTemplate() {
|
|
732
|
-
return html `
|
|
733
|
-
<input
|
|
734
|
-
id="date-min"
|
|
735
|
-
placeholder=${this.dateFormat}
|
|
736
|
-
type="text"
|
|
737
|
-
@focus=${this.handleInputFocus}
|
|
738
|
-
@blur=${this.handleMinDateInput}
|
|
739
|
-
@keyup=${this.handleKeyUp}
|
|
740
|
-
.value=${live(this.minSelectedDate)}
|
|
741
|
-
?disabled=${this.disabled}
|
|
742
|
-
/>
|
|
777
|
+
return html `
|
|
778
|
+
<input
|
|
779
|
+
id="date-min"
|
|
780
|
+
placeholder=${this.dateFormat}
|
|
781
|
+
type="text"
|
|
782
|
+
@focus=${this.handleInputFocus}
|
|
783
|
+
@blur=${this.handleMinDateInput}
|
|
784
|
+
@keyup=${this.handleKeyUp}
|
|
785
|
+
.value=${live(this.minSelectedDate)}
|
|
786
|
+
?disabled=${this.disabled}
|
|
787
|
+
/>
|
|
743
788
|
`;
|
|
744
789
|
}
|
|
745
790
|
get maxInputTemplate() {
|
|
746
|
-
return html `
|
|
747
|
-
<input
|
|
748
|
-
id="date-max"
|
|
749
|
-
placeholder=${this.dateFormat}
|
|
750
|
-
type="text"
|
|
751
|
-
@focus=${this.handleInputFocus}
|
|
752
|
-
@blur=${this.handleMaxDateInput}
|
|
753
|
-
@keyup=${this.handleKeyUp}
|
|
754
|
-
.value=${live(this.maxSelectedDate)}
|
|
755
|
-
?disabled=${this.disabled}
|
|
756
|
-
/>
|
|
791
|
+
return html `
|
|
792
|
+
<input
|
|
793
|
+
id="date-max"
|
|
794
|
+
placeholder=${this.dateFormat}
|
|
795
|
+
type="text"
|
|
796
|
+
@focus=${this.handleInputFocus}
|
|
797
|
+
@blur=${this.handleMaxDateInput}
|
|
798
|
+
@keyup=${this.handleKeyUp}
|
|
799
|
+
.value=${live(this.maxSelectedDate)}
|
|
800
|
+
?disabled=${this.disabled}
|
|
801
|
+
/>
|
|
757
802
|
`;
|
|
758
803
|
}
|
|
759
804
|
get minLabelTemplate() {
|
|
@@ -769,179 +814,184 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
769
814
|
top: `${this._tooltipOffsetY}px`,
|
|
770
815
|
left: `${this._tooltipOffsetX}px`,
|
|
771
816
|
});
|
|
772
|
-
return html `
|
|
773
|
-
<div id="tooltip" style=${styles} popover>${this._tooltipContent}</div>
|
|
817
|
+
return html `
|
|
818
|
+
<div id="tooltip" style=${styles} popover>${this._tooltipContent}</div>
|
|
774
819
|
`;
|
|
775
820
|
}
|
|
776
821
|
get noDataTemplate() {
|
|
777
|
-
return html `
|
|
778
|
-
<div class="missing-data-message">${this.missingDataMessage}</div>
|
|
822
|
+
return html `
|
|
823
|
+
<div class="missing-data-message">${this.missingDataMessage}</div>
|
|
779
824
|
`;
|
|
780
825
|
}
|
|
781
826
|
get activityIndicatorTemplate() {
|
|
782
827
|
if (!this.loading) {
|
|
783
828
|
return nothing;
|
|
784
829
|
}
|
|
785
|
-
return html `
|
|
786
|
-
<ia-activity-indicator mode="processing"> </ia-activity-indicator>
|
|
830
|
+
return html `
|
|
831
|
+
<ia-activity-indicator mode="processing"> </ia-activity-indicator>
|
|
787
832
|
`;
|
|
788
833
|
}
|
|
789
834
|
render() {
|
|
790
835
|
if (!this.hasBinData) {
|
|
791
836
|
return this.noDataTemplate;
|
|
792
837
|
}
|
|
793
|
-
return html `
|
|
794
|
-
<div
|
|
795
|
-
id="container"
|
|
796
|
-
class="
|
|
797
|
-
noselect
|
|
798
|
-
${this._isDragging ? 'dragging' : ''}
|
|
799
|
-
"
|
|
800
|
-
style="width: ${this.width}px"
|
|
801
|
-
>
|
|
802
|
-
${this.activityIndicatorTemplate} ${this.tooltipTemplate}
|
|
803
|
-
<div
|
|
804
|
-
class="inner-container
|
|
805
|
-
${this.disabled ? 'disabled' : ''}"
|
|
806
|
-
>
|
|
807
|
-
<svg
|
|
808
|
-
width="${this.width}"
|
|
809
|
-
height="${this.height}"
|
|
810
|
-
@pointerleave="${this.drop}"
|
|
811
|
-
>
|
|
812
|
-
${this.selectedRangeTemplate}
|
|
813
|
-
<svg id="histogram">${this.histogramTemplate}</svg>
|
|
814
|
-
${this.minSliderTemplate} ${this.maxSliderTemplate}
|
|
815
|
-
</svg>
|
|
816
|
-
<div id="inputs">
|
|
817
|
-
${this.minLabelTemplate} ${this.minInputTemplate}
|
|
818
|
-
<div class="dash">-</div>
|
|
819
|
-
${this.maxLabelTemplate} ${this.maxInputTemplate}
|
|
820
|
-
<slot name="inputs-right-side"></slot>
|
|
821
|
-
</div>
|
|
822
|
-
</div>
|
|
823
|
-
</div>
|
|
838
|
+
return html `
|
|
839
|
+
<div
|
|
840
|
+
id="container"
|
|
841
|
+
class="
|
|
842
|
+
noselect
|
|
843
|
+
${this._isDragging ? 'dragging' : ''}
|
|
844
|
+
"
|
|
845
|
+
style="width: ${this.width}px"
|
|
846
|
+
>
|
|
847
|
+
${this.activityIndicatorTemplate} ${this.tooltipTemplate}
|
|
848
|
+
<div
|
|
849
|
+
class="inner-container
|
|
850
|
+
${this.disabled ? 'disabled' : ''}"
|
|
851
|
+
>
|
|
852
|
+
<svg
|
|
853
|
+
width="${this.width}"
|
|
854
|
+
height="${this.height}"
|
|
855
|
+
@pointerleave="${this.drop}"
|
|
856
|
+
>
|
|
857
|
+
${this.selectedRangeTemplate}
|
|
858
|
+
<svg id="histogram">${this.histogramTemplate}</svg>
|
|
859
|
+
${this.minSliderTemplate} ${this.maxSliderTemplate}
|
|
860
|
+
</svg>
|
|
861
|
+
<div id="inputs">
|
|
862
|
+
${this.minLabelTemplate} ${this.minInputTemplate}
|
|
863
|
+
<div class="dash">-</div>
|
|
864
|
+
${this.maxLabelTemplate} ${this.maxInputTemplate}
|
|
865
|
+
<slot name="inputs-right-side"></slot>
|
|
866
|
+
</div>
|
|
867
|
+
</div>
|
|
868
|
+
</div>
|
|
824
869
|
`;
|
|
825
870
|
}
|
|
826
871
|
};
|
|
827
|
-
HistogramDateRange.styles = css `
|
|
828
|
-
.missing-data-message {
|
|
829
|
-
text-align: center;
|
|
830
|
-
}
|
|
831
|
-
#container {
|
|
832
|
-
margin: 0;
|
|
833
|
-
touch-action: none;
|
|
834
|
-
position: relative;
|
|
835
|
-
}
|
|
836
|
-
.disabled {
|
|
837
|
-
opacity: 0.3;
|
|
838
|
-
}
|
|
839
|
-
ia-activity-indicator {
|
|
840
|
-
position: absolute;
|
|
841
|
-
left: calc(50% - 10px);
|
|
842
|
-
top: 10px;
|
|
843
|
-
width: 20px;
|
|
844
|
-
height: 20px;
|
|
845
|
-
--activityIndicatorLoadingDotColor: rgba(0, 0, 0, 0);
|
|
846
|
-
--activityIndicatorLoadingRingColor: ${activityIndicatorColor};
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
/* prevent selection from interfering with tooltip, especially on mobile */
|
|
850
|
-
/* https://stackoverflow.com/a/4407335/1163042 */
|
|
851
|
-
.noselect {
|
|
852
|
-
-webkit-touch-callout: none; /* iOS Safari */
|
|
853
|
-
-webkit-user-select: none; /* Safari */
|
|
854
|
-
-moz-user-select: none; /* Old versions of Firefox */
|
|
855
|
-
-ms-user-select: none; /* Internet Explorer/Edge */
|
|
856
|
-
user-select: none; /* current Chrome, Edge, Opera and Firefox */
|
|
857
|
-
}
|
|
858
|
-
.bar
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
bars
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
stroke
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
#inputs
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
}
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
872
|
+
HistogramDateRange.styles = css `
|
|
873
|
+
.missing-data-message {
|
|
874
|
+
text-align: center;
|
|
875
|
+
}
|
|
876
|
+
#container {
|
|
877
|
+
margin: 0;
|
|
878
|
+
touch-action: none;
|
|
879
|
+
position: relative;
|
|
880
|
+
}
|
|
881
|
+
.disabled {
|
|
882
|
+
opacity: 0.3;
|
|
883
|
+
}
|
|
884
|
+
ia-activity-indicator {
|
|
885
|
+
position: absolute;
|
|
886
|
+
left: calc(50% - 10px);
|
|
887
|
+
top: 10px;
|
|
888
|
+
width: 20px;
|
|
889
|
+
height: 20px;
|
|
890
|
+
--activityIndicatorLoadingDotColor: rgba(0, 0, 0, 0);
|
|
891
|
+
--activityIndicatorLoadingRingColor: ${activityIndicatorColor};
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
/* prevent selection from interfering with tooltip, especially on mobile */
|
|
895
|
+
/* https://stackoverflow.com/a/4407335/1163042 */
|
|
896
|
+
.noselect {
|
|
897
|
+
-webkit-touch-callout: none; /* iOS Safari */
|
|
898
|
+
-webkit-user-select: none; /* Safari */
|
|
899
|
+
-moz-user-select: none; /* Old versions of Firefox */
|
|
900
|
+
-ms-user-select: none; /* Internet Explorer/Edge */
|
|
901
|
+
user-select: none; /* current Chrome, Edge, Opera and Firefox */
|
|
902
|
+
}
|
|
903
|
+
.bar,
|
|
904
|
+
.bar-pointer-target {
|
|
905
|
+
/* create a transparent border around the hist bars to prevent "gaps" and
|
|
906
|
+
flickering when moving around between bars. this also helps with handling
|
|
907
|
+
clicks on the bars, preventing users from being able to click in between
|
|
908
|
+
bars */
|
|
909
|
+
stroke: rgba(0, 0, 0, 0);
|
|
910
|
+
/* ensure transparent stroke wide enough to cover gap between bars */
|
|
911
|
+
stroke-width: 2px;
|
|
912
|
+
}
|
|
913
|
+
.bar {
|
|
914
|
+
/* ensure the bar's pointer target receives events, not the bar itself */
|
|
915
|
+
pointer-events: none;
|
|
916
|
+
}
|
|
917
|
+
.bar-pointer-target:hover + .bar {
|
|
918
|
+
/* highlight currently hovered bar */
|
|
919
|
+
fill-opacity: 0.7;
|
|
920
|
+
}
|
|
921
|
+
.disabled .bar-pointer-target:hover + .bar {
|
|
922
|
+
/* ensure no visual hover interaction when disabled */
|
|
923
|
+
fill-opacity: 1;
|
|
924
|
+
}
|
|
925
|
+
/****** histogram ********/
|
|
926
|
+
#tooltip {
|
|
927
|
+
position: absolute;
|
|
928
|
+
background: ${tooltipBackgroundColor};
|
|
929
|
+
margin: 0;
|
|
930
|
+
border: 0;
|
|
931
|
+
color: ${tooltipTextColor};
|
|
932
|
+
text-align: center;
|
|
933
|
+
border-radius: 3px;
|
|
934
|
+
padding: 2px;
|
|
935
|
+
font-size: ${tooltipFontSize};
|
|
936
|
+
font-family: ${tooltipFontFamily};
|
|
937
|
+
touch-action: none;
|
|
938
|
+
pointer-events: none;
|
|
939
|
+
overflow: visible;
|
|
940
|
+
}
|
|
941
|
+
#tooltip:after {
|
|
942
|
+
content: '';
|
|
943
|
+
position: absolute;
|
|
944
|
+
margin-left: -5px;
|
|
945
|
+
top: 100%;
|
|
946
|
+
left: 50%;
|
|
947
|
+
/* arrow */
|
|
948
|
+
border: 5px solid ${tooltipTextColor};
|
|
949
|
+
border-color: ${tooltipBackgroundColor} transparent transparent
|
|
950
|
+
transparent;
|
|
951
|
+
}
|
|
952
|
+
/****** slider ********/
|
|
953
|
+
.slider {
|
|
954
|
+
shape-rendering: crispEdges; /* So the slider doesn't get blurry if dragged between pixels */
|
|
955
|
+
}
|
|
956
|
+
.draggable:hover {
|
|
957
|
+
cursor: grab;
|
|
958
|
+
}
|
|
959
|
+
.dragging {
|
|
960
|
+
cursor: grabbing !important;
|
|
961
|
+
}
|
|
962
|
+
/****** inputs ********/
|
|
963
|
+
#inputs {
|
|
964
|
+
display: flex;
|
|
965
|
+
justify-content: center;
|
|
966
|
+
margin: ${inputRowMargin};
|
|
967
|
+
}
|
|
968
|
+
#inputs .dash {
|
|
969
|
+
position: relative;
|
|
970
|
+
bottom: -1px;
|
|
971
|
+
align-self: center; /* Otherwise the dash sticks to the top while the inputs grow */
|
|
972
|
+
}
|
|
973
|
+
input {
|
|
974
|
+
width: ${inputWidth};
|
|
975
|
+
margin: 0 3px;
|
|
976
|
+
border: ${inputBorder};
|
|
977
|
+
border-radius: 2px !important;
|
|
978
|
+
text-align: center;
|
|
979
|
+
font-size: ${inputFontSize};
|
|
980
|
+
font-family: ${inputFontFamily};
|
|
981
|
+
}
|
|
982
|
+
.sr-only {
|
|
983
|
+
position: absolute !important;
|
|
984
|
+
width: 1px !important;
|
|
985
|
+
height: 1px !important;
|
|
986
|
+
margin: 0 !important;
|
|
987
|
+
padding: 0 !important;
|
|
988
|
+
border: 0 !important;
|
|
989
|
+
overflow: hidden !important;
|
|
990
|
+
white-space: nowrap !important;
|
|
991
|
+
clip: rect(1px, 1px, 1px, 1px) !important;
|
|
992
|
+
-webkit-clip-path: inset(50%) !important;
|
|
993
|
+
clip-path: inset(50%) !important;
|
|
994
|
+
}
|
|
945
995
|
`;
|
|
946
996
|
__decorate([
|
|
947
997
|
property({ type: Number })
|
|
@@ -985,6 +1035,12 @@ __decorate([
|
|
|
985
1035
|
__decorate([
|
|
986
1036
|
property({ type: String })
|
|
987
1037
|
], HistogramDateRange.prototype, "binSnapping", void 0);
|
|
1038
|
+
__decorate([
|
|
1039
|
+
property({ type: String })
|
|
1040
|
+
], HistogramDateRange.prototype, "tooltipLabel", void 0);
|
|
1041
|
+
__decorate([
|
|
1042
|
+
property({ type: String })
|
|
1043
|
+
], HistogramDateRange.prototype, "barScaling", void 0);
|
|
988
1044
|
__decorate([
|
|
989
1045
|
state()
|
|
990
1046
|
], HistogramDateRange.prototype, "_tooltipOffsetX", void 0);
|