@internetarchive/histogram-date-range 1.2.1-alpha.1 → 1.2.2-alpha-webdev7377.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/.editorconfig +29 -29
- package/.eslintrc.js +14 -14
- package/.github/workflows/ci.yml +30 -26
- package/LICENSE +661 -661
- package/README.md +113 -113
- package/demo/index.css +22 -22
- package/demo/index.html +159 -159
- package/dist/demo/js/app-root.d.ts +19 -19
- package/dist/demo/js/app-root.js +46 -46
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/src/histogram-date-range.d.ts +166 -159
- package/dist/src/histogram-date-range.js +856 -846
- package/dist/src/histogram-date-range.js.map +1 -1
- package/dist/test/histogram-date-range.test.d.ts +1 -1
- package/dist/test/histogram-date-range.test.js +488 -488
- package/dist/test/histogram-date-range.test.js.map +1 -1
- package/docs/demo/index.css +22 -22
- package/docs/demo/index.html +159 -159
- package/docs/dist/src/histogram-date-range.js +17 -12
- package/index.ts +1 -1
- package/package.json +85 -85
- package/snowpack.config.js +10 -10
- package/src/histogram-date-range.ts +923 -915
- package/test/histogram-date-range.test.ts +684 -684
- package/tsconfig.json +21 -21
- package/web-dev-server.config.mjs +28 -28
- package/web-test-runner.config.mjs +29 -29
- package/dist/demo/app-root.d.ts +0 -19
- package/dist/demo/app-root.js +0 -58
- package/dist/demo/app-root.js.map +0 -1
- package/dist/docs/_snowpack/pkg/@internetarchive/ia-activity-indicator/ia-activity-indicator.d.ts +0 -1
- package/dist/docs/_snowpack/pkg/@internetarchive/ia-activity-indicator/ia-activity-indicator.js +0 -2
- package/dist/docs/_snowpack/pkg/@internetarchive/ia-activity-indicator/ia-activity-indicator.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,113 +1,113 @@
|
|
|
1
|
-
# \<histogram-date-range>
|
|
2
|
-
|
|
3
|
-
Check out the [interactive demo](https://internetarchive.github.io/iaux-histogram-date-range/demo/).
|
|
4
|
-
|
|
5
|
-
This webcomponent follows the [open-wc](https://github.com/open-wc/open-wc) recommendation.
|
|
6
|
-
|
|
7
|
-
Travis:
|
|
8
|
-
[](https://travis-ci.com/internetarchive/iaux-histogram-date-range)
|
|
9
|
-
CodeCov: [](https://codecov.io/gh/internetarchive/iaux-histogram-date-range)
|
|
10
|
-
|
|
11
|
-
## Installation
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
npm i @internetarchive/histogram-date-range
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Usage
|
|
18
|
-
|
|
19
|
-
```html
|
|
20
|
-
<script type="module">
|
|
21
|
-
import 'histogram-date-range/dist/src/histogram-date-range.js';
|
|
22
|
-
</script>
|
|
23
|
-
<histogram-date-range
|
|
24
|
-
width="300"
|
|
25
|
-
height="50"
|
|
26
|
-
tooltipWidth="140"
|
|
27
|
-
dateFormat="DD MMM YYYY"
|
|
28
|
-
style="
|
|
29
|
-
--histogramDateRangeTooltipFontSize: 1rem;
|
|
30
|
-
--histogramDateRangeInputWidth: 85px;
|
|
31
|
-
"
|
|
32
|
-
minDate="1400"
|
|
33
|
-
maxDate="2021"
|
|
34
|
-
minSelectedDate="1800"
|
|
35
|
-
maxSelectedDate="1900"
|
|
36
|
-
bins="[ 74, 67, 17, 66, 49, 93, 47, 61, 32, 46, 53, 2,
|
|
37
|
-
13, 45, 28, 1, 8, 70, 37, 74, 67, 17, 66, 49, 93,
|
|
38
|
-
47, 61, 70, 37, 74, 67, 17, 66, 49, 93, 47, 61, 32,
|
|
39
|
-
32, 70, 37, 74, 67, 17, 66, 49, 93, 47, 61, 32
|
|
40
|
-
]"
|
|
41
|
-
></histogram-date-range>
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
A slot named `inputs-right-side` is available for inserting elements to the right
|
|
45
|
-
of the min/max date input fields, e.g.:
|
|
46
|
-
|
|
47
|
-
```html
|
|
48
|
-
<histogram-date-range>
|
|
49
|
-
<button slot="inputs-right-side">Apply</button>
|
|
50
|
-
</histogram-date-range>
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
## Linting with ESLint, Prettier, and Types
|
|
54
|
-
|
|
55
|
-
To scan the project for linting errors, run
|
|
56
|
-
|
|
57
|
-
```bash
|
|
58
|
-
npm run lint
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
You can lint with ESLint and Prettier individually as well
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
npm run lint:eslint
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
npm run lint:prettier
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
To automatically fix many linting errors, run
|
|
72
|
-
|
|
73
|
-
```bash
|
|
74
|
-
npm run format
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
You can format using ESLint and Prettier individually as well
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
npm run format:eslint
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
npm run format:prettier
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
## Testing with Web Test Runner
|
|
88
|
-
|
|
89
|
-
To run the suite of Web Test Runner tests, run
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
npm run test
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
To run the tests in watch mode (for <abbr title="test driven development">TDD</abbr>, for example), run
|
|
96
|
-
|
|
97
|
-
```bash
|
|
98
|
-
npm run test:watch
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
## Tooling configs
|
|
102
|
-
|
|
103
|
-
For most of the tools, the configuration is in the `package.json` to reduce the amount of files in your project.
|
|
104
|
-
|
|
105
|
-
If you customize the configuration a lot, you can consider moving them to individual files.
|
|
106
|
-
|
|
107
|
-
## Local Demo with `web-dev-server`
|
|
108
|
-
|
|
109
|
-
```bash
|
|
110
|
-
npm start
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
To run a local development server that serves the basic demo located in `demo/index.html`
|
|
1
|
+
# \<histogram-date-range>
|
|
2
|
+
|
|
3
|
+
Check out the [interactive demo](https://internetarchive.github.io/iaux-histogram-date-range/demo/).
|
|
4
|
+
|
|
5
|
+
This webcomponent follows the [open-wc](https://github.com/open-wc/open-wc) recommendation.
|
|
6
|
+
|
|
7
|
+
Travis:
|
|
8
|
+
[](https://travis-ci.com/internetarchive/iaux-histogram-date-range)
|
|
9
|
+
CodeCov: [](https://codecov.io/gh/internetarchive/iaux-histogram-date-range)
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm i @internetarchive/histogram-date-range
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```html
|
|
20
|
+
<script type="module">
|
|
21
|
+
import 'histogram-date-range/dist/src/histogram-date-range.js';
|
|
22
|
+
</script>
|
|
23
|
+
<histogram-date-range
|
|
24
|
+
width="300"
|
|
25
|
+
height="50"
|
|
26
|
+
tooltipWidth="140"
|
|
27
|
+
dateFormat="DD MMM YYYY"
|
|
28
|
+
style="
|
|
29
|
+
--histogramDateRangeTooltipFontSize: 1rem;
|
|
30
|
+
--histogramDateRangeInputWidth: 85px;
|
|
31
|
+
"
|
|
32
|
+
minDate="1400"
|
|
33
|
+
maxDate="2021"
|
|
34
|
+
minSelectedDate="1800"
|
|
35
|
+
maxSelectedDate="1900"
|
|
36
|
+
bins="[ 74, 67, 17, 66, 49, 93, 47, 61, 32, 46, 53, 2,
|
|
37
|
+
13, 45, 28, 1, 8, 70, 37, 74, 67, 17, 66, 49, 93,
|
|
38
|
+
47, 61, 70, 37, 74, 67, 17, 66, 49, 93, 47, 61, 32,
|
|
39
|
+
32, 70, 37, 74, 67, 17, 66, 49, 93, 47, 61, 32
|
|
40
|
+
]"
|
|
41
|
+
></histogram-date-range>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
A slot named `inputs-right-side` is available for inserting elements to the right
|
|
45
|
+
of the min/max date input fields, e.g.:
|
|
46
|
+
|
|
47
|
+
```html
|
|
48
|
+
<histogram-date-range>
|
|
49
|
+
<button slot="inputs-right-side">Apply</button>
|
|
50
|
+
</histogram-date-range>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Linting with ESLint, Prettier, and Types
|
|
54
|
+
|
|
55
|
+
To scan the project for linting errors, run
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npm run lint
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
You can lint with ESLint and Prettier individually as well
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
npm run lint:eslint
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
npm run lint:prettier
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
To automatically fix many linting errors, run
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
npm run format
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
You can format using ESLint and Prettier individually as well
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
npm run format:eslint
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
npm run format:prettier
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Testing with Web Test Runner
|
|
88
|
+
|
|
89
|
+
To run the suite of Web Test Runner tests, run
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
npm run test
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
To run the tests in watch mode (for <abbr title="test driven development">TDD</abbr>, for example), run
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
npm run test:watch
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Tooling configs
|
|
102
|
+
|
|
103
|
+
For most of the tools, the configuration is in the `package.json` to reduce the amount of files in your project.
|
|
104
|
+
|
|
105
|
+
If you customize the configuration a lot, you can consider moving them to individual files.
|
|
106
|
+
|
|
107
|
+
## Local Demo with `web-dev-server`
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
npm start
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
To run a local development server that serves the basic demo located in `demo/index.html`
|
package/demo/index.css
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
html {
|
|
2
|
-
font-size: 10px;
|
|
3
|
-
font-family: sans-serif;
|
|
4
|
-
}
|
|
5
|
-
body {
|
|
6
|
-
background: white;
|
|
7
|
-
}
|
|
8
|
-
.container {
|
|
9
|
-
margin-top: 20px;
|
|
10
|
-
display: grid;
|
|
11
|
-
justify-content: center;
|
|
12
|
-
}
|
|
13
|
-
.description {
|
|
14
|
-
margin: 10px auto;
|
|
15
|
-
}
|
|
16
|
-
.received-events {
|
|
17
|
-
position: absolute;
|
|
18
|
-
top: 0;
|
|
19
|
-
}
|
|
20
|
-
button {
|
|
21
|
-
font-size: 100%;
|
|
22
|
-
margin: 10px auto;
|
|
1
|
+
html {
|
|
2
|
+
font-size: 10px;
|
|
3
|
+
font-family: sans-serif;
|
|
4
|
+
}
|
|
5
|
+
body {
|
|
6
|
+
background: white;
|
|
7
|
+
}
|
|
8
|
+
.container {
|
|
9
|
+
margin-top: 20px;
|
|
10
|
+
display: grid;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
}
|
|
13
|
+
.description {
|
|
14
|
+
margin: 10px auto;
|
|
15
|
+
}
|
|
16
|
+
.received-events {
|
|
17
|
+
position: absolute;
|
|
18
|
+
top: 0;
|
|
19
|
+
}
|
|
20
|
+
button {
|
|
21
|
+
font-size: 100%;
|
|
22
|
+
margin: 10px auto;
|
|
23
23
|
}
|
package/demo/index.html
CHANGED
|
@@ -1,159 +1,159 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
5
|
-
<meta charset="utf-8" />
|
|
6
|
-
<link rel="stylesheet" href="index.css">
|
|
7
|
-
</head>
|
|
8
|
-
|
|
9
|
-
<script type="module">
|
|
10
|
-
import '../dist/src/histogram-date-range.js';
|
|
11
|
-
let eventCount = 0;
|
|
12
|
-
import '../dist/demo/js/app-root.js';
|
|
13
|
-
// listen to events from the component and display the data received from them
|
|
14
|
-
document.addEventListener('histogramDateRangeUpdated', e => {
|
|
15
|
-
document.querySelector('.received-events').innerHTML =
|
|
16
|
-
++eventCount + ': ' + JSON.stringify(e.detail);
|
|
17
|
-
});
|
|
18
|
-
</script>
|
|
19
|
-
<body>
|
|
20
|
-
<pre class="received-events"></pre>
|
|
21
|
-
<div class="container">
|
|
22
|
-
<div class="description">
|
|
23
|
-
histogram inside a lit element
|
|
24
|
-
</div>
|
|
25
|
-
<app-root></app-root>
|
|
26
|
-
|
|
27
|
-
<div class="description">
|
|
28
|
-
pre-selected range with 1000ms debounce delay
|
|
29
|
-
</div>
|
|
30
|
-
<histogram-date-range
|
|
31
|
-
minDate="1400"
|
|
32
|
-
maxDate="2021"
|
|
33
|
-
updateDelay="1000"
|
|
34
|
-
minSelectedDate="1800"
|
|
35
|
-
maxSelectedDate="1900"
|
|
36
|
-
bins="[ 74, 67, 17, 66, 49, 93, 47, 61, 32, 46, 53, 2,
|
|
37
|
-
13, 45, 28, 1, 8, 70, 37, 74, 67, 17, 66, 49, 93,
|
|
38
|
-
47, 61, 70, 37, 74, 67, 17, 66, 49, 93, 47, 61, 32,
|
|
39
|
-
32, 70, 37, 74, 67, 17, 66, 49, 93, 47, 61, 32
|
|
40
|
-
]"
|
|
41
|
-
></histogram-date-range>
|
|
42
|
-
</div>
|
|
43
|
-
|
|
44
|
-
<div class="container">
|
|
45
|
-
<div class="description">range spanning negative to positive years</div>
|
|
46
|
-
<histogram-date-range
|
|
47
|
-
minDate="-1050" maxDate="2200"
|
|
48
|
-
bins="[ 74, 67, 17, 66, 49, 93, 47, 61, 32, 46, 53, 2,
|
|
49
|
-
13, 45, 28, 1, 8, 70, 37, 74, 67, 17, 66, 49, 93,
|
|
50
|
-
47, 61, 70, 37, 74, 67, 17, 66, 49, 93, 47, 61, 32,
|
|
51
|
-
32, 70, 37, 74, 67, 17, 66, 49, 93, 47, 61, 32
|
|
52
|
-
]"
|
|
53
|
-
></histogram-date-range>
|
|
54
|
-
</div>
|
|
55
|
-
|
|
56
|
-
<div class="container">
|
|
57
|
-
<div class="description">
|
|
58
|
-
small diff between max and min values
|
|
59
|
-
</div>
|
|
60
|
-
<histogram-date-range
|
|
61
|
-
width="175"
|
|
62
|
-
tooltipwidth="120"
|
|
63
|
-
dateFormat="YYYY"
|
|
64
|
-
updateDelay="1000"
|
|
65
|
-
missingDataMessage="..."
|
|
66
|
-
minSelectedDate="1987"
|
|
67
|
-
maxSelectedDate="2016"
|
|
68
|
-
minDate="1987"
|
|
69
|
-
maxDate="2016"
|
|
70
|
-
bins="[1519,1643,1880,2046,1973,2085,2148,2152,2349,2304,2314,2484,2590,2450,2495,2475,2392,2631,2504,2619,2519,2552,2462,2217,2171,2132,2127,2041,1638,1441]"
|
|
71
|
-
>
|
|
72
|
-
</histogram-date-range>
|
|
73
|
-
</div>
|
|
74
|
-
|
|
75
|
-
<div class="container">
|
|
76
|
-
<div class="description">small year range and few bins</div>
|
|
77
|
-
<histogram-date-range width="175" tooltipwidth="120"
|
|
78
|
-
minDate="2008" maxDate="2016" bins="[76104,866978,1151617,986331,218672,107410,3324]">
|
|
79
|
-
</histogram-date-range>
|
|
80
|
-
</div>
|
|
81
|
-
|
|
82
|
-
<div class="container">
|
|
83
|
-
<div class="description">
|
|
84
|
-
default range with custom styling and date format
|
|
85
|
-
</div>
|
|
86
|
-
<histogram-date-range
|
|
87
|
-
width="300"
|
|
88
|
-
height="50"
|
|
89
|
-
tooltipWidth="140"
|
|
90
|
-
dateFormat="DD MMM YYYY"
|
|
91
|
-
style="
|
|
92
|
-
--histogramDateRangeSliderColor: #d8b384;
|
|
93
|
-
--histogramDateRangeSelectedRangeColor: #f3f0d7;
|
|
94
|
-
--histogramDateRangeTooltipFontFamily: serif;
|
|
95
|
-
--histogramDateRangeInputFontFamily: serif;
|
|
96
|
-
--histogramDateRangeTooltipFontSize: 1rem;
|
|
97
|
-
--histogramDateRangeInputWidth: 85px;
|
|
98
|
-
"
|
|
99
|
-
minDate="05 May 1972"
|
|
100
|
-
maxDate="21 Dec 1980"
|
|
101
|
-
bins="[ 85, 25, 200, 0, 0, 34, 0, 2, 5, 10, 0, 56, 10, 45, 100, 70, 50 ]"
|
|
102
|
-
></histogram-date-range>
|
|
103
|
-
</div>
|
|
104
|
-
|
|
105
|
-
<div class="container">
|
|
106
|
-
<div class="description">loading state toggle</div>
|
|
107
|
-
<histogram-date-range
|
|
108
|
-
id="loading"
|
|
109
|
-
minDate="1900"
|
|
110
|
-
maxDate="2021"
|
|
111
|
-
bins="[
|
|
112
|
-
74, 67, 17, 66, 49, 93, 47, 61, 32, 46, 53, 2, 13, 45, 67, 17, 66,
|
|
113
|
-
49, 93, 47, 61, 32, 32, 70, 37, 74, 67, 17, 66, 49, 93, 47, 61, 32
|
|
114
|
-
]"
|
|
115
|
-
></histogram-date-range>
|
|
116
|
-
<button id="loading-toggle">toggle loading</button>
|
|
117
|
-
</div>
|
|
118
|
-
<script>
|
|
119
|
-
document
|
|
120
|
-
.querySelector('#loading-toggle')
|
|
121
|
-
.addEventListener('click', () => {
|
|
122
|
-
const histogram = document.querySelector(
|
|
123
|
-
'histogram-date-range#loading'
|
|
124
|
-
);
|
|
125
|
-
histogram.loading = !histogram.loading;
|
|
126
|
-
});
|
|
127
|
-
</script>
|
|
128
|
-
|
|
129
|
-
<div class="container">
|
|
130
|
-
<div class="description">data set up with js</div>
|
|
131
|
-
<histogram-date-range id="js-setup"></histogram-date-range>
|
|
132
|
-
</div>
|
|
133
|
-
<script>
|
|
134
|
-
document.addEventListener('DOMContentLoaded', function () {
|
|
135
|
-
const histogram = document.querySelector(
|
|
136
|
-
'histogram-date-range#js-setup'
|
|
137
|
-
);
|
|
138
|
-
histogram.minDate = '1950';
|
|
139
|
-
histogram.maxDate = '2000';
|
|
140
|
-
// generate array of [0, 1, 2, ... 49]
|
|
141
|
-
histogram.bins = [...Array(50).keys()];
|
|
142
|
-
});
|
|
143
|
-
</script>
|
|
144
|
-
|
|
145
|
-
<div class="container">
|
|
146
|
-
<div class="description">
|
|
147
|
-
single bin
|
|
148
|
-
</div>
|
|
149
|
-
<histogram-date-range minDate="1926" maxDate="1926" bins="[8]">
|
|
150
|
-
</histogram-date-range>
|
|
151
|
-
</div>
|
|
152
|
-
|
|
153
|
-
<div class="container">
|
|
154
|
-
<div class="description">empty data</div>
|
|
155
|
-
<histogram-date-range missingDataMessage="no data..."></histoghistogram-date-range>
|
|
156
|
-
</div>
|
|
157
|
-
|
|
158
|
-
</body>
|
|
159
|
-
</html>
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
5
|
+
<meta charset="utf-8" />
|
|
6
|
+
<link rel="stylesheet" href="index.css">
|
|
7
|
+
</head>
|
|
8
|
+
|
|
9
|
+
<script type="module">
|
|
10
|
+
import '../dist/src/histogram-date-range.js';
|
|
11
|
+
let eventCount = 0;
|
|
12
|
+
import '../dist/demo/js/app-root.js';
|
|
13
|
+
// listen to events from the component and display the data received from them
|
|
14
|
+
document.addEventListener('histogramDateRangeUpdated', e => {
|
|
15
|
+
document.querySelector('.received-events').innerHTML =
|
|
16
|
+
++eventCount + ': ' + JSON.stringify(e.detail);
|
|
17
|
+
});
|
|
18
|
+
</script>
|
|
19
|
+
<body>
|
|
20
|
+
<pre class="received-events"></pre>
|
|
21
|
+
<div class="container">
|
|
22
|
+
<div class="description">
|
|
23
|
+
histogram inside a lit element
|
|
24
|
+
</div>
|
|
25
|
+
<app-root></app-root>
|
|
26
|
+
|
|
27
|
+
<div class="description">
|
|
28
|
+
pre-selected range with 1000ms debounce delay
|
|
29
|
+
</div>
|
|
30
|
+
<histogram-date-range
|
|
31
|
+
minDate="1400"
|
|
32
|
+
maxDate="2021"
|
|
33
|
+
updateDelay="1000"
|
|
34
|
+
minSelectedDate="1800"
|
|
35
|
+
maxSelectedDate="1900"
|
|
36
|
+
bins="[ 74, 67, 17, 66, 49, 93, 47, 61, 32, 46, 53, 2,
|
|
37
|
+
13, 45, 28, 1, 8, 70, 37, 74, 67, 17, 66, 49, 93,
|
|
38
|
+
47, 61, 70, 37, 74, 67, 17, 66, 49, 93, 47, 61, 32,
|
|
39
|
+
32, 70, 37, 74, 67, 17, 66, 49, 93, 47, 61, 32
|
|
40
|
+
]"
|
|
41
|
+
></histogram-date-range>
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
<div class="container">
|
|
45
|
+
<div class="description">range spanning negative to positive years</div>
|
|
46
|
+
<histogram-date-range
|
|
47
|
+
minDate="-1050" maxDate="2200"
|
|
48
|
+
bins="[ 74, 67, 17, 66, 49, 93, 47, 61, 32, 46, 53, 2,
|
|
49
|
+
13, 45, 28, 1, 8, 70, 37, 74, 67, 17, 66, 49, 93,
|
|
50
|
+
47, 61, 70, 37, 74, 67, 17, 66, 49, 93, 47, 61, 32,
|
|
51
|
+
32, 70, 37, 74, 67, 17, 66, 49, 93, 47, 61, 32
|
|
52
|
+
]"
|
|
53
|
+
></histogram-date-range>
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
<div class="container">
|
|
57
|
+
<div class="description">
|
|
58
|
+
small diff between max and min values
|
|
59
|
+
</div>
|
|
60
|
+
<histogram-date-range
|
|
61
|
+
width="175"
|
|
62
|
+
tooltipwidth="120"
|
|
63
|
+
dateFormat="YYYY"
|
|
64
|
+
updateDelay="1000"
|
|
65
|
+
missingDataMessage="..."
|
|
66
|
+
minSelectedDate="1987"
|
|
67
|
+
maxSelectedDate="2016"
|
|
68
|
+
minDate="1987"
|
|
69
|
+
maxDate="2016"
|
|
70
|
+
bins="[1519,1643,1880,2046,1973,2085,2148,2152,2349,2304,2314,2484,2590,2450,2495,2475,2392,2631,2504,2619,2519,2552,2462,2217,2171,2132,2127,2041,1638,1441]"
|
|
71
|
+
>
|
|
72
|
+
</histogram-date-range>
|
|
73
|
+
</div>
|
|
74
|
+
|
|
75
|
+
<div class="container">
|
|
76
|
+
<div class="description">small year range and few bins</div>
|
|
77
|
+
<histogram-date-range width="175" tooltipwidth="120"
|
|
78
|
+
minDate="2008" maxDate="2016" bins="[76104,866978,1151617,986331,218672,107410,3324]">
|
|
79
|
+
</histogram-date-range>
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
<div class="container">
|
|
83
|
+
<div class="description">
|
|
84
|
+
default range with custom styling and date format
|
|
85
|
+
</div>
|
|
86
|
+
<histogram-date-range
|
|
87
|
+
width="300"
|
|
88
|
+
height="50"
|
|
89
|
+
tooltipWidth="140"
|
|
90
|
+
dateFormat="DD MMM YYYY"
|
|
91
|
+
style="
|
|
92
|
+
--histogramDateRangeSliderColor: #d8b384;
|
|
93
|
+
--histogramDateRangeSelectedRangeColor: #f3f0d7;
|
|
94
|
+
--histogramDateRangeTooltipFontFamily: serif;
|
|
95
|
+
--histogramDateRangeInputFontFamily: serif;
|
|
96
|
+
--histogramDateRangeTooltipFontSize: 1rem;
|
|
97
|
+
--histogramDateRangeInputWidth: 85px;
|
|
98
|
+
"
|
|
99
|
+
minDate="05 May 1972"
|
|
100
|
+
maxDate="21 Dec 1980"
|
|
101
|
+
bins="[ 85, 25, 200, 0, 0, 34, 0, 2, 5, 10, 0, 56, 10, 45, 100, 70, 50 ]"
|
|
102
|
+
></histogram-date-range>
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
<div class="container">
|
|
106
|
+
<div class="description">loading state toggle</div>
|
|
107
|
+
<histogram-date-range
|
|
108
|
+
id="loading"
|
|
109
|
+
minDate="1900"
|
|
110
|
+
maxDate="2021"
|
|
111
|
+
bins="[
|
|
112
|
+
74, 67, 17, 66, 49, 93, 47, 61, 32, 46, 53, 2, 13, 45, 67, 17, 66,
|
|
113
|
+
49, 93, 47, 61, 32, 32, 70, 37, 74, 67, 17, 66, 49, 93, 47, 61, 32
|
|
114
|
+
]"
|
|
115
|
+
></histogram-date-range>
|
|
116
|
+
<button id="loading-toggle">toggle loading</button>
|
|
117
|
+
</div>
|
|
118
|
+
<script>
|
|
119
|
+
document
|
|
120
|
+
.querySelector('#loading-toggle')
|
|
121
|
+
.addEventListener('click', () => {
|
|
122
|
+
const histogram = document.querySelector(
|
|
123
|
+
'histogram-date-range#loading'
|
|
124
|
+
);
|
|
125
|
+
histogram.loading = !histogram.loading;
|
|
126
|
+
});
|
|
127
|
+
</script>
|
|
128
|
+
|
|
129
|
+
<div class="container">
|
|
130
|
+
<div class="description">data set up with js</div>
|
|
131
|
+
<histogram-date-range id="js-setup"></histogram-date-range>
|
|
132
|
+
</div>
|
|
133
|
+
<script>
|
|
134
|
+
document.addEventListener('DOMContentLoaded', function () {
|
|
135
|
+
const histogram = document.querySelector(
|
|
136
|
+
'histogram-date-range#js-setup'
|
|
137
|
+
);
|
|
138
|
+
histogram.minDate = '1950';
|
|
139
|
+
histogram.maxDate = '2000';
|
|
140
|
+
// generate array of [0, 1, 2, ... 49]
|
|
141
|
+
histogram.bins = [...Array(50).keys()];
|
|
142
|
+
});
|
|
143
|
+
</script>
|
|
144
|
+
|
|
145
|
+
<div class="container">
|
|
146
|
+
<div class="description">
|
|
147
|
+
single bin
|
|
148
|
+
</div>
|
|
149
|
+
<histogram-date-range minDate="1926" maxDate="1926" bins="[8]">
|
|
150
|
+
</histogram-date-range>
|
|
151
|
+
</div>
|
|
152
|
+
|
|
153
|
+
<div class="container">
|
|
154
|
+
<div class="description">empty data</div>
|
|
155
|
+
<histogram-date-range missingDataMessage="no data..."></histoghistogram-date-range>
|
|
156
|
+
</div>
|
|
157
|
+
|
|
158
|
+
</body>
|
|
159
|
+
</html>
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { LitElement, TemplateResult } from 'lit';
|
|
2
|
-
import '../../src/histogram-date-range';
|
|
3
|
-
interface DataSource {
|
|
4
|
-
minDate: unknown;
|
|
5
|
-
maxDate: unknown;
|
|
6
|
-
minSelectedDate: unknown;
|
|
7
|
-
maxSelectedDate: unknown;
|
|
8
|
-
bins: number[];
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* This is mainly to test the histogram-date-range within
|
|
12
|
-
* a lit-element.
|
|
13
|
-
*/
|
|
14
|
-
export declare class AppRoot extends LitElement {
|
|
15
|
-
dataSource: DataSource;
|
|
16
|
-
render(): TemplateResult;
|
|
17
|
-
private randomize;
|
|
18
|
-
}
|
|
19
|
-
export {};
|
|
1
|
+
import { LitElement, TemplateResult } from 'lit';
|
|
2
|
+
import '../../src/histogram-date-range';
|
|
3
|
+
interface DataSource {
|
|
4
|
+
minDate: unknown;
|
|
5
|
+
maxDate: unknown;
|
|
6
|
+
minSelectedDate: unknown;
|
|
7
|
+
maxSelectedDate: unknown;
|
|
8
|
+
bins: number[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* This is mainly to test the histogram-date-range within
|
|
12
|
+
* a lit-element.
|
|
13
|
+
*/
|
|
14
|
+
export declare class AppRoot extends LitElement {
|
|
15
|
+
dataSource: DataSource;
|
|
16
|
+
render(): TemplateResult;
|
|
17
|
+
private randomize;
|
|
18
|
+
}
|
|
19
|
+
export {};
|