@internetarchive/histogram-date-range 1.2.2-alpha-webdev7377.1 → 1.2.2-alpha-webdev7377.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/dist/index.js.map +1 -1
- package/dist/src/histogram-date-range.js +257 -253
- package/dist/src/histogram-date-range.js.map +1 -1
- package/dist/test/histogram-date-range.test.js +107 -107
- package/dist/test/histogram-date-range.test.js.map +1 -1
- package/docs/dist/src/histogram-date-range.js +9 -9
- package/index.ts +1 -1
- package/package.json +1 -1
- package/src/histogram-date-range.ts +941 -936
- package/test/histogram-date-range.test.ts +684 -684
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC","sourcesContent":["export { HistogramDateRange } from './src/histogram-date-range';\
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC","sourcesContent":["export { HistogramDateRange } from './src/histogram-date-range';\n"]}
|
|
@@ -152,21 +152,22 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
152
152
|
roundToMonth(timestamp) {
|
|
153
153
|
const date = new Date(timestamp);
|
|
154
154
|
const [y, m, d] = [date.getFullYear(), date.getMonth(), date.getDate()];
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
return d < 15
|
|
156
|
+
? new Date(y, m, 1).getTime()
|
|
157
|
+
: new Date(y, m + 1, 1).getTime();
|
|
158
158
|
}
|
|
159
159
|
calculateHistData() {
|
|
160
|
+
const { bins, height, dateRangeMS, _numBins, _minDateMS } = this;
|
|
160
161
|
const minValue = Math.min(...this.bins);
|
|
161
162
|
const maxValue = Math.max(...this.bins);
|
|
162
163
|
// if there is no difference between the min and max values, use a range of
|
|
163
164
|
// 1 because log scaling will fail if the range is 0
|
|
164
165
|
const valueRange = minValue === maxValue ? 1 : Math.log1p(maxValue);
|
|
165
|
-
const valueScale =
|
|
166
|
-
const dateScale =
|
|
167
|
-
return
|
|
168
|
-
const binStartMS = this.roundToMonth(i * dateScale +
|
|
169
|
-
const binEndMS = this.roundToMonth((i + 1) * dateScale +
|
|
166
|
+
const valueScale = height / valueRange;
|
|
167
|
+
const dateScale = dateRangeMS / _numBins;
|
|
168
|
+
return bins.map((v, i) => {
|
|
169
|
+
const binStartMS = this.roundToMonth(i * dateScale + _minDateMS);
|
|
170
|
+
const binEndMS = this.roundToMonth((i + 1) * dateScale + _minDateMS) - 1;
|
|
170
171
|
return {
|
|
171
172
|
value: v,
|
|
172
173
|
// use log scaling for the height of the bar to prevent tall bars from
|
|
@@ -271,12 +272,15 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
271
272
|
const x = target.x.baseVal.value + this.sliderWidth / 2;
|
|
272
273
|
const dataset = target.dataset;
|
|
273
274
|
const itemsText = `item${dataset.numItems !== '1' ? 's' : ''}`;
|
|
275
|
+
const datesText = dataset.binStart === dataset.binEnd
|
|
276
|
+
? `${dataset.binStart}` // If start/end are the same, just render a single value
|
|
277
|
+
: `${dataset.binStart} - ${dataset.binEnd}`;
|
|
274
278
|
const formattedNumItems = Number(dataset.numItems).toLocaleString();
|
|
275
279
|
this._tooltipOffset =
|
|
276
280
|
x + (this._binWidth - this.sliderWidth - this.tooltipWidth) / 2;
|
|
277
|
-
this._tooltipContent = html `
|
|
278
|
-
${formattedNumItems} ${itemsText}<br />
|
|
279
|
-
${
|
|
281
|
+
this._tooltipContent = html `
|
|
282
|
+
${formattedNumItems} ${itemsText}<br />
|
|
283
|
+
${datesText}
|
|
280
284
|
`;
|
|
281
285
|
this._tooltipVisible = true;
|
|
282
286
|
}
|
|
@@ -471,25 +475,25 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
471
475
|
// border-radius); used as part of a SVG quadratic curve. see
|
|
472
476
|
// https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#curve_commands
|
|
473
477
|
const cs = SLIDER_CORNER_SIZE;
|
|
474
|
-
const sliderShape = `
|
|
475
|
-
M${this.minSliderX},0
|
|
476
|
-
h-${this.sliderWidth - cs}
|
|
477
|
-
q-${cs},0 -${cs},${cs}
|
|
478
|
-
v${this.height - cs * 2}
|
|
479
|
-
q0,${cs} ${cs},${cs}
|
|
480
|
-
h${this.sliderWidth - cs}
|
|
478
|
+
const sliderShape = `
|
|
479
|
+
M${this.minSliderX},0
|
|
480
|
+
h-${this.sliderWidth - cs}
|
|
481
|
+
q-${cs},0 -${cs},${cs}
|
|
482
|
+
v${this.height - cs * 2}
|
|
483
|
+
q0,${cs} ${cs},${cs}
|
|
484
|
+
h${this.sliderWidth - cs}
|
|
481
485
|
`;
|
|
482
486
|
return this.generateSliderSVG(this.minSliderX, 'slider-min', sliderShape);
|
|
483
487
|
}
|
|
484
488
|
get maxSliderTemplate() {
|
|
485
489
|
const cs = SLIDER_CORNER_SIZE;
|
|
486
|
-
const sliderShape = `
|
|
487
|
-
M${this.maxSliderX},0
|
|
488
|
-
h${this.sliderWidth - cs}
|
|
489
|
-
q${cs},0 ${cs},${cs}
|
|
490
|
-
v${this.height - cs * 2}
|
|
491
|
-
q0,${cs} -${cs},${cs}
|
|
492
|
-
h-${this.sliderWidth - cs}
|
|
490
|
+
const sliderShape = `
|
|
491
|
+
M${this.maxSliderX},0
|
|
492
|
+
h${this.sliderWidth - cs}
|
|
493
|
+
q${cs},0 ${cs},${cs}
|
|
494
|
+
v${this.height - cs * 2}
|
|
495
|
+
q0,${cs} -${cs},${cs}
|
|
496
|
+
h-${this.sliderWidth - cs}
|
|
493
497
|
`;
|
|
494
498
|
return this.generateSliderSVG(this.maxSliderX, 'slider-max', sliderShape);
|
|
495
499
|
}
|
|
@@ -497,40 +501,40 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
497
501
|
// whether the curved part of the slider is facing towards the left (1), ie
|
|
498
502
|
// minimum, or facing towards the right (-1), ie maximum
|
|
499
503
|
const k = id === 'slider-min' ? 1 : -1;
|
|
500
|
-
return svg `
|
|
501
|
-
<svg
|
|
502
|
-
id="${id}"
|
|
503
|
-
class="
|
|
504
|
-
${this.disabled ? '' : 'draggable'}
|
|
505
|
-
${this._isDragging ? 'dragging' : ''}"
|
|
506
|
-
@pointerdown="${this.drag}"
|
|
507
|
-
>
|
|
508
|
-
<path d="${sliderShape} z" fill="${sliderColor}" />
|
|
509
|
-
<rect
|
|
510
|
-
x="${sliderPositionX - this.sliderWidth * k + this.sliderWidth * 0.4 * k}"
|
|
511
|
-
y="${this.height / 3}"
|
|
512
|
-
width="1"
|
|
513
|
-
height="${this.height / 3}"
|
|
514
|
-
fill="white"
|
|
515
|
-
/>
|
|
516
|
-
<rect
|
|
517
|
-
x="${sliderPositionX - this.sliderWidth * k + this.sliderWidth * 0.6 * k}"
|
|
518
|
-
y="${this.height / 3}"
|
|
519
|
-
width="1"
|
|
520
|
-
height="${this.height / 3}"
|
|
521
|
-
fill="white"
|
|
522
|
-
/>
|
|
523
|
-
</svg>
|
|
504
|
+
return svg `
|
|
505
|
+
<svg
|
|
506
|
+
id="${id}"
|
|
507
|
+
class="
|
|
508
|
+
${this.disabled ? '' : 'draggable'}
|
|
509
|
+
${this._isDragging ? 'dragging' : ''}"
|
|
510
|
+
@pointerdown="${this.drag}"
|
|
511
|
+
>
|
|
512
|
+
<path d="${sliderShape} z" fill="${sliderColor}" />
|
|
513
|
+
<rect
|
|
514
|
+
x="${sliderPositionX - this.sliderWidth * k + this.sliderWidth * 0.4 * k}"
|
|
515
|
+
y="${this.height / 3}"
|
|
516
|
+
width="1"
|
|
517
|
+
height="${this.height / 3}"
|
|
518
|
+
fill="white"
|
|
519
|
+
/>
|
|
520
|
+
<rect
|
|
521
|
+
x="${sliderPositionX - this.sliderWidth * k + this.sliderWidth * 0.6 * k}"
|
|
522
|
+
y="${this.height / 3}"
|
|
523
|
+
width="1"
|
|
524
|
+
height="${this.height / 3}"
|
|
525
|
+
fill="white"
|
|
526
|
+
/>
|
|
527
|
+
</svg>
|
|
524
528
|
`;
|
|
525
529
|
}
|
|
526
530
|
get selectedRangeTemplate() {
|
|
527
|
-
return svg `
|
|
528
|
-
<rect
|
|
529
|
-
x="${this.minSliderX}"
|
|
530
|
-
y="0"
|
|
531
|
-
width="${this.maxSliderX - this.minSliderX}"
|
|
532
|
-
height="${this.height}"
|
|
533
|
-
fill="${selectedRangeColor}"
|
|
531
|
+
return svg `
|
|
532
|
+
<rect
|
|
533
|
+
x="${this.minSliderX}"
|
|
534
|
+
y="0"
|
|
535
|
+
width="${this.maxSliderX - this.minSliderX}"
|
|
536
|
+
height="${this.height}"
|
|
537
|
+
fill="${selectedRangeColor}"
|
|
534
538
|
/>`;
|
|
535
539
|
}
|
|
536
540
|
get histogramTemplate() {
|
|
@@ -542,23 +546,23 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
542
546
|
// between adjacent bars (eg when viewing the tooltips or when trying to
|
|
543
547
|
// extend the range by clicking on a bar)
|
|
544
548
|
return this._histData.map(data => {
|
|
545
|
-
const bar = svg `
|
|
546
|
-
<rect
|
|
547
|
-
class="bar"
|
|
548
|
-
style='stroke-dasharray: 0 ${barWidth} ${data.height} ${barWidth} 0 ${data.height};'
|
|
549
|
-
x="${x}"
|
|
550
|
-
y="${this.height - data.height}"
|
|
551
|
-
width="${barWidth}"
|
|
552
|
-
height="${data.height}"
|
|
553
|
-
@pointerenter="${this.showTooltip}"
|
|
554
|
-
@pointerleave="${this.hideTooltip}"
|
|
555
|
-
@click="${this.handleBarClick}"
|
|
549
|
+
const bar = svg `
|
|
550
|
+
<rect
|
|
551
|
+
class="bar"
|
|
552
|
+
style='stroke-dasharray: 0 ${barWidth} ${data.height} ${barWidth} 0 ${data.height};'
|
|
553
|
+
x="${x}"
|
|
554
|
+
y="${this.height - data.height}"
|
|
555
|
+
width="${barWidth}"
|
|
556
|
+
height="${data.height}"
|
|
557
|
+
@pointerenter="${this.showTooltip}"
|
|
558
|
+
@pointerleave="${this.hideTooltip}"
|
|
559
|
+
@click="${this.handleBarClick}"
|
|
556
560
|
fill="${x + barWidth >= this.minSliderX && x <= this.maxSliderX
|
|
557
561
|
? barIncludedFill
|
|
558
|
-
: barExcludedFill}"
|
|
559
|
-
data-num-items="${data.value}"
|
|
560
|
-
data-bin-start="${data.binStart}"
|
|
561
|
-
data-bin-end="${data.binEnd}"
|
|
562
|
+
: barExcludedFill}"
|
|
563
|
+
data-num-items="${data.value}"
|
|
564
|
+
data-bin-start="${data.binStart}"
|
|
565
|
+
data-bin-end="${data.binEnd}"
|
|
562
566
|
/>`;
|
|
563
567
|
x += xScale;
|
|
564
568
|
return bar;
|
|
@@ -583,31 +587,31 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
583
587
|
* https://lit.dev/docs/templates/directives/#live
|
|
584
588
|
*/
|
|
585
589
|
get minInputTemplate() {
|
|
586
|
-
return html `
|
|
587
|
-
<input
|
|
588
|
-
id="date-min"
|
|
589
|
-
placeholder="${this.dateFormat}"
|
|
590
|
-
type="text"
|
|
591
|
-
@focus="${this.handleInputFocus}"
|
|
592
|
-
@blur="${this.handleMinDateInput}"
|
|
593
|
-
@keyup="${this.handleKeyUp}"
|
|
594
|
-
.value="${live(this.minSelectedDate)}"
|
|
595
|
-
?disabled="${this.disabled}"
|
|
596
|
-
/>
|
|
590
|
+
return html `
|
|
591
|
+
<input
|
|
592
|
+
id="date-min"
|
|
593
|
+
placeholder="${this.dateFormat}"
|
|
594
|
+
type="text"
|
|
595
|
+
@focus="${this.handleInputFocus}"
|
|
596
|
+
@blur="${this.handleMinDateInput}"
|
|
597
|
+
@keyup="${this.handleKeyUp}"
|
|
598
|
+
.value="${live(this.minSelectedDate)}"
|
|
599
|
+
?disabled="${this.disabled}"
|
|
600
|
+
/>
|
|
597
601
|
`;
|
|
598
602
|
}
|
|
599
603
|
get maxInputTemplate() {
|
|
600
|
-
return html `
|
|
601
|
-
<input
|
|
602
|
-
id="date-max"
|
|
603
|
-
placeholder="${this.dateFormat}"
|
|
604
|
-
type="text"
|
|
605
|
-
@focus="${this.handleInputFocus}"
|
|
606
|
-
@blur="${this.handleMaxDateInput}"
|
|
607
|
-
@keyup="${this.handleKeyUp}"
|
|
608
|
-
.value="${live(this.maxSelectedDate)}"
|
|
609
|
-
?disabled="${this.disabled}"
|
|
610
|
-
/>
|
|
604
|
+
return html `
|
|
605
|
+
<input
|
|
606
|
+
id="date-max"
|
|
607
|
+
placeholder="${this.dateFormat}"
|
|
608
|
+
type="text"
|
|
609
|
+
@focus="${this.handleInputFocus}"
|
|
610
|
+
@blur="${this.handleMaxDateInput}"
|
|
611
|
+
@keyup="${this.handleKeyUp}"
|
|
612
|
+
.value="${live(this.maxSelectedDate)}"
|
|
613
|
+
?disabled="${this.disabled}"
|
|
614
|
+
/>
|
|
611
615
|
`;
|
|
612
616
|
}
|
|
613
617
|
get minLabelTemplate() {
|
|
@@ -617,184 +621,184 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
617
621
|
return html `<label for="date-max" class="sr-only">Maximum date:</label>`;
|
|
618
622
|
}
|
|
619
623
|
get tooltipTemplate() {
|
|
620
|
-
return html `
|
|
621
|
-
<style>
|
|
622
|
-
#tooltip {
|
|
623
|
-
width: ${this.tooltipWidth}px;
|
|
624
|
-
height: ${this.tooltipHeight}px;
|
|
625
|
-
top: ${-9 - this.tooltipHeight}px;
|
|
626
|
-
left: ${this._tooltipOffset}px;
|
|
627
|
-
display: ${this._tooltipVisible ? 'block' : 'none'};
|
|
628
|
-
}
|
|
629
|
-
#tooltip:after {
|
|
630
|
-
left: ${this.tooltipWidth / 2}px;
|
|
631
|
-
}
|
|
632
|
-
</style>
|
|
633
|
-
<div id="tooltip">${this._tooltipContent}</div>
|
|
624
|
+
return html `
|
|
625
|
+
<style>
|
|
626
|
+
#tooltip {
|
|
627
|
+
width: ${this.tooltipWidth}px;
|
|
628
|
+
height: ${this.tooltipHeight}px;
|
|
629
|
+
top: ${-9 - this.tooltipHeight}px;
|
|
630
|
+
left: ${this._tooltipOffset}px;
|
|
631
|
+
display: ${this._tooltipVisible ? 'block' : 'none'};
|
|
632
|
+
}
|
|
633
|
+
#tooltip:after {
|
|
634
|
+
left: ${this.tooltipWidth / 2}px;
|
|
635
|
+
}
|
|
636
|
+
</style>
|
|
637
|
+
<div id="tooltip">${this._tooltipContent}</div>
|
|
634
638
|
`;
|
|
635
639
|
}
|
|
636
640
|
get noDataTemplate() {
|
|
637
|
-
return html `
|
|
638
|
-
<div class="missing-data-message">${this.missingDataMessage}</div>
|
|
641
|
+
return html `
|
|
642
|
+
<div class="missing-data-message">${this.missingDataMessage}</div>
|
|
639
643
|
`;
|
|
640
644
|
}
|
|
641
645
|
get activityIndicatorTemplate() {
|
|
642
646
|
if (!this.loading) {
|
|
643
647
|
return nothing;
|
|
644
648
|
}
|
|
645
|
-
return html `
|
|
646
|
-
<ia-activity-indicator mode="processing"> </ia-activity-indicator>
|
|
649
|
+
return html `
|
|
650
|
+
<ia-activity-indicator mode="processing"> </ia-activity-indicator>
|
|
647
651
|
`;
|
|
648
652
|
}
|
|
649
653
|
render() {
|
|
650
654
|
if (!this.hasBinData) {
|
|
651
655
|
return this.noDataTemplate;
|
|
652
656
|
}
|
|
653
|
-
return html `
|
|
654
|
-
<div
|
|
655
|
-
id="container"
|
|
656
|
-
class="
|
|
657
|
-
noselect
|
|
658
|
-
${this._isDragging ? 'dragging' : ''}
|
|
659
|
-
"
|
|
660
|
-
style="width: ${this.width}px"
|
|
661
|
-
>
|
|
662
|
-
${this.activityIndicatorTemplate} ${this.tooltipTemplate}
|
|
663
|
-
<div
|
|
664
|
-
class="inner-container
|
|
665
|
-
${this.disabled ? 'disabled' : ''}"
|
|
666
|
-
>
|
|
667
|
-
<svg
|
|
668
|
-
width="${this.width}"
|
|
669
|
-
height="${this.height}"
|
|
670
|
-
@pointerleave="${this.drop}"
|
|
671
|
-
>
|
|
672
|
-
${this.selectedRangeTemplate}
|
|
673
|
-
<svg id="histogram">${this.histogramTemplate}</svg>
|
|
674
|
-
${this.minSliderTemplate} ${this.maxSliderTemplate}
|
|
675
|
-
</svg>
|
|
676
|
-
<div id="inputs">
|
|
677
|
-
${this.minLabelTemplate} ${this.minInputTemplate}
|
|
678
|
-
<div class="dash">-</div>
|
|
679
|
-
${this.maxLabelTemplate} ${this.maxInputTemplate}
|
|
680
|
-
<slot name="inputs-right-side"></slot>
|
|
681
|
-
</div>
|
|
682
|
-
</div>
|
|
683
|
-
</div>
|
|
657
|
+
return html `
|
|
658
|
+
<div
|
|
659
|
+
id="container"
|
|
660
|
+
class="
|
|
661
|
+
noselect
|
|
662
|
+
${this._isDragging ? 'dragging' : ''}
|
|
663
|
+
"
|
|
664
|
+
style="width: ${this.width}px"
|
|
665
|
+
>
|
|
666
|
+
${this.activityIndicatorTemplate} ${this.tooltipTemplate}
|
|
667
|
+
<div
|
|
668
|
+
class="inner-container
|
|
669
|
+
${this.disabled ? 'disabled' : ''}"
|
|
670
|
+
>
|
|
671
|
+
<svg
|
|
672
|
+
width="${this.width}"
|
|
673
|
+
height="${this.height}"
|
|
674
|
+
@pointerleave="${this.drop}"
|
|
675
|
+
>
|
|
676
|
+
${this.selectedRangeTemplate}
|
|
677
|
+
<svg id="histogram">${this.histogramTemplate}</svg>
|
|
678
|
+
${this.minSliderTemplate} ${this.maxSliderTemplate}
|
|
679
|
+
</svg>
|
|
680
|
+
<div id="inputs">
|
|
681
|
+
${this.minLabelTemplate} ${this.minInputTemplate}
|
|
682
|
+
<div class="dash">-</div>
|
|
683
|
+
${this.maxLabelTemplate} ${this.maxInputTemplate}
|
|
684
|
+
<slot name="inputs-right-side"></slot>
|
|
685
|
+
</div>
|
|
686
|
+
</div>
|
|
687
|
+
</div>
|
|
684
688
|
`;
|
|
685
689
|
}
|
|
686
690
|
};
|
|
687
|
-
HistogramDateRange.styles = css `
|
|
688
|
-
.missing-data-message {
|
|
689
|
-
text-align: center;
|
|
690
|
-
}
|
|
691
|
-
#container {
|
|
692
|
-
margin: 0;
|
|
693
|
-
touch-action: none;
|
|
694
|
-
position: relative;
|
|
695
|
-
}
|
|
696
|
-
.disabled {
|
|
697
|
-
opacity: 0.3;
|
|
698
|
-
}
|
|
699
|
-
ia-activity-indicator {
|
|
700
|
-
position: absolute;
|
|
701
|
-
left: calc(50% - 10px);
|
|
702
|
-
top: 10px;
|
|
703
|
-
width: 20px;
|
|
704
|
-
height: 20px;
|
|
705
|
-
--activityIndicatorLoadingDotColor: rgba(0, 0, 0, 0);
|
|
706
|
-
--activityIndicatorLoadingRingColor: ${activityIndicatorColor};
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
/* prevent selection from interfering with tooltip, especially on mobile */
|
|
710
|
-
/* https://stackoverflow.com/a/4407335/1163042 */
|
|
711
|
-
.noselect {
|
|
712
|
-
-webkit-touch-callout: none; /* iOS Safari */
|
|
713
|
-
-webkit-user-select: none; /* Safari */
|
|
714
|
-
-moz-user-select: none; /* Old versions of Firefox */
|
|
715
|
-
-ms-user-select: none; /* Internet Explorer/Edge */
|
|
716
|
-
user-select: none; /* current Chrome, Edge, Opera and Firefox */
|
|
717
|
-
}
|
|
718
|
-
.bar {
|
|
719
|
-
/* create a transparent border around the hist bars to prevent "gaps" and
|
|
720
|
-
flickering when moving around between bars. this also helps with handling
|
|
721
|
-
clicks on the bars, preventing users from being able to click in between
|
|
722
|
-
bars */
|
|
723
|
-
stroke: rgba(0, 0, 0, 0);
|
|
724
|
-
/* ensure transparent stroke wide enough to cover gap between bars */
|
|
725
|
-
stroke-width: 2px;
|
|
726
|
-
}
|
|
727
|
-
.bar:hover {
|
|
728
|
-
/* highlight currently hovered bar */
|
|
729
|
-
fill-opacity: 0.7;
|
|
730
|
-
}
|
|
731
|
-
.disabled .bar:hover {
|
|
732
|
-
/* ensure no visual hover interaction when disabled */
|
|
733
|
-
fill-opacity: 1;
|
|
734
|
-
}
|
|
735
|
-
/****** histogram ********/
|
|
736
|
-
#tooltip {
|
|
737
|
-
position: absolute;
|
|
738
|
-
background: ${tooltipBackgroundColor};
|
|
739
|
-
color: ${tooltipTextColor};
|
|
740
|
-
text-align: center;
|
|
741
|
-
border-radius: 3px;
|
|
742
|
-
padding: 2px;
|
|
743
|
-
font-size: ${tooltipFontSize};
|
|
744
|
-
font-family: ${tooltipFontFamily};
|
|
745
|
-
touch-action: none;
|
|
746
|
-
pointer-events: none;
|
|
747
|
-
}
|
|
748
|
-
#tooltip:after {
|
|
749
|
-
content: '';
|
|
750
|
-
position: absolute;
|
|
751
|
-
margin-left: -5px;
|
|
752
|
-
top: 100%;
|
|
753
|
-
/* arrow */
|
|
754
|
-
border: 5px solid ${tooltipTextColor};
|
|
755
|
-
border-color: ${tooltipBackgroundColor} transparent transparent
|
|
756
|
-
transparent;
|
|
757
|
-
}
|
|
758
|
-
/****** slider ********/
|
|
759
|
-
.draggable:hover {
|
|
760
|
-
cursor: grab;
|
|
761
|
-
}
|
|
762
|
-
.dragging {
|
|
763
|
-
cursor: grabbing !important;
|
|
764
|
-
}
|
|
765
|
-
/****** inputs ********/
|
|
766
|
-
#inputs {
|
|
767
|
-
display: flex;
|
|
768
|
-
justify-content: center;
|
|
769
|
-
margin: ${inputRowMargin};
|
|
770
|
-
}
|
|
771
|
-
#inputs .dash {
|
|
772
|
-
position: relative;
|
|
773
|
-
bottom: -1px;
|
|
774
|
-
align-self: center; /* Otherwise the dash sticks to the top while the inputs grow */
|
|
775
|
-
}
|
|
776
|
-
input {
|
|
777
|
-
width: ${inputWidth};
|
|
778
|
-
margin: 0 3px;
|
|
779
|
-
border: ${inputBorder};
|
|
780
|
-
border-radius: 2px !important;
|
|
781
|
-
text-align: center;
|
|
782
|
-
font-size: ${inputFontSize};
|
|
783
|
-
font-family: ${inputFontFamily};
|
|
784
|
-
}
|
|
785
|
-
.sr-only {
|
|
786
|
-
position: absolute !important;
|
|
787
|
-
width: 1px !important;
|
|
788
|
-
height: 1px !important;
|
|
789
|
-
margin: 0 !important;
|
|
790
|
-
padding: 0 !important;
|
|
791
|
-
border: 0 !important;
|
|
792
|
-
overflow: hidden !important;
|
|
793
|
-
white-space: nowrap !important;
|
|
794
|
-
clip: rect(1px, 1px, 1px, 1px) !important;
|
|
795
|
-
-webkit-clip-path: inset(50%) !important;
|
|
796
|
-
clip-path: inset(50%) !important;
|
|
797
|
-
}
|
|
691
|
+
HistogramDateRange.styles = css `
|
|
692
|
+
.missing-data-message {
|
|
693
|
+
text-align: center;
|
|
694
|
+
}
|
|
695
|
+
#container {
|
|
696
|
+
margin: 0;
|
|
697
|
+
touch-action: none;
|
|
698
|
+
position: relative;
|
|
699
|
+
}
|
|
700
|
+
.disabled {
|
|
701
|
+
opacity: 0.3;
|
|
702
|
+
}
|
|
703
|
+
ia-activity-indicator {
|
|
704
|
+
position: absolute;
|
|
705
|
+
left: calc(50% - 10px);
|
|
706
|
+
top: 10px;
|
|
707
|
+
width: 20px;
|
|
708
|
+
height: 20px;
|
|
709
|
+
--activityIndicatorLoadingDotColor: rgba(0, 0, 0, 0);
|
|
710
|
+
--activityIndicatorLoadingRingColor: ${activityIndicatorColor};
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
/* prevent selection from interfering with tooltip, especially on mobile */
|
|
714
|
+
/* https://stackoverflow.com/a/4407335/1163042 */
|
|
715
|
+
.noselect {
|
|
716
|
+
-webkit-touch-callout: none; /* iOS Safari */
|
|
717
|
+
-webkit-user-select: none; /* Safari */
|
|
718
|
+
-moz-user-select: none; /* Old versions of Firefox */
|
|
719
|
+
-ms-user-select: none; /* Internet Explorer/Edge */
|
|
720
|
+
user-select: none; /* current Chrome, Edge, Opera and Firefox */
|
|
721
|
+
}
|
|
722
|
+
.bar {
|
|
723
|
+
/* create a transparent border around the hist bars to prevent "gaps" and
|
|
724
|
+
flickering when moving around between bars. this also helps with handling
|
|
725
|
+
clicks on the bars, preventing users from being able to click in between
|
|
726
|
+
bars */
|
|
727
|
+
stroke: rgba(0, 0, 0, 0);
|
|
728
|
+
/* ensure transparent stroke wide enough to cover gap between bars */
|
|
729
|
+
stroke-width: 2px;
|
|
730
|
+
}
|
|
731
|
+
.bar:hover {
|
|
732
|
+
/* highlight currently hovered bar */
|
|
733
|
+
fill-opacity: 0.7;
|
|
734
|
+
}
|
|
735
|
+
.disabled .bar:hover {
|
|
736
|
+
/* ensure no visual hover interaction when disabled */
|
|
737
|
+
fill-opacity: 1;
|
|
738
|
+
}
|
|
739
|
+
/****** histogram ********/
|
|
740
|
+
#tooltip {
|
|
741
|
+
position: absolute;
|
|
742
|
+
background: ${tooltipBackgroundColor};
|
|
743
|
+
color: ${tooltipTextColor};
|
|
744
|
+
text-align: center;
|
|
745
|
+
border-radius: 3px;
|
|
746
|
+
padding: 2px;
|
|
747
|
+
font-size: ${tooltipFontSize};
|
|
748
|
+
font-family: ${tooltipFontFamily};
|
|
749
|
+
touch-action: none;
|
|
750
|
+
pointer-events: none;
|
|
751
|
+
}
|
|
752
|
+
#tooltip:after {
|
|
753
|
+
content: '';
|
|
754
|
+
position: absolute;
|
|
755
|
+
margin-left: -5px;
|
|
756
|
+
top: 100%;
|
|
757
|
+
/* arrow */
|
|
758
|
+
border: 5px solid ${tooltipTextColor};
|
|
759
|
+
border-color: ${tooltipBackgroundColor} transparent transparent
|
|
760
|
+
transparent;
|
|
761
|
+
}
|
|
762
|
+
/****** slider ********/
|
|
763
|
+
.draggable:hover {
|
|
764
|
+
cursor: grab;
|
|
765
|
+
}
|
|
766
|
+
.dragging {
|
|
767
|
+
cursor: grabbing !important;
|
|
768
|
+
}
|
|
769
|
+
/****** inputs ********/
|
|
770
|
+
#inputs {
|
|
771
|
+
display: flex;
|
|
772
|
+
justify-content: center;
|
|
773
|
+
margin: ${inputRowMargin};
|
|
774
|
+
}
|
|
775
|
+
#inputs .dash {
|
|
776
|
+
position: relative;
|
|
777
|
+
bottom: -1px;
|
|
778
|
+
align-self: center; /* Otherwise the dash sticks to the top while the inputs grow */
|
|
779
|
+
}
|
|
780
|
+
input {
|
|
781
|
+
width: ${inputWidth};
|
|
782
|
+
margin: 0 3px;
|
|
783
|
+
border: ${inputBorder};
|
|
784
|
+
border-radius: 2px !important;
|
|
785
|
+
text-align: center;
|
|
786
|
+
font-size: ${inputFontSize};
|
|
787
|
+
font-family: ${inputFontFamily};
|
|
788
|
+
}
|
|
789
|
+
.sr-only {
|
|
790
|
+
position: absolute !important;
|
|
791
|
+
width: 1px !important;
|
|
792
|
+
height: 1px !important;
|
|
793
|
+
margin: 0 !important;
|
|
794
|
+
padding: 0 !important;
|
|
795
|
+
border: 0 !important;
|
|
796
|
+
overflow: hidden !important;
|
|
797
|
+
white-space: nowrap !important;
|
|
798
|
+
clip: rect(1px, 1px, 1px, 1px) !important;
|
|
799
|
+
-webkit-clip-path: inset(50%) !important;
|
|
800
|
+
clip-path: inset(50%) !important;
|
|
801
|
+
}
|
|
798
802
|
`;
|
|
799
803
|
__decorate([
|
|
800
804
|
property({ type: Number })
|