@mozaic-ds/web-components 0.7.0 → 0.9.0-beta
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/package.json +1 -1
- package/public/ClickOutside-63071e7a.js +15 -1
- package/public/ClickOutside-63071e7a.js.map +1 -1
- package/public/DataTableDefaultAction.nested-c37a5d51.js +762 -0
- package/public/DataTableDefaultAction.nested-c37a5d51.js.map +1 -0
- package/public/DataTableUtilities-313a448d.js +386 -0
- package/public/DataTableUtilities-313a448d.js.map +1 -0
- package/public/EventForward-8492ff62.js +109 -1
- package/public/EventForward-8492ff62.js.map +1 -1
- package/public/EventHandler-02058705.js +15 -1
- package/public/EventHandler-02058705.js.map +1 -1
- package/public/adeo/{DataTableDefaultAction.nested-90536fe3.js → DataTableDefaultAction.nested-ac2e3dbe.js} +2 -2
- package/public/adeo/{DataTableDefaultAction.nested-90536fe3.js.map → DataTableDefaultAction.nested-ac2e3dbe.js.map} +1 -1
- package/public/adeo/DataTableUtilities-313a448d.js +2 -0
- package/public/adeo/DataTableUtilities-313a448d.js.map +1 -0
- package/public/adeo/bundle.js +5 -0
- package/public/adeo/components/barchart/BarChart.svelte +3 -4
- package/public/adeo/components/chart/BarChart.js +1 -1
- package/public/adeo/components/chart/BarChart.js.map +1 -1
- package/public/adeo/components/datatable/DataTable.js +1 -1
- package/public/adeo/components/datatable/DataTable.js.map +1 -1
- package/public/adeo/components/datatable/DataTable.svelte +12 -0
- package/public/adeo/components/datatable/DataTableDefaultAction.nested.js +1 -1
- package/public/adeo/components/datatable/DataTableDefaultEdtion.nested.js +1 -1
- package/public/adeo/components/datatable/DataTableDefaultFilterTags.nested.js +1 -1
- package/public/adeo/components/datatable/DataTableFooter.nested.js +1 -1
- package/public/adeo/components/datatable/data.d.ts.map +1 -1
- package/public/adeo/components/datatable/datatable.types.d.ts +9 -2
- package/public/adeo/components/datatable/datatable.types.d.ts.map +1 -1
- package/public/adeo/components/header/Header.js +1 -1
- package/public/adeo/components/header/Header.js.map +1 -1
- package/public/adeo/components/header/Header.svelte +2 -2
- package/public/adeo/components/kpi/Kpi.js +2 -0
- package/public/adeo/components/kpi/Kpi.js.map +1 -0
- package/public/adeo/components/kpi/Kpi.svelte +232 -0
- package/public/adeo/components/sidebar/Sidebar.js +1 -1
- package/public/adeo/components/sidebar/Sidebar.js.map +1 -1
- package/public/adeo/components/sidebar/Sidebar.svelte +1 -1
- package/public/adeo/icons-storybook.js +16 -0
- package/public/adeo/main.d.ts +1 -0
- package/public/adeo/main.d.ts.map +1 -1
- package/public/adeo/utilities/DataTableUtilities.d.ts.map +1 -1
- package/public/adeo/utilities/DataTableUtilities.ts +22 -2
- package/public/array-5b770a93.js +13 -1
- package/public/array-5b770a93.js.map +1 -1
- package/public/axis-fbc0f7b5.js +174 -1
- package/public/axis-fbc0f7b5.js.map +1 -1
- package/public/band-d7a07d2c.js +186 -1
- package/public/band-d7a07d2c.js.map +1 -1
- package/public/bricoman/{DataTableDefaultAction.nested-928e5e2d.js → DataTableDefaultAction.nested-bcc599d1.js} +2 -2
- package/public/bricoman/{DataTableDefaultAction.nested-928e5e2d.js.map → DataTableDefaultAction.nested-bcc599d1.js.map} +1 -1
- package/public/bricoman/DataTableUtilities-313a448d.js +2 -0
- package/public/bricoman/DataTableUtilities-313a448d.js.map +1 -0
- package/public/bricoman/bundle.js +5 -0
- package/public/bricoman/components/barchart/BarChart.svelte +3 -4
- package/public/bricoman/components/chart/BarChart.js +1 -1
- package/public/bricoman/components/chart/BarChart.js.map +1 -1
- package/public/bricoman/components/datatable/DataTable.js +1 -1
- package/public/bricoman/components/datatable/DataTable.js.map +1 -1
- package/public/bricoman/components/datatable/DataTable.svelte +12 -0
- package/public/bricoman/components/datatable/DataTableDefaultAction.nested.js +1 -1
- package/public/bricoman/components/datatable/DataTableDefaultEdtion.nested.js +1 -1
- package/public/bricoman/components/datatable/DataTableDefaultFilterTags.nested.js +1 -1
- package/public/bricoman/components/datatable/DataTableFooter.nested.js +1 -1
- package/public/bricoman/components/datatable/data.d.ts.map +1 -1
- package/public/bricoman/components/datatable/datatable.types.d.ts +9 -2
- package/public/bricoman/components/datatable/datatable.types.d.ts.map +1 -1
- package/public/bricoman/components/header/Header.js +1 -1
- package/public/bricoman/components/header/Header.js.map +1 -1
- package/public/bricoman/components/header/Header.svelte +2 -2
- package/public/bricoman/components/kpi/Kpi.js +2 -0
- package/public/bricoman/components/kpi/Kpi.js.map +1 -0
- package/public/bricoman/components/kpi/Kpi.svelte +232 -0
- package/public/bricoman/components/sidebar/Sidebar.js +1 -1
- package/public/bricoman/components/sidebar/Sidebar.js.map +1 -1
- package/public/bricoman/components/sidebar/Sidebar.svelte +1 -1
- package/public/bricoman/icons-storybook.js +16 -0
- package/public/bricoman/main.d.ts +1 -0
- package/public/bricoman/main.d.ts.map +1 -1
- package/public/bricoman/utilities/DataTableUtilities.d.ts.map +1 -1
- package/public/bricoman/utilities/DataTableUtilities.ts +22 -2
- package/public/bundle.js +5 -0
- package/public/components/accordion/Accordion.js +365 -1
- package/public/components/accordion/Accordion.js.map +1 -1
- package/public/components/autocomplete/Autocomplete.js +1515 -1
- package/public/components/autocomplete/Autocomplete.js.map +1 -1
- package/public/components/badge/Badge.js +155 -1
- package/public/components/badge/Badge.js.map +1 -1
- package/public/components/badge/Badge.nested.js +101 -1
- package/public/components/badge/Badge.nested.js.map +1 -1
- package/public/components/barchart/BarChart.svelte +3 -4
- package/public/components/breadcrumb/Breadcrumb.js +372 -1
- package/public/components/breadcrumb/Breadcrumb.js.map +1 -1
- package/public/components/breadcrumb/Breadcrumb.nested.js +319 -1
- package/public/components/breadcrumb/Breadcrumb.nested.js.map +1 -1
- package/public/components/button/Button.js +1138 -1
- package/public/components/button/Button.js.map +1 -1
- package/public/components/card/Card.js +369 -1
- package/public/components/card/Card.js.map +1 -1
- package/public/components/chart/BarChart.js +583 -1
- package/public/components/chart/BarChart.js.map +1 -1
- package/public/components/chart/Donut.js +1189 -1
- package/public/components/chart/Donut.js.map +1 -1
- package/public/components/chart/GroupedBarChart.js +750 -1
- package/public/components/chart/GroupedBarChart.js.map +1 -1
- package/public/components/chart/LineChart.js +1731 -1
- package/public/components/chart/LineChart.js.map +1 -1
- package/public/components/chart/Radar.js +729 -1
- package/public/components/chart/Radar.js.map +1 -1
- package/public/components/chart/StackedBarChart.js +745 -1
- package/public/components/chart/StackedBarChart.js.map +1 -1
- package/public/components/checkbox/Checkbox.js +307 -1
- package/public/components/checkbox/Checkbox.js.map +1 -1
- package/public/components/checkboxgroup/checkboxGroup.js +404 -1
- package/public/components/checkboxgroup/checkboxGroup.js.map +1 -1
- package/public/components/datatable/DataTable.js +3098 -1
- package/public/components/datatable/DataTable.js.map +1 -1
- package/public/components/datatable/DataTable.svelte +12 -0
- package/public/components/datatable/DataTableDefaultAction.nested.js +4 -1
- package/public/components/datatable/DataTableDefaultAction.nested.js.map +1 -1
- package/public/components/datatable/DataTableDefaultEdtion.nested.js +164 -1
- package/public/components/datatable/DataTableDefaultEdtion.nested.js.map +1 -1
- package/public/components/datatable/DataTableDefaultFilterTags.nested.js +380 -1
- package/public/components/datatable/DataTableDefaultFilterTags.nested.js.map +1 -1
- package/public/components/datatable/DataTableDefaultSelection.nested.js +424 -1
- package/public/components/datatable/DataTableDefaultSelection.nested.js.map +1 -1
- package/public/components/datatable/DataTableDefaultSelectionLabel.nested.js +263 -1
- package/public/components/datatable/DataTableDefaultSelectionLabel.nested.js.map +1 -1
- package/public/components/datatable/DataTableFooter.nested.js +637 -1
- package/public/components/datatable/DataTableFooter.nested.js.map +1 -1
- package/public/components/datatable/data.d.ts.map +1 -1
- package/public/components/datatable/datatable.types.d.ts +9 -2
- package/public/components/datatable/datatable.types.d.ts.map +1 -1
- package/public/components/dropdown/Dropdown.js +1426 -1
- package/public/components/dropdown/Dropdown.js.map +1 -1
- package/public/components/field/Field.js +375 -1
- package/public/components/field/Field.js.map +1 -1
- package/public/components/fileuploader/FileUploader.js +603 -1
- package/public/components/fileuploader/FileUploader.js.map +1 -1
- package/public/components/fileuploader/ResultFile.nested.js +344 -1
- package/public/components/fileuploader/ResultFile.nested.js.map +1 -1
- package/public/components/flag/Flag.js +174 -1
- package/public/components/flag/Flag.js.map +1 -1
- package/public/components/header/Header.js +918 -1
- package/public/components/header/Header.js.map +1 -1
- package/public/components/header/Header.svelte +2 -2
- package/public/components/hero/Hero.js +271 -1
- package/public/components/hero/Hero.js.map +1 -1
- package/public/components/kpi/Kpi.js +405 -0
- package/public/components/kpi/Kpi.js.map +1 -0
- package/public/components/kpi/Kpi.svelte +232 -0
- package/public/components/layer/Layer.js +471 -1
- package/public/components/layer/Layer.js.map +1 -1
- package/public/components/link/Link.js +380 -1
- package/public/components/link/Link.js.map +1 -1
- package/public/components/listbox/Listbox.js +595 -1
- package/public/components/listbox/Listbox.js.map +1 -1
- package/public/components/listbox/Listbox.nested.js +629 -1
- package/public/components/listbox/Listbox.nested.js.map +1 -1
- package/public/components/loader/Loader.js +246 -1
- package/public/components/loader/Loader.js.map +1 -1
- package/public/components/loader/Loader.nested.js +176 -1
- package/public/components/loader/Loader.nested.js.map +1 -1
- package/public/components/modal/Modal.js +395 -1
- package/public/components/modal/Modal.js.map +1 -1
- package/public/components/notification/Notification.js +458 -1
- package/public/components/notification/Notification.js.map +1 -1
- package/public/components/optionbutton/OptionButton.js +316 -1
- package/public/components/optionbutton/OptionButton.js.map +1 -1
- package/public/components/overlay/Overlay.js +104 -1
- package/public/components/overlay/Overlay.js.map +1 -1
- package/public/components/overlay/OverlayLoader.js +151 -1
- package/public/components/overlay/OverlayLoader.js.map +1 -1
- package/public/components/pagination/Pagination.js +613 -1
- package/public/components/pagination/Pagination.js.map +1 -1
- package/public/components/passwordinput/PasswordInput.js +291 -1
- package/public/components/passwordinput/PasswordInput.js.map +1 -1
- package/public/components/phonenumber/PhoneNumber.js +6894 -1
- package/public/components/phonenumber/PhoneNumber.js.map +1 -1
- package/public/components/price/Price.js +768 -1
- package/public/components/price/Price.js.map +1 -1
- package/public/components/progressbar/ProgressBar.js +278 -1
- package/public/components/progressbar/ProgressBar.js.map +1 -1
- package/public/components/quantityselector/QuantitySelector.js +397 -1
- package/public/components/quantityselector/QuantitySelector.js.map +1 -1
- package/public/components/radio/Radio.js +273 -1
- package/public/components/radio/Radio.js.map +1 -1
- package/public/components/radiogroup/RadioGroup.js +414 -1
- package/public/components/radiogroup/RadioGroup.js.map +1 -1
- package/public/components/ratings/StarsInput.js +292 -1
- package/public/components/ratings/StarsInput.js.map +1 -1
- package/public/components/ratings/StarsResult.js +246 -1
- package/public/components/ratings/StarsResult.js.map +1 -1
- package/public/components/select/Select.js +451 -1
- package/public/components/select/Select.js.map +1 -1
- package/public/components/sidebar/Sidebar.js +784 -1
- package/public/components/sidebar/Sidebar.js.map +1 -1
- package/public/components/sidebar/Sidebar.svelte +1 -1
- package/public/components/sidebar/sidebar-feature-group.nested.js +594 -1
- package/public/components/sidebar/sidebar-feature-group.nested.js.map +1 -1
- package/public/components/sidebar/sidebar-feature.nested.js +402 -1
- package/public/components/sidebar/sidebar-feature.nested.js.map +1 -1
- package/public/components/sidebar/sidebar-section.nested.js +394 -1
- package/public/components/sidebar/sidebar-section.nested.js.map +1 -1
- package/public/components/sidebar/sidebar-segment.nested.js +200 -1
- package/public/components/sidebar/sidebar-segment.nested.js.map +1 -1
- package/public/components/sidebar/sidebar-separator.nested.js +49 -1
- package/public/components/sidebar/sidebar-separator.nested.js.map +1 -1
- package/public/components/sidebar/sidebar-sub-features.nested.js +312 -1
- package/public/components/sidebar/sidebar-sub-features.nested.js.map +1 -1
- package/public/components/sidebar/sidebar-user.nested.js +733 -1
- package/public/components/sidebar/sidebar-user.nested.js.map +1 -1
- package/public/components/stepper/Stepper.js +371 -1
- package/public/components/stepper/Stepper.js.map +1 -1
- package/public/components/tabs/Tabs.js +615 -1
- package/public/components/tabs/Tabs.js.map +1 -1
- package/public/components/tabs/Tabs.nested.js +472 -1
- package/public/components/tabs/Tabs.nested.js.map +1 -1
- package/public/components/tag/Tag.js +665 -1
- package/public/components/tag/Tag.js.map +1 -1
- package/public/components/tag/Tag.nested.js +554 -1
- package/public/components/tag/Tag.nested.js.map +1 -1
- package/public/components/taglist/TagList.js +475 -1
- package/public/components/taglist/TagList.js.map +1 -1
- package/public/components/textarea/Textarea.js +303 -1
- package/public/components/textarea/Textarea.js.map +1 -1
- package/public/components/textinput/Textinput.js +497 -1
- package/public/components/textinput/Textinput.js.map +1 -1
- package/public/components/textinput/Textinput.nested.js +320 -1
- package/public/components/textinput/Textinput.nested.js.map +1 -1
- package/public/components/toggle/Toggle.js +278 -1
- package/public/components/toggle/Toggle.js.map +1 -1
- package/public/components/tooltip/Tooltip.js +173 -1
- package/public/components/tooltip/Tooltip.js.map +1 -1
- package/public/icons-storybook.js +16 -0
- package/public/index-c33b3772.js +873 -1
- package/public/index-c33b3772.js.map +1 -1
- package/public/linear-f46d7e9e.js +700 -1
- package/public/linear-f46d7e9e.js.map +1 -1
- package/public/main.d.ts +1 -0
- package/public/main.d.ts.map +1 -1
- package/public/path-1b5da959.js +186 -1
- package/public/path-1b5da959.js.map +1 -1
- package/public/sidebar-service-275bf9ef.js +129 -1
- package/public/sidebar-service-275bf9ef.js.map +1 -1
- package/public/symbol-b05a6e2b.js +169 -1
- package/public/symbol-b05a6e2b.js.map +1 -1
- package/public/transform-15d69d5d.js +2743 -1
- package/public/transform-15d69d5d.js.map +1 -1
- package/public/utilities/DataTableUtilities.d.ts.map +1 -1
- package/public/utilities/DataTableUtilities.ts +22 -2
- package/public/utilities/EventForward.js +136 -1
- package/public/utilities/EventForward.js.map +1 -1
- package/public/utilities/EventHandler.js +36 -1
- package/public/utilities/EventHandler.js.map +1 -1
- package/public/utilities/components/datatable/data.d.ts.map +1 -1
- package/public/utilities/components/datatable/datatable.types.d.ts +9 -2
- package/public/utilities/components/datatable/datatable.types.d.ts.map +1 -1
- package/public/utilities/main.d.ts +1 -0
- package/public/utilities/main.d.ts.map +1 -1
- package/public/utilities/stories/datatable/DataTable.stories.d.ts.map +1 -1
- package/public/utilities/stories/header/Header.stories.d.ts.map +1 -1
- package/public/utilities/stories/kpi/kpi.stories.d.ts +7 -0
- package/public/utilities/stories/kpi/kpi.stories.d.ts.map +1 -0
- package/public/utilities/utilities/DataTableUtilities.d.ts.map +1 -1
- package/public/DataTableDefaultAction.nested-483f8bb0.js +0 -2
- package/public/DataTableDefaultAction.nested-483f8bb0.js.map +0 -1
- package/public/DataTableUtilities-60220c78.js +0 -2
- package/public/DataTableUtilities-60220c78.js.map +0 -1
- package/public/adeo/DataTableUtilities-60220c78.js +0 -2
- package/public/adeo/DataTableUtilities-60220c78.js.map +0 -1
- package/public/bricoman/DataTableUtilities-60220c78.js +0 -2
- package/public/bricoman/DataTableUtilities-60220c78.js.map +0 -1
|
@@ -1,2 +1,701 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { i as interpolateNumber, a as interpolate } from './transform-15d69d5d.js';
|
|
2
|
+
|
|
3
|
+
function ascending(a, b) {
|
|
4
|
+
return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function descending(a, b) {
|
|
8
|
+
return a == null || b == null ? NaN
|
|
9
|
+
: b < a ? -1
|
|
10
|
+
: b > a ? 1
|
|
11
|
+
: b >= a ? 0
|
|
12
|
+
: NaN;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function bisector(f) {
|
|
16
|
+
let compare1, compare2, delta;
|
|
17
|
+
|
|
18
|
+
// If an accessor is specified, promote it to a comparator. In this case we
|
|
19
|
+
// can test whether the search value is (self-) comparable. We can’t do this
|
|
20
|
+
// for a comparator (except for specific, known comparators) because we can’t
|
|
21
|
+
// tell if the comparator is symmetric, and an asymmetric comparator can’t be
|
|
22
|
+
// used to test whether a single value is comparable.
|
|
23
|
+
if (f.length !== 2) {
|
|
24
|
+
compare1 = ascending;
|
|
25
|
+
compare2 = (d, x) => ascending(f(d), x);
|
|
26
|
+
delta = (d, x) => f(d) - x;
|
|
27
|
+
} else {
|
|
28
|
+
compare1 = f === ascending || f === descending ? f : zero;
|
|
29
|
+
compare2 = f;
|
|
30
|
+
delta = f;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function left(a, x, lo = 0, hi = a.length) {
|
|
34
|
+
if (lo < hi) {
|
|
35
|
+
if (compare1(x, x) !== 0) return hi;
|
|
36
|
+
do {
|
|
37
|
+
const mid = (lo + hi) >>> 1;
|
|
38
|
+
if (compare2(a[mid], x) < 0) lo = mid + 1;
|
|
39
|
+
else hi = mid;
|
|
40
|
+
} while (lo < hi);
|
|
41
|
+
}
|
|
42
|
+
return lo;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function right(a, x, lo = 0, hi = a.length) {
|
|
46
|
+
if (lo < hi) {
|
|
47
|
+
if (compare1(x, x) !== 0) return hi;
|
|
48
|
+
do {
|
|
49
|
+
const mid = (lo + hi) >>> 1;
|
|
50
|
+
if (compare2(a[mid], x) <= 0) lo = mid + 1;
|
|
51
|
+
else hi = mid;
|
|
52
|
+
} while (lo < hi);
|
|
53
|
+
}
|
|
54
|
+
return lo;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function center(a, x, lo = 0, hi = a.length) {
|
|
58
|
+
const i = left(a, x, lo, hi - 1);
|
|
59
|
+
return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return {left, center, right};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function zero() {
|
|
66
|
+
return 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function number$1(x) {
|
|
70
|
+
return x === null ? NaN : +x;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const ascendingBisect = bisector(ascending);
|
|
74
|
+
const bisectRight = ascendingBisect.right;
|
|
75
|
+
bisector(number$1).center;
|
|
76
|
+
var bisect = bisectRight;
|
|
77
|
+
|
|
78
|
+
const e10 = Math.sqrt(50),
|
|
79
|
+
e5 = Math.sqrt(10),
|
|
80
|
+
e2 = Math.sqrt(2);
|
|
81
|
+
|
|
82
|
+
function tickSpec(start, stop, count) {
|
|
83
|
+
const step = (stop - start) / Math.max(0, count),
|
|
84
|
+
power = Math.floor(Math.log10(step)),
|
|
85
|
+
error = step / Math.pow(10, power),
|
|
86
|
+
factor = error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1;
|
|
87
|
+
let i1, i2, inc;
|
|
88
|
+
if (power < 0) {
|
|
89
|
+
inc = Math.pow(10, -power) / factor;
|
|
90
|
+
i1 = Math.round(start * inc);
|
|
91
|
+
i2 = Math.round(stop * inc);
|
|
92
|
+
if (i1 / inc < start) ++i1;
|
|
93
|
+
if (i2 / inc > stop) --i2;
|
|
94
|
+
inc = -inc;
|
|
95
|
+
} else {
|
|
96
|
+
inc = Math.pow(10, power) * factor;
|
|
97
|
+
i1 = Math.round(start / inc);
|
|
98
|
+
i2 = Math.round(stop / inc);
|
|
99
|
+
if (i1 * inc < start) ++i1;
|
|
100
|
+
if (i2 * inc > stop) --i2;
|
|
101
|
+
}
|
|
102
|
+
if (i2 < i1 && 0.5 <= count && count < 2) return tickSpec(start, stop, count * 2);
|
|
103
|
+
return [i1, i2, inc];
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function ticks(start, stop, count) {
|
|
107
|
+
stop = +stop, start = +start, count = +count;
|
|
108
|
+
if (!(count > 0)) return [];
|
|
109
|
+
if (start === stop) return [start];
|
|
110
|
+
const reverse = stop < start, [i1, i2, inc] = reverse ? tickSpec(stop, start, count) : tickSpec(start, stop, count);
|
|
111
|
+
if (!(i2 >= i1)) return [];
|
|
112
|
+
const n = i2 - i1 + 1, ticks = new Array(n);
|
|
113
|
+
if (reverse) {
|
|
114
|
+
if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) / -inc;
|
|
115
|
+
else for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) * inc;
|
|
116
|
+
} else {
|
|
117
|
+
if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) / -inc;
|
|
118
|
+
else for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) * inc;
|
|
119
|
+
}
|
|
120
|
+
return ticks;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function tickIncrement(start, stop, count) {
|
|
124
|
+
stop = +stop, start = +start, count = +count;
|
|
125
|
+
return tickSpec(start, stop, count)[2];
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function tickStep(start, stop, count) {
|
|
129
|
+
stop = +stop, start = +start, count = +count;
|
|
130
|
+
const reverse = stop < start, inc = reverse ? tickIncrement(stop, start, count) : tickIncrement(start, stop, count);
|
|
131
|
+
return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function interpolateRound(a, b) {
|
|
135
|
+
return a = +a, b = +b, function(t) {
|
|
136
|
+
return Math.round(a * (1 - t) + b * t);
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function formatDecimal(x) {
|
|
141
|
+
return Math.abs(x = Math.round(x)) >= 1e21
|
|
142
|
+
? x.toLocaleString("en").replace(/,/g, "")
|
|
143
|
+
: x.toString(10);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Computes the decimal coefficient and exponent of the specified number x with
|
|
147
|
+
// significant digits p, where x is positive and p is in [1, 21] or undefined.
|
|
148
|
+
// For example, formatDecimalParts(1.23) returns ["123", 0].
|
|
149
|
+
function formatDecimalParts(x, p) {
|
|
150
|
+
if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity
|
|
151
|
+
var i, coefficient = x.slice(0, i);
|
|
152
|
+
|
|
153
|
+
// The string returned by toExponential either has the form \d\.\d+e[-+]\d+
|
|
154
|
+
// (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3).
|
|
155
|
+
return [
|
|
156
|
+
coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
|
|
157
|
+
+x.slice(i + 1)
|
|
158
|
+
];
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function exponent(x) {
|
|
162
|
+
return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function formatGroup(grouping, thousands) {
|
|
166
|
+
return function(value, width) {
|
|
167
|
+
var i = value.length,
|
|
168
|
+
t = [],
|
|
169
|
+
j = 0,
|
|
170
|
+
g = grouping[0],
|
|
171
|
+
length = 0;
|
|
172
|
+
|
|
173
|
+
while (i > 0 && g > 0) {
|
|
174
|
+
if (length + g + 1 > width) g = Math.max(1, width - length);
|
|
175
|
+
t.push(value.substring(i -= g, i + g));
|
|
176
|
+
if ((length += g + 1) > width) break;
|
|
177
|
+
g = grouping[j = (j + 1) % grouping.length];
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return t.reverse().join(thousands);
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function formatNumerals(numerals) {
|
|
185
|
+
return function(value) {
|
|
186
|
+
return value.replace(/[0-9]/g, function(i) {
|
|
187
|
+
return numerals[+i];
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// [[fill]align][sign][symbol][0][width][,][.precision][~][type]
|
|
193
|
+
var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
|
|
194
|
+
|
|
195
|
+
function formatSpecifier(specifier) {
|
|
196
|
+
if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier);
|
|
197
|
+
var match;
|
|
198
|
+
return new FormatSpecifier({
|
|
199
|
+
fill: match[1],
|
|
200
|
+
align: match[2],
|
|
201
|
+
sign: match[3],
|
|
202
|
+
symbol: match[4],
|
|
203
|
+
zero: match[5],
|
|
204
|
+
width: match[6],
|
|
205
|
+
comma: match[7],
|
|
206
|
+
precision: match[8] && match[8].slice(1),
|
|
207
|
+
trim: match[9],
|
|
208
|
+
type: match[10]
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof
|
|
213
|
+
|
|
214
|
+
function FormatSpecifier(specifier) {
|
|
215
|
+
this.fill = specifier.fill === undefined ? " " : specifier.fill + "";
|
|
216
|
+
this.align = specifier.align === undefined ? ">" : specifier.align + "";
|
|
217
|
+
this.sign = specifier.sign === undefined ? "-" : specifier.sign + "";
|
|
218
|
+
this.symbol = specifier.symbol === undefined ? "" : specifier.symbol + "";
|
|
219
|
+
this.zero = !!specifier.zero;
|
|
220
|
+
this.width = specifier.width === undefined ? undefined : +specifier.width;
|
|
221
|
+
this.comma = !!specifier.comma;
|
|
222
|
+
this.precision = specifier.precision === undefined ? undefined : +specifier.precision;
|
|
223
|
+
this.trim = !!specifier.trim;
|
|
224
|
+
this.type = specifier.type === undefined ? "" : specifier.type + "";
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
FormatSpecifier.prototype.toString = function() {
|
|
228
|
+
return this.fill
|
|
229
|
+
+ this.align
|
|
230
|
+
+ this.sign
|
|
231
|
+
+ this.symbol
|
|
232
|
+
+ (this.zero ? "0" : "")
|
|
233
|
+
+ (this.width === undefined ? "" : Math.max(1, this.width | 0))
|
|
234
|
+
+ (this.comma ? "," : "")
|
|
235
|
+
+ (this.precision === undefined ? "" : "." + Math.max(0, this.precision | 0))
|
|
236
|
+
+ (this.trim ? "~" : "")
|
|
237
|
+
+ this.type;
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k.
|
|
241
|
+
function formatTrim(s) {
|
|
242
|
+
out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {
|
|
243
|
+
switch (s[i]) {
|
|
244
|
+
case ".": i0 = i1 = i; break;
|
|
245
|
+
case "0": if (i0 === 0) i0 = i; i1 = i; break;
|
|
246
|
+
default: if (!+s[i]) break out; if (i0 > 0) i0 = 0; break;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
var prefixExponent;
|
|
253
|
+
|
|
254
|
+
function formatPrefixAuto(x, p) {
|
|
255
|
+
var d = formatDecimalParts(x, p);
|
|
256
|
+
if (!d) return x + "";
|
|
257
|
+
var coefficient = d[0],
|
|
258
|
+
exponent = d[1],
|
|
259
|
+
i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,
|
|
260
|
+
n = coefficient.length;
|
|
261
|
+
return i === n ? coefficient
|
|
262
|
+
: i > n ? coefficient + new Array(i - n + 1).join("0")
|
|
263
|
+
: i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i)
|
|
264
|
+
: "0." + new Array(1 - i).join("0") + formatDecimalParts(x, Math.max(0, p + i - 1))[0]; // less than 1y!
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
function formatRounded(x, p) {
|
|
268
|
+
var d = formatDecimalParts(x, p);
|
|
269
|
+
if (!d) return x + "";
|
|
270
|
+
var coefficient = d[0],
|
|
271
|
+
exponent = d[1];
|
|
272
|
+
return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient
|
|
273
|
+
: coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1)
|
|
274
|
+
: coefficient + new Array(exponent - coefficient.length + 2).join("0");
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
var formatTypes = {
|
|
278
|
+
"%": (x, p) => (x * 100).toFixed(p),
|
|
279
|
+
"b": (x) => Math.round(x).toString(2),
|
|
280
|
+
"c": (x) => x + "",
|
|
281
|
+
"d": formatDecimal,
|
|
282
|
+
"e": (x, p) => x.toExponential(p),
|
|
283
|
+
"f": (x, p) => x.toFixed(p),
|
|
284
|
+
"g": (x, p) => x.toPrecision(p),
|
|
285
|
+
"o": (x) => Math.round(x).toString(8),
|
|
286
|
+
"p": (x, p) => formatRounded(x * 100, p),
|
|
287
|
+
"r": formatRounded,
|
|
288
|
+
"s": formatPrefixAuto,
|
|
289
|
+
"X": (x) => Math.round(x).toString(16).toUpperCase(),
|
|
290
|
+
"x": (x) => Math.round(x).toString(16)
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
function identity$1(x) {
|
|
294
|
+
return x;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
var map = Array.prototype.map,
|
|
298
|
+
prefixes = ["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];
|
|
299
|
+
|
|
300
|
+
function formatLocale(locale) {
|
|
301
|
+
var group = locale.grouping === undefined || locale.thousands === undefined ? identity$1 : formatGroup(map.call(locale.grouping, Number), locale.thousands + ""),
|
|
302
|
+
currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "",
|
|
303
|
+
currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "",
|
|
304
|
+
decimal = locale.decimal === undefined ? "." : locale.decimal + "",
|
|
305
|
+
numerals = locale.numerals === undefined ? identity$1 : formatNumerals(map.call(locale.numerals, String)),
|
|
306
|
+
percent = locale.percent === undefined ? "%" : locale.percent + "",
|
|
307
|
+
minus = locale.minus === undefined ? "−" : locale.minus + "",
|
|
308
|
+
nan = locale.nan === undefined ? "NaN" : locale.nan + "";
|
|
309
|
+
|
|
310
|
+
function newFormat(specifier) {
|
|
311
|
+
specifier = formatSpecifier(specifier);
|
|
312
|
+
|
|
313
|
+
var fill = specifier.fill,
|
|
314
|
+
align = specifier.align,
|
|
315
|
+
sign = specifier.sign,
|
|
316
|
+
symbol = specifier.symbol,
|
|
317
|
+
zero = specifier.zero,
|
|
318
|
+
width = specifier.width,
|
|
319
|
+
comma = specifier.comma,
|
|
320
|
+
precision = specifier.precision,
|
|
321
|
+
trim = specifier.trim,
|
|
322
|
+
type = specifier.type;
|
|
323
|
+
|
|
324
|
+
// The "n" type is an alias for ",g".
|
|
325
|
+
if (type === "n") comma = true, type = "g";
|
|
326
|
+
|
|
327
|
+
// The "" type, and any invalid type, is an alias for ".12~g".
|
|
328
|
+
else if (!formatTypes[type]) precision === undefined && (precision = 12), trim = true, type = "g";
|
|
329
|
+
|
|
330
|
+
// If zero fill is specified, padding goes after sign and before digits.
|
|
331
|
+
if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "=";
|
|
332
|
+
|
|
333
|
+
// Compute the prefix and suffix.
|
|
334
|
+
// For SI-prefix, the suffix is lazily computed.
|
|
335
|
+
var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "",
|
|
336
|
+
suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : "";
|
|
337
|
+
|
|
338
|
+
// What format function should we use?
|
|
339
|
+
// Is this an integer type?
|
|
340
|
+
// Can this type generate exponential notation?
|
|
341
|
+
var formatType = formatTypes[type],
|
|
342
|
+
maybeSuffix = /[defgprs%]/.test(type);
|
|
343
|
+
|
|
344
|
+
// Set the default precision if not specified,
|
|
345
|
+
// or clamp the specified precision to the supported range.
|
|
346
|
+
// For significant precision, it must be in [1, 21].
|
|
347
|
+
// For fixed precision, it must be in [0, 20].
|
|
348
|
+
precision = precision === undefined ? 6
|
|
349
|
+
: /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))
|
|
350
|
+
: Math.max(0, Math.min(20, precision));
|
|
351
|
+
|
|
352
|
+
function format(value) {
|
|
353
|
+
var valuePrefix = prefix,
|
|
354
|
+
valueSuffix = suffix,
|
|
355
|
+
i, n, c;
|
|
356
|
+
|
|
357
|
+
if (type === "c") {
|
|
358
|
+
valueSuffix = formatType(value) + valueSuffix;
|
|
359
|
+
value = "";
|
|
360
|
+
} else {
|
|
361
|
+
value = +value;
|
|
362
|
+
|
|
363
|
+
// Determine the sign. -0 is not less than 0, but 1 / -0 is!
|
|
364
|
+
var valueNegative = value < 0 || 1 / value < 0;
|
|
365
|
+
|
|
366
|
+
// Perform the initial formatting.
|
|
367
|
+
value = isNaN(value) ? nan : formatType(Math.abs(value), precision);
|
|
368
|
+
|
|
369
|
+
// Trim insignificant zeros.
|
|
370
|
+
if (trim) value = formatTrim(value);
|
|
371
|
+
|
|
372
|
+
// If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign.
|
|
373
|
+
if (valueNegative && +value === 0 && sign !== "+") valueNegative = false;
|
|
374
|
+
|
|
375
|
+
// Compute the prefix and suffix.
|
|
376
|
+
valuePrefix = (valueNegative ? (sign === "(" ? sign : minus) : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
|
|
377
|
+
valueSuffix = (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : "");
|
|
378
|
+
|
|
379
|
+
// Break the formatted value into the integer “value” part that can be
|
|
380
|
+
// grouped, and fractional or exponential “suffix” part that is not.
|
|
381
|
+
if (maybeSuffix) {
|
|
382
|
+
i = -1, n = value.length;
|
|
383
|
+
while (++i < n) {
|
|
384
|
+
if (c = value.charCodeAt(i), 48 > c || c > 57) {
|
|
385
|
+
valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;
|
|
386
|
+
value = value.slice(0, i);
|
|
387
|
+
break;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
// If the fill character is not "0", grouping is applied before padding.
|
|
394
|
+
if (comma && !zero) value = group(value, Infinity);
|
|
395
|
+
|
|
396
|
+
// Compute the padding.
|
|
397
|
+
var length = valuePrefix.length + value.length + valueSuffix.length,
|
|
398
|
+
padding = length < width ? new Array(width - length + 1).join(fill) : "";
|
|
399
|
+
|
|
400
|
+
// If the fill character is "0", grouping is applied after padding.
|
|
401
|
+
if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
|
|
402
|
+
|
|
403
|
+
// Reconstruct the final output based on the desired alignment.
|
|
404
|
+
switch (align) {
|
|
405
|
+
case "<": value = valuePrefix + value + valueSuffix + padding; break;
|
|
406
|
+
case "=": value = valuePrefix + padding + value + valueSuffix; break;
|
|
407
|
+
case "^": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break;
|
|
408
|
+
default: value = padding + valuePrefix + value + valueSuffix; break;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
return numerals(value);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
format.toString = function() {
|
|
415
|
+
return specifier + "";
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
return format;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
function formatPrefix(specifier, value) {
|
|
422
|
+
var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)),
|
|
423
|
+
e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,
|
|
424
|
+
k = Math.pow(10, -e),
|
|
425
|
+
prefix = prefixes[8 + e / 3];
|
|
426
|
+
return function(value) {
|
|
427
|
+
return f(k * value) + prefix;
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
return {
|
|
432
|
+
format: newFormat,
|
|
433
|
+
formatPrefix: formatPrefix
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
var locale;
|
|
438
|
+
var format;
|
|
439
|
+
var formatPrefix;
|
|
440
|
+
|
|
441
|
+
defaultLocale({
|
|
442
|
+
thousands: ",",
|
|
443
|
+
grouping: [3],
|
|
444
|
+
currency: ["$", ""]
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
function defaultLocale(definition) {
|
|
448
|
+
locale = formatLocale(definition);
|
|
449
|
+
format = locale.format;
|
|
450
|
+
formatPrefix = locale.formatPrefix;
|
|
451
|
+
return locale;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
function precisionFixed(step) {
|
|
455
|
+
return Math.max(0, -exponent(Math.abs(step)));
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
function precisionPrefix(step, value) {
|
|
459
|
+
return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step)));
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
function precisionRound(step, max) {
|
|
463
|
+
step = Math.abs(step), max = Math.abs(max) - step;
|
|
464
|
+
return Math.max(0, exponent(max) - exponent(step)) + 1;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
function initRange(domain, range) {
|
|
468
|
+
switch (arguments.length) {
|
|
469
|
+
case 0: break;
|
|
470
|
+
case 1: this.range(domain); break;
|
|
471
|
+
default: this.range(range).domain(domain); break;
|
|
472
|
+
}
|
|
473
|
+
return this;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
function constants(x) {
|
|
477
|
+
return function() {
|
|
478
|
+
return x;
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
function number(x) {
|
|
483
|
+
return +x;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
var unit = [0, 1];
|
|
487
|
+
|
|
488
|
+
function identity(x) {
|
|
489
|
+
return x;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
function normalize(a, b) {
|
|
493
|
+
return (b -= (a = +a))
|
|
494
|
+
? function(x) { return (x - a) / b; }
|
|
495
|
+
: constants(isNaN(b) ? NaN : 0.5);
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
function clamper(a, b) {
|
|
499
|
+
var t;
|
|
500
|
+
if (a > b) t = a, a = b, b = t;
|
|
501
|
+
return function(x) { return Math.max(a, Math.min(b, x)); };
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
// normalize(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1].
|
|
505
|
+
// interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b].
|
|
506
|
+
function bimap(domain, range, interpolate) {
|
|
507
|
+
var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1];
|
|
508
|
+
if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0);
|
|
509
|
+
else d0 = normalize(d0, d1), r0 = interpolate(r0, r1);
|
|
510
|
+
return function(x) { return r0(d0(x)); };
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
function polymap(domain, range, interpolate) {
|
|
514
|
+
var j = Math.min(domain.length, range.length) - 1,
|
|
515
|
+
d = new Array(j),
|
|
516
|
+
r = new Array(j),
|
|
517
|
+
i = -1;
|
|
518
|
+
|
|
519
|
+
// Reverse descending domains.
|
|
520
|
+
if (domain[j] < domain[0]) {
|
|
521
|
+
domain = domain.slice().reverse();
|
|
522
|
+
range = range.slice().reverse();
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
while (++i < j) {
|
|
526
|
+
d[i] = normalize(domain[i], domain[i + 1]);
|
|
527
|
+
r[i] = interpolate(range[i], range[i + 1]);
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
return function(x) {
|
|
531
|
+
var i = bisect(domain, x, 1, j) - 1;
|
|
532
|
+
return r[i](d[i](x));
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
function copy(source, target) {
|
|
537
|
+
return target
|
|
538
|
+
.domain(source.domain())
|
|
539
|
+
.range(source.range())
|
|
540
|
+
.interpolate(source.interpolate())
|
|
541
|
+
.clamp(source.clamp())
|
|
542
|
+
.unknown(source.unknown());
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
function transformer() {
|
|
546
|
+
var domain = unit,
|
|
547
|
+
range = unit,
|
|
548
|
+
interpolate$1 = interpolate,
|
|
549
|
+
transform,
|
|
550
|
+
untransform,
|
|
551
|
+
unknown,
|
|
552
|
+
clamp = identity,
|
|
553
|
+
piecewise,
|
|
554
|
+
output,
|
|
555
|
+
input;
|
|
556
|
+
|
|
557
|
+
function rescale() {
|
|
558
|
+
var n = Math.min(domain.length, range.length);
|
|
559
|
+
if (clamp !== identity) clamp = clamper(domain[0], domain[n - 1]);
|
|
560
|
+
piecewise = n > 2 ? polymap : bimap;
|
|
561
|
+
output = input = null;
|
|
562
|
+
return scale;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
function scale(x) {
|
|
566
|
+
return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate$1)))(transform(clamp(x)));
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
scale.invert = function(y) {
|
|
570
|
+
return clamp(untransform((input || (input = piecewise(range, domain.map(transform), interpolateNumber)))(y)));
|
|
571
|
+
};
|
|
572
|
+
|
|
573
|
+
scale.domain = function(_) {
|
|
574
|
+
return arguments.length ? (domain = Array.from(_, number), rescale()) : domain.slice();
|
|
575
|
+
};
|
|
576
|
+
|
|
577
|
+
scale.range = function(_) {
|
|
578
|
+
return arguments.length ? (range = Array.from(_), rescale()) : range.slice();
|
|
579
|
+
};
|
|
580
|
+
|
|
581
|
+
scale.rangeRound = function(_) {
|
|
582
|
+
return range = Array.from(_), interpolate$1 = interpolateRound, rescale();
|
|
583
|
+
};
|
|
584
|
+
|
|
585
|
+
scale.clamp = function(_) {
|
|
586
|
+
return arguments.length ? (clamp = _ ? true : identity, rescale()) : clamp !== identity;
|
|
587
|
+
};
|
|
588
|
+
|
|
589
|
+
scale.interpolate = function(_) {
|
|
590
|
+
return arguments.length ? (interpolate$1 = _, rescale()) : interpolate$1;
|
|
591
|
+
};
|
|
592
|
+
|
|
593
|
+
scale.unknown = function(_) {
|
|
594
|
+
return arguments.length ? (unknown = _, scale) : unknown;
|
|
595
|
+
};
|
|
596
|
+
|
|
597
|
+
return function(t, u) {
|
|
598
|
+
transform = t, untransform = u;
|
|
599
|
+
return rescale();
|
|
600
|
+
};
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
function continuous() {
|
|
604
|
+
return transformer()(identity, identity);
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
function tickFormat(start, stop, count, specifier) {
|
|
608
|
+
var step = tickStep(start, stop, count),
|
|
609
|
+
precision;
|
|
610
|
+
specifier = formatSpecifier(specifier == null ? ",f" : specifier);
|
|
611
|
+
switch (specifier.type) {
|
|
612
|
+
case "s": {
|
|
613
|
+
var value = Math.max(Math.abs(start), Math.abs(stop));
|
|
614
|
+
if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) specifier.precision = precision;
|
|
615
|
+
return formatPrefix(specifier, value);
|
|
616
|
+
}
|
|
617
|
+
case "":
|
|
618
|
+
case "e":
|
|
619
|
+
case "g":
|
|
620
|
+
case "p":
|
|
621
|
+
case "r": {
|
|
622
|
+
if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e");
|
|
623
|
+
break;
|
|
624
|
+
}
|
|
625
|
+
case "f":
|
|
626
|
+
case "%": {
|
|
627
|
+
if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2;
|
|
628
|
+
break;
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
return format(specifier);
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
function linearish(scale) {
|
|
635
|
+
var domain = scale.domain;
|
|
636
|
+
|
|
637
|
+
scale.ticks = function(count) {
|
|
638
|
+
var d = domain();
|
|
639
|
+
return ticks(d[0], d[d.length - 1], count == null ? 10 : count);
|
|
640
|
+
};
|
|
641
|
+
|
|
642
|
+
scale.tickFormat = function(count, specifier) {
|
|
643
|
+
var d = domain();
|
|
644
|
+
return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier);
|
|
645
|
+
};
|
|
646
|
+
|
|
647
|
+
scale.nice = function(count) {
|
|
648
|
+
if (count == null) count = 10;
|
|
649
|
+
|
|
650
|
+
var d = domain();
|
|
651
|
+
var i0 = 0;
|
|
652
|
+
var i1 = d.length - 1;
|
|
653
|
+
var start = d[i0];
|
|
654
|
+
var stop = d[i1];
|
|
655
|
+
var prestep;
|
|
656
|
+
var step;
|
|
657
|
+
var maxIter = 10;
|
|
658
|
+
|
|
659
|
+
if (stop < start) {
|
|
660
|
+
step = start, start = stop, stop = step;
|
|
661
|
+
step = i0, i0 = i1, i1 = step;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
while (maxIter-- > 0) {
|
|
665
|
+
step = tickIncrement(start, stop, count);
|
|
666
|
+
if (step === prestep) {
|
|
667
|
+
d[i0] = start;
|
|
668
|
+
d[i1] = stop;
|
|
669
|
+
return domain(d);
|
|
670
|
+
} else if (step > 0) {
|
|
671
|
+
start = Math.floor(start / step) * step;
|
|
672
|
+
stop = Math.ceil(stop / step) * step;
|
|
673
|
+
} else if (step < 0) {
|
|
674
|
+
start = Math.ceil(start * step) / step;
|
|
675
|
+
stop = Math.floor(stop * step) / step;
|
|
676
|
+
} else {
|
|
677
|
+
break;
|
|
678
|
+
}
|
|
679
|
+
prestep = step;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
return scale;
|
|
683
|
+
};
|
|
684
|
+
|
|
685
|
+
return scale;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
function linear() {
|
|
689
|
+
var scale = continuous();
|
|
690
|
+
|
|
691
|
+
scale.copy = function() {
|
|
692
|
+
return copy(scale, linear());
|
|
693
|
+
};
|
|
694
|
+
|
|
695
|
+
initRange.apply(scale, arguments);
|
|
696
|
+
|
|
697
|
+
return linearish(scale);
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
export { copy as a, bisector as b, continuous as c, initRange as i, linear as l, tickStep as t };
|
|
2
701
|
//# sourceMappingURL=linear-f46d7e9e.js.map
|