@internetarchive/histogram-date-range 1.3.2 → 1.4.0-alpha-webdev7756.0
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 +9 -2
- package/demo/js/{app-root.ts → lit-histogram-wrapper.ts} +20 -4
- package/dist/demo/js/app-root.d.ts +2 -1
- package/dist/demo/js/app-root.js +20 -19
- package/dist/demo/js/app-root.js.map +1 -1
- 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/src/histogram-date-range.d.ts +18 -0
- package/dist/src/histogram-date-range.js +282 -242
- package/dist/src/histogram-date-range.js.map +1 -1
- package/dist/test/histogram-date-range.test.js +202 -178
- package/dist/test/histogram-date-range.test.js.map +1 -1
- package/docs/demo/index.html +9 -2
- package/docs/dist/demo/js/{app-root.js → lit-histogram-wrapper.js} +22 -7
- package/docs/dist/src/histogram-date-range.js +34 -11
- package/package.json +1 -1
- package/src/histogram-date-range.ts +1152 -1110
- package/test/histogram-date-range.test.ts +966 -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,6 +19,9 @@ 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';
|
|
23
|
+
// this function may be overridden only via Lit property expression or direct assignment
|
|
24
|
+
const LOG_BAR_SCALING_FN = (binValue) => Math.log1p(binValue);
|
|
22
25
|
// this constant is not set up to be overridden
|
|
23
26
|
const SLIDER_CORNER_SIZE = 4;
|
|
24
27
|
// these CSS custom props can be overridden from the HTML that is invoking this component
|
|
@@ -67,6 +70,24 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
67
70
|
* - `year`: Same as `month`, but snapping to year boundaries instead of months.
|
|
68
71
|
*/
|
|
69
72
|
this.binSnapping = 'none';
|
|
73
|
+
/**
|
|
74
|
+
* What label to use on tooltips to identify the type of data being represented.
|
|
75
|
+
* Defaults to `'item(s)'`.
|
|
76
|
+
*/
|
|
77
|
+
this.tooltipLabel = TOOLTIP_LABEL;
|
|
78
|
+
/**
|
|
79
|
+
* A function mapping bin values to a new value that determines how tall each bar will
|
|
80
|
+
* be in relation to the others.
|
|
81
|
+
*
|
|
82
|
+
* Default sizing function is the logarithm of the bin value, yielding more prominent
|
|
83
|
+
* bars for smaller values, at the cost of bars not being directly proportional to their
|
|
84
|
+
* values and having relatively smooth variation among values of a similar magnitude.
|
|
85
|
+
* This ensures that when the difference between the min and max values is large, small
|
|
86
|
+
* values are not as liable to completely disappear visually.
|
|
87
|
+
*
|
|
88
|
+
* For linearly-scaled bars, set this to the identity function.
|
|
89
|
+
*/
|
|
90
|
+
this.barScalingFunction = LOG_BAR_SCALING_FN;
|
|
70
91
|
// internal reactive properties not exposed as attributes
|
|
71
92
|
this._tooltipOffsetX = 0;
|
|
72
93
|
this._tooltipOffsetY = 0;
|
|
@@ -232,7 +253,7 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
232
253
|
const maxValue = Math.max(...this.bins);
|
|
233
254
|
// if there is no difference between the min and max values, use a range of
|
|
234
255
|
// 1 because log scaling will fail if the range is 0
|
|
235
|
-
const valueRange = minValue === maxValue ? 1 :
|
|
256
|
+
const valueRange = minValue === maxValue ? 1 : this.barScalingFunction(maxValue);
|
|
236
257
|
const valueScale = height / valueRange;
|
|
237
258
|
const dateScale = dateRangeMS / _numBins;
|
|
238
259
|
return bins.map((v, i) => {
|
|
@@ -251,7 +272,7 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
251
272
|
value: v,
|
|
252
273
|
// use log scaling for the height of the bar to prevent tall bars from
|
|
253
274
|
// making the smaller ones too small to see
|
|
254
|
-
height: Math.floor(
|
|
275
|
+
height: Math.floor(this.barScalingFunction(v) * valueScale),
|
|
255
276
|
binStart,
|
|
256
277
|
binEnd,
|
|
257
278
|
tooltip,
|
|
@@ -379,7 +400,7 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
379
400
|
const target = e.currentTarget;
|
|
380
401
|
const x = target.x.baseVal.value + this.sliderWidth / 2;
|
|
381
402
|
const dataset = target.dataset;
|
|
382
|
-
const itemsText =
|
|
403
|
+
const itemsText = `${this.tooltipLabel}${dataset.numItems !== '1' ? 's' : ''}`;
|
|
383
404
|
const formattedNumItems = Number(dataset.numItems).toLocaleString();
|
|
384
405
|
const tooltipPadding = 2;
|
|
385
406
|
const bufferHeight = 9;
|
|
@@ -395,9 +416,9 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
395
416
|
window.scrollX;
|
|
396
417
|
// Place the tooltip (with arrow) just above the top of the histogram bars
|
|
397
418
|
this._tooltipOffsetY = histogramY - heightAboveHistogram + window.scrollY;
|
|
398
|
-
this._tooltipContent = html `
|
|
399
|
-
${formattedNumItems} ${itemsText}<br />
|
|
400
|
-
${dataset.tooltip}
|
|
419
|
+
this._tooltipContent = html `
|
|
420
|
+
${formattedNumItems} ${itemsText}<br />
|
|
421
|
+
${dataset.tooltip}
|
|
401
422
|
`;
|
|
402
423
|
(_b = (_a = this._tooltip).showPopover) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
403
424
|
}
|
|
@@ -594,25 +615,25 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
594
615
|
// border-radius); used as part of a SVG quadratic curve. see
|
|
595
616
|
// https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#curve_commands
|
|
596
617
|
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}
|
|
618
|
+
const sliderShape = `
|
|
619
|
+
M${this.minSliderX},0
|
|
620
|
+
h-${this.sliderWidth - cs}
|
|
621
|
+
q-${cs},0 -${cs},${cs}
|
|
622
|
+
v${this.height - cs * 2}
|
|
623
|
+
q0,${cs} ${cs},${cs}
|
|
624
|
+
h${this.sliderWidth - cs}
|
|
604
625
|
`;
|
|
605
626
|
return this.generateSliderSVG(this.minSliderX, 'slider-min', sliderShape);
|
|
606
627
|
}
|
|
607
628
|
get maxSliderTemplate() {
|
|
608
629
|
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}
|
|
630
|
+
const sliderShape = `
|
|
631
|
+
M${this.maxSliderX},0
|
|
632
|
+
h${this.sliderWidth - cs}
|
|
633
|
+
q${cs},0 ${cs},${cs}
|
|
634
|
+
v${this.height - cs * 2}
|
|
635
|
+
q0,${cs} -${cs},${cs}
|
|
636
|
+
h-${this.sliderWidth - cs}
|
|
616
637
|
`;
|
|
617
638
|
return this.generateSliderSVG(this.maxSliderX, 'slider-max', sliderShape);
|
|
618
639
|
}
|
|
@@ -625,38 +646,38 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
625
646
|
draggable: !this.disabled,
|
|
626
647
|
dragging: this._isDragging,
|
|
627
648
|
});
|
|
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>
|
|
649
|
+
return svg `
|
|
650
|
+
<svg
|
|
651
|
+
id=${id}
|
|
652
|
+
class=${sliderClasses}
|
|
653
|
+
@pointerdown=${this.drag}
|
|
654
|
+
>
|
|
655
|
+
<path d="${sliderShape} z" fill="${sliderColor}" />
|
|
656
|
+
<rect
|
|
657
|
+
x="${sliderPositionX - this.sliderWidth * k + this.sliderWidth * 0.4 * k}"
|
|
658
|
+
y="${this.height / 3}"
|
|
659
|
+
width="1"
|
|
660
|
+
height="${this.height / 3}"
|
|
661
|
+
fill="white"
|
|
662
|
+
/>
|
|
663
|
+
<rect
|
|
664
|
+
x="${sliderPositionX - this.sliderWidth * k + this.sliderWidth * 0.6 * k}"
|
|
665
|
+
y="${this.height / 3}"
|
|
666
|
+
width="1"
|
|
667
|
+
height="${this.height / 3}"
|
|
668
|
+
fill="white"
|
|
669
|
+
/>
|
|
670
|
+
</svg>
|
|
650
671
|
`;
|
|
651
672
|
}
|
|
652
673
|
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}"
|
|
674
|
+
return svg `
|
|
675
|
+
<rect
|
|
676
|
+
x="${this.minSliderX}"
|
|
677
|
+
y="0"
|
|
678
|
+
width="${this.maxSliderX - this.minSliderX}"
|
|
679
|
+
height="${this.height}"
|
|
680
|
+
fill="${selectedRangeColor}"
|
|
660
681
|
/>`;
|
|
661
682
|
}
|
|
662
683
|
get histogramTemplate() {
|
|
@@ -674,22 +695,30 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
674
695
|
// between adjacent bars (eg when viewing the tooltips or when trying to
|
|
675
696
|
// extend the range by clicking on a bar)
|
|
676
697
|
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
|
-
|
|
698
|
+
const bar = svg `
|
|
699
|
+
<rect
|
|
700
|
+
class="bar-pointer-target"
|
|
701
|
+
x=${x}
|
|
702
|
+
y="0"
|
|
703
|
+
width=${barWidth}
|
|
704
|
+
height=${this.height}
|
|
705
|
+
@pointerenter=${this.showTooltip}
|
|
706
|
+
@pointerleave=${this.hideTooltip}
|
|
707
|
+
@click=${this.handleBarClick}
|
|
708
|
+
fill="transparent"
|
|
709
|
+
data-num-items=${data.value}
|
|
710
|
+
data-bin-start=${data.binStart}
|
|
711
|
+
data-bin-end=${data.binEnd}
|
|
712
|
+
data-tooltip=${data.tooltip}
|
|
713
|
+
/>
|
|
714
|
+
<rect
|
|
715
|
+
class="bar"
|
|
716
|
+
style=${barStyle}
|
|
717
|
+
x=${x}
|
|
718
|
+
y=${this.height - barHeight}
|
|
719
|
+
width=${barWidth}
|
|
720
|
+
height=${barHeight}
|
|
721
|
+
fill=${barFill}
|
|
693
722
|
/>`;
|
|
694
723
|
x += xScale;
|
|
695
724
|
return bar;
|
|
@@ -729,31 +758,31 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
729
758
|
* https://lit.dev/docs/templates/directives/#live
|
|
730
759
|
*/
|
|
731
760
|
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
|
-
/>
|
|
761
|
+
return html `
|
|
762
|
+
<input
|
|
763
|
+
id="date-min"
|
|
764
|
+
placeholder=${this.dateFormat}
|
|
765
|
+
type="text"
|
|
766
|
+
@focus=${this.handleInputFocus}
|
|
767
|
+
@blur=${this.handleMinDateInput}
|
|
768
|
+
@keyup=${this.handleKeyUp}
|
|
769
|
+
.value=${live(this.minSelectedDate)}
|
|
770
|
+
?disabled=${this.disabled}
|
|
771
|
+
/>
|
|
743
772
|
`;
|
|
744
773
|
}
|
|
745
774
|
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
|
-
/>
|
|
775
|
+
return html `
|
|
776
|
+
<input
|
|
777
|
+
id="date-max"
|
|
778
|
+
placeholder=${this.dateFormat}
|
|
779
|
+
type="text"
|
|
780
|
+
@focus=${this.handleInputFocus}
|
|
781
|
+
@blur=${this.handleMaxDateInput}
|
|
782
|
+
@keyup=${this.handleKeyUp}
|
|
783
|
+
.value=${live(this.maxSelectedDate)}
|
|
784
|
+
?disabled=${this.disabled}
|
|
785
|
+
/>
|
|
757
786
|
`;
|
|
758
787
|
}
|
|
759
788
|
get minLabelTemplate() {
|
|
@@ -769,179 +798,184 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
769
798
|
top: `${this._tooltipOffsetY}px`,
|
|
770
799
|
left: `${this._tooltipOffsetX}px`,
|
|
771
800
|
});
|
|
772
|
-
return html `
|
|
773
|
-
<div id="tooltip" style=${styles} popover>${this._tooltipContent}</div>
|
|
801
|
+
return html `
|
|
802
|
+
<div id="tooltip" style=${styles} popover>${this._tooltipContent}</div>
|
|
774
803
|
`;
|
|
775
804
|
}
|
|
776
805
|
get noDataTemplate() {
|
|
777
|
-
return html `
|
|
778
|
-
<div class="missing-data-message">${this.missingDataMessage}</div>
|
|
806
|
+
return html `
|
|
807
|
+
<div class="missing-data-message">${this.missingDataMessage}</div>
|
|
779
808
|
`;
|
|
780
809
|
}
|
|
781
810
|
get activityIndicatorTemplate() {
|
|
782
811
|
if (!this.loading) {
|
|
783
812
|
return nothing;
|
|
784
813
|
}
|
|
785
|
-
return html `
|
|
786
|
-
<ia-activity-indicator mode="processing"> </ia-activity-indicator>
|
|
814
|
+
return html `
|
|
815
|
+
<ia-activity-indicator mode="processing"> </ia-activity-indicator>
|
|
787
816
|
`;
|
|
788
817
|
}
|
|
789
818
|
render() {
|
|
790
819
|
if (!this.hasBinData) {
|
|
791
820
|
return this.noDataTemplate;
|
|
792
821
|
}
|
|
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>
|
|
822
|
+
return html `
|
|
823
|
+
<div
|
|
824
|
+
id="container"
|
|
825
|
+
class="
|
|
826
|
+
noselect
|
|
827
|
+
${this._isDragging ? 'dragging' : ''}
|
|
828
|
+
"
|
|
829
|
+
style="width: ${this.width}px"
|
|
830
|
+
>
|
|
831
|
+
${this.activityIndicatorTemplate} ${this.tooltipTemplate}
|
|
832
|
+
<div
|
|
833
|
+
class="inner-container
|
|
834
|
+
${this.disabled ? 'disabled' : ''}"
|
|
835
|
+
>
|
|
836
|
+
<svg
|
|
837
|
+
width="${this.width}"
|
|
838
|
+
height="${this.height}"
|
|
839
|
+
@pointerleave="${this.drop}"
|
|
840
|
+
>
|
|
841
|
+
${this.selectedRangeTemplate}
|
|
842
|
+
<svg id="histogram">${this.histogramTemplate}</svg>
|
|
843
|
+
${this.minSliderTemplate} ${this.maxSliderTemplate}
|
|
844
|
+
</svg>
|
|
845
|
+
<div id="inputs">
|
|
846
|
+
${this.minLabelTemplate} ${this.minInputTemplate}
|
|
847
|
+
<div class="dash">-</div>
|
|
848
|
+
${this.maxLabelTemplate} ${this.maxInputTemplate}
|
|
849
|
+
<slot name="inputs-right-side"></slot>
|
|
850
|
+
</div>
|
|
851
|
+
</div>
|
|
852
|
+
</div>
|
|
824
853
|
`;
|
|
825
854
|
}
|
|
826
855
|
};
|
|
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
|
-
|
|
856
|
+
HistogramDateRange.styles = css `
|
|
857
|
+
.missing-data-message {
|
|
858
|
+
text-align: center;
|
|
859
|
+
}
|
|
860
|
+
#container {
|
|
861
|
+
margin: 0;
|
|
862
|
+
touch-action: none;
|
|
863
|
+
position: relative;
|
|
864
|
+
}
|
|
865
|
+
.disabled {
|
|
866
|
+
opacity: 0.3;
|
|
867
|
+
}
|
|
868
|
+
ia-activity-indicator {
|
|
869
|
+
position: absolute;
|
|
870
|
+
left: calc(50% - 10px);
|
|
871
|
+
top: 10px;
|
|
872
|
+
width: 20px;
|
|
873
|
+
height: 20px;
|
|
874
|
+
--activityIndicatorLoadingDotColor: rgba(0, 0, 0, 0);
|
|
875
|
+
--activityIndicatorLoadingRingColor: ${activityIndicatorColor};
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
/* prevent selection from interfering with tooltip, especially on mobile */
|
|
879
|
+
/* https://stackoverflow.com/a/4407335/1163042 */
|
|
880
|
+
.noselect {
|
|
881
|
+
-webkit-touch-callout: none; /* iOS Safari */
|
|
882
|
+
-webkit-user-select: none; /* Safari */
|
|
883
|
+
-moz-user-select: none; /* Old versions of Firefox */
|
|
884
|
+
-ms-user-select: none; /* Internet Explorer/Edge */
|
|
885
|
+
user-select: none; /* current Chrome, Edge, Opera and Firefox */
|
|
886
|
+
}
|
|
887
|
+
.bar,
|
|
888
|
+
.bar-pointer-target {
|
|
889
|
+
/* create a transparent border around the hist bars to prevent "gaps" and
|
|
890
|
+
flickering when moving around between bars. this also helps with handling
|
|
891
|
+
clicks on the bars, preventing users from being able to click in between
|
|
892
|
+
bars */
|
|
893
|
+
stroke: rgba(0, 0, 0, 0);
|
|
894
|
+
/* ensure transparent stroke wide enough to cover gap between bars */
|
|
895
|
+
stroke-width: 2px;
|
|
896
|
+
}
|
|
897
|
+
.bar {
|
|
898
|
+
/* ensure the bar's pointer target receives events, not the bar itself */
|
|
899
|
+
pointer-events: none;
|
|
900
|
+
}
|
|
901
|
+
.bar-pointer-target:hover + .bar {
|
|
902
|
+
/* highlight currently hovered bar */
|
|
903
|
+
fill-opacity: 0.7;
|
|
904
|
+
}
|
|
905
|
+
.disabled .bar-pointer-target:hover + .bar {
|
|
906
|
+
/* ensure no visual hover interaction when disabled */
|
|
907
|
+
fill-opacity: 1;
|
|
908
|
+
}
|
|
909
|
+
/****** histogram ********/
|
|
910
|
+
#tooltip {
|
|
911
|
+
position: absolute;
|
|
912
|
+
background: ${tooltipBackgroundColor};
|
|
913
|
+
margin: 0;
|
|
914
|
+
border: 0;
|
|
915
|
+
color: ${tooltipTextColor};
|
|
916
|
+
text-align: center;
|
|
917
|
+
border-radius: 3px;
|
|
918
|
+
padding: 2px;
|
|
919
|
+
font-size: ${tooltipFontSize};
|
|
920
|
+
font-family: ${tooltipFontFamily};
|
|
921
|
+
touch-action: none;
|
|
922
|
+
pointer-events: none;
|
|
923
|
+
overflow: visible;
|
|
924
|
+
}
|
|
925
|
+
#tooltip:after {
|
|
926
|
+
content: '';
|
|
927
|
+
position: absolute;
|
|
928
|
+
margin-left: -5px;
|
|
929
|
+
top: 100%;
|
|
930
|
+
left: 50%;
|
|
931
|
+
/* arrow */
|
|
932
|
+
border: 5px solid ${tooltipTextColor};
|
|
933
|
+
border-color: ${tooltipBackgroundColor} transparent transparent
|
|
934
|
+
transparent;
|
|
935
|
+
}
|
|
936
|
+
/****** slider ********/
|
|
937
|
+
.slider {
|
|
938
|
+
shape-rendering: crispEdges; /* So the slider doesn't get blurry if dragged between pixels */
|
|
939
|
+
}
|
|
940
|
+
.draggable:hover {
|
|
941
|
+
cursor: grab;
|
|
942
|
+
}
|
|
943
|
+
.dragging {
|
|
944
|
+
cursor: grabbing !important;
|
|
945
|
+
}
|
|
946
|
+
/****** inputs ********/
|
|
947
|
+
#inputs {
|
|
948
|
+
display: flex;
|
|
949
|
+
justify-content: center;
|
|
950
|
+
margin: ${inputRowMargin};
|
|
951
|
+
}
|
|
952
|
+
#inputs .dash {
|
|
953
|
+
position: relative;
|
|
954
|
+
bottom: -1px;
|
|
955
|
+
align-self: center; /* Otherwise the dash sticks to the top while the inputs grow */
|
|
956
|
+
}
|
|
957
|
+
input {
|
|
958
|
+
width: ${inputWidth};
|
|
959
|
+
margin: 0 3px;
|
|
960
|
+
border: ${inputBorder};
|
|
961
|
+
border-radius: 2px !important;
|
|
962
|
+
text-align: center;
|
|
963
|
+
font-size: ${inputFontSize};
|
|
964
|
+
font-family: ${inputFontFamily};
|
|
965
|
+
}
|
|
966
|
+
.sr-only {
|
|
967
|
+
position: absolute !important;
|
|
968
|
+
width: 1px !important;
|
|
969
|
+
height: 1px !important;
|
|
970
|
+
margin: 0 !important;
|
|
971
|
+
padding: 0 !important;
|
|
972
|
+
border: 0 !important;
|
|
973
|
+
overflow: hidden !important;
|
|
974
|
+
white-space: nowrap !important;
|
|
975
|
+
clip: rect(1px, 1px, 1px, 1px) !important;
|
|
976
|
+
-webkit-clip-path: inset(50%) !important;
|
|
977
|
+
clip-path: inset(50%) !important;
|
|
978
|
+
}
|
|
945
979
|
`;
|
|
946
980
|
__decorate([
|
|
947
981
|
property({ type: Number })
|
|
@@ -985,6 +1019,12 @@ __decorate([
|
|
|
985
1019
|
__decorate([
|
|
986
1020
|
property({ type: String })
|
|
987
1021
|
], HistogramDateRange.prototype, "binSnapping", void 0);
|
|
1022
|
+
__decorate([
|
|
1023
|
+
property({ type: String })
|
|
1024
|
+
], HistogramDateRange.prototype, "tooltipLabel", void 0);
|
|
1025
|
+
__decorate([
|
|
1026
|
+
property({ attribute: false })
|
|
1027
|
+
], HistogramDateRange.prototype, "barScalingFunction", void 0);
|
|
988
1028
|
__decorate([
|
|
989
1029
|
state()
|
|
990
1030
|
], HistogramDateRange.prototype, "_tooltipOffsetX", void 0);
|