@limetech/lime-elements 40.24.0 → 40.25.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/CHANGELOG.md +8 -0
- package/dist/cjs/{checkbox.template-CNJ29zDR.js → checkbox.template-DgiUCPna.js} +1 -1
- package/dist/cjs/{image.template-DlF-f23b.js → image.template-B_HZH9t-.js} +1 -1
- package/dist/cjs/{index-BlsqxTB1.js → index-CQn9p_mp.js} +12 -0
- package/dist/cjs/lime-elements.cjs.js +2 -2
- package/dist/cjs/limel-3d-hover-effect-glow.cjs.entry.js +1 -1
- package/dist/cjs/limel-action-bar_3.cjs.entry.js +1 -1
- package/dist/cjs/limel-ai-avatar.cjs.entry.js +1 -1
- package/dist/cjs/limel-badge_7.cjs.entry.js +1 -1
- package/dist/cjs/limel-banner.cjs.entry.js +1 -1
- package/dist/cjs/limel-button-group.cjs.entry.js +1 -1
- package/dist/cjs/limel-button.cjs.entry.js +1 -1
- package/dist/cjs/limel-callout.cjs.entry.js +1 -1
- package/dist/cjs/limel-card.cjs.entry.js +2 -2
- package/dist/cjs/limel-chart.cjs.entry.js +777 -174
- package/dist/cjs/limel-checkbox.cjs.entry.js +2 -2
- package/dist/cjs/limel-chip-set.cjs.entry.js +1 -1
- package/dist/cjs/limel-chip_2.cjs.entry.js +2 -2
- package/dist/cjs/limel-circular-progress.cjs.entry.js +1 -1
- package/dist/cjs/limel-code-diff.cjs.entry.js +1 -1
- package/dist/cjs/limel-code-editor.cjs.entry.js +1 -1
- package/dist/cjs/limel-collapsible-section.cjs.entry.js +1 -1
- package/dist/cjs/limel-color-picker-palette.cjs.entry.js +1 -1
- package/dist/cjs/limel-color-picker.cjs.entry.js +1 -1
- package/dist/cjs/limel-config.cjs.entry.js +1 -1
- package/dist/cjs/limel-date-picker.cjs.entry.js +1 -1
- package/dist/cjs/limel-dialog.cjs.entry.js +1 -1
- package/dist/cjs/limel-dock-button.cjs.entry.js +1 -1
- package/dist/cjs/limel-dock.cjs.entry.js +1 -1
- package/dist/cjs/limel-drag-handle_2.cjs.entry.js +1 -1
- package/dist/cjs/limel-dynamic-label.cjs.entry.js +1 -1
- package/dist/cjs/limel-email-viewer.cjs.entry.js +1 -1
- package/dist/cjs/limel-file-dropzone_2.cjs.entry.js +1 -1
- package/dist/cjs/limel-file-viewer.cjs.entry.js +2 -2
- package/dist/cjs/limel-file.cjs.entry.js +1 -1
- package/dist/cjs/limel-flatpickr-adapter.cjs.entry.js +1 -1
- package/dist/cjs/limel-flex-container.cjs.entry.js +1 -1
- package/dist/cjs/limel-form-header.cjs.entry.js +1 -1
- package/dist/cjs/limel-form.cjs.entry.js +1 -1
- package/dist/cjs/limel-grid.cjs.entry.js +1 -1
- package/dist/cjs/limel-header.cjs.entry.js +1 -1
- package/dist/cjs/limel-help_2.cjs.entry.js +1 -1
- package/dist/cjs/limel-helper-line_3.cjs.entry.js +1 -1
- package/dist/cjs/limel-hotkey_4.cjs.entry.js +1 -1
- package/dist/cjs/limel-icon-button.cjs.entry.js +1 -1
- package/dist/cjs/limel-icon.cjs.entry.js +1 -1
- package/dist/cjs/limel-info-tile.cjs.entry.js +1 -1
- package/dist/cjs/limel-list-item.cjs.entry.js +4 -4
- package/dist/cjs/limel-markdown.cjs.entry.js +1 -1
- package/dist/cjs/limel-masonry-layout.cjs.entry.js +1 -1
- package/dist/cjs/limel-menu-item-meta.cjs.entry.js +1 -1
- package/dist/cjs/limel-pagination-jump.cjs.entry.js +1 -1
- package/dist/cjs/limel-pagination.cjs.entry.js +1 -1
- package/dist/cjs/limel-picker.cjs.entry.js +1 -1
- package/dist/cjs/limel-popover_2.cjs.entry.js +1 -1
- package/dist/cjs/limel-profile-picture.cjs.entry.js +2 -2
- package/dist/cjs/limel-progress-flow-item.cjs.entry.js +1 -1
- package/dist/cjs/limel-progress-flow.cjs.entry.js +1 -1
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +1 -1
- package/dist/cjs/limel-radio-button-group.cjs.entry.js +1 -1
- package/dist/cjs/limel-radio-button.cjs.entry.js +1 -1
- package/dist/cjs/limel-resize-handle.cjs.entry.js +1 -1
- package/dist/cjs/limel-select.cjs.entry.js +2 -2
- package/dist/cjs/limel-shortcut.cjs.entry.js +1 -1
- package/dist/cjs/limel-side-panel.cjs.entry.js +1 -1
- package/dist/cjs/limel-slider.cjs.entry.js +1 -1
- package/dist/cjs/limel-snackbar.cjs.entry.js +1 -1
- package/dist/cjs/limel-split-button.cjs.entry.js +1 -1
- package/dist/cjs/limel-switch.cjs.entry.js +1 -1
- package/dist/cjs/limel-tab-bar.cjs.entry.js +1 -1
- package/dist/cjs/limel-tab-panel.cjs.entry.js +1 -1
- package/dist/cjs/limel-table.cjs.entry.js +1 -1
- package/dist/cjs/limel-text-editor-link-menu.cjs.entry.js +1 -1
- package/dist/cjs/limel-text-editor.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{render-list-component-BtAliHQp.js → render-list-component-BOYFHMFE.js} +1 -1
- package/dist/collection/components/chart/chart.css +29 -0
- package/dist/collection/components/chart/chart.js +352 -67
- package/dist/collection/components/chart/options.js +342 -109
- package/dist/collection/components/chart/scale.js +25 -2
- package/dist/collection/components/chart/series.js +110 -0
- package/dist/esm/{checkbox.template-CAja2LKZ.js → checkbox.template-BJJmiDJP.js} +1 -1
- package/dist/esm/{image.template-BGjw97m_.js → image.template-Cw2q5IS7.js} +1 -1
- package/dist/esm/{index-BU9IJqli.js → index-D3SUrFhp.js} +12 -1
- package/dist/esm/{keyboard-navigation-BF7IKmnG.js → keyboard-navigation-DeMxdkNf.js} +1 -1
- package/dist/esm/lime-elements.js +3 -3
- package/dist/esm/limel-3d-hover-effect-glow.entry.js +1 -1
- package/dist/esm/limel-action-bar_3.entry.js +1 -1
- package/dist/esm/limel-ai-avatar.entry.js +1 -1
- package/dist/esm/limel-badge_7.entry.js +1 -1
- package/dist/esm/limel-banner.entry.js +1 -1
- package/dist/esm/limel-button-group.entry.js +1 -1
- package/dist/esm/limel-button.entry.js +1 -1
- package/dist/esm/limel-callout.entry.js +1 -1
- package/dist/esm/limel-card.entry.js +2 -2
- package/dist/esm/limel-chart.entry.js +778 -175
- package/dist/esm/limel-checkbox.entry.js +2 -2
- package/dist/esm/limel-chip-set.entry.js +1 -1
- package/dist/esm/limel-chip_2.entry.js +2 -2
- package/dist/esm/limel-circular-progress.entry.js +1 -1
- package/dist/esm/limel-code-diff.entry.js +1 -1
- package/dist/esm/limel-code-editor.entry.js +1 -1
- package/dist/esm/limel-collapsible-section.entry.js +1 -1
- package/dist/esm/limel-color-picker-palette.entry.js +1 -1
- package/dist/esm/limel-color-picker.entry.js +1 -1
- package/dist/esm/limel-config.entry.js +1 -1
- package/dist/esm/limel-date-picker.entry.js +1 -1
- package/dist/esm/limel-dialog.entry.js +1 -1
- package/dist/esm/limel-dock-button.entry.js +1 -1
- package/dist/esm/limel-dock.entry.js +1 -1
- package/dist/esm/limel-drag-handle_2.entry.js +1 -1
- package/dist/esm/limel-dynamic-label.entry.js +1 -1
- package/dist/esm/limel-email-viewer.entry.js +1 -1
- package/dist/esm/limel-file-dropzone_2.entry.js +1 -1
- package/dist/esm/limel-file-viewer.entry.js +2 -2
- package/dist/esm/limel-file.entry.js +1 -1
- package/dist/esm/limel-flatpickr-adapter.entry.js +1 -1
- package/dist/esm/limel-flex-container.entry.js +1 -1
- package/dist/esm/limel-form-header.entry.js +1 -1
- package/dist/esm/limel-form.entry.js +1 -1
- package/dist/esm/limel-grid.entry.js +1 -1
- package/dist/esm/limel-header.entry.js +1 -1
- package/dist/esm/limel-help_2.entry.js +1 -1
- package/dist/esm/limel-helper-line_3.entry.js +1 -1
- package/dist/esm/limel-hotkey_4.entry.js +1 -1
- package/dist/esm/limel-icon-button.entry.js +1 -1
- package/dist/esm/limel-icon.entry.js +1 -1
- package/dist/esm/limel-info-tile.entry.js +1 -1
- package/dist/esm/limel-list-item.entry.js +4 -4
- package/dist/esm/limel-markdown.entry.js +1 -1
- package/dist/esm/limel-masonry-layout.entry.js +1 -1
- package/dist/esm/limel-menu-item-meta.entry.js +1 -1
- package/dist/esm/limel-pagination-jump.entry.js +1 -1
- package/dist/esm/limel-pagination.entry.js +1 -1
- package/dist/esm/limel-picker.entry.js +1 -1
- package/dist/esm/limel-popover_2.entry.js +1 -1
- package/dist/esm/limel-profile-picture.entry.js +2 -2
- package/dist/esm/limel-progress-flow-item.entry.js +1 -1
- package/dist/esm/limel-progress-flow.entry.js +1 -1
- package/dist/esm/limel-prosemirror-adapter.entry.js +1 -1
- package/dist/esm/limel-radio-button-group.entry.js +1 -1
- package/dist/esm/limel-radio-button.entry.js +1 -1
- package/dist/esm/limel-resize-handle.entry.js +1 -1
- package/dist/esm/limel-select.entry.js +2 -2
- package/dist/esm/limel-shortcut.entry.js +1 -1
- package/dist/esm/limel-side-panel.entry.js +1 -1
- package/dist/esm/limel-slider.entry.js +1 -1
- package/dist/esm/limel-snackbar.entry.js +1 -1
- package/dist/esm/limel-split-button.entry.js +1 -1
- package/dist/esm/limel-switch.entry.js +1 -1
- package/dist/esm/limel-tab-bar.entry.js +2 -2
- package/dist/esm/limel-tab-panel.entry.js +1 -1
- package/dist/esm/limel-table.entry.js +1 -1
- package/dist/esm/limel-text-editor-link-menu.entry.js +1 -1
- package/dist/esm/limel-text-editor.entry.js +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{render-list-component-J1IzNpbv.js → render-list-component-CnMNjOaj.js} +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/{p-6f8305ac.entry.js → p-07961d4f.entry.js} +1 -1
- package/dist/lime-elements/{p-a5aa8c06.entry.js → p-099e9e1a.entry.js} +1 -1
- package/dist/lime-elements/{p-6567de01.entry.js → p-0dd5cb25.entry.js} +1 -1
- package/dist/lime-elements/{p-bfb98b0e.entry.js → p-1d57370e.entry.js} +1 -1
- package/dist/lime-elements/{p-391a227e.entry.js → p-1ef92aa3.entry.js} +1 -1
- package/dist/lime-elements/p-1eff9347.entry.js +56 -0
- package/dist/lime-elements/{p-d078ea89.entry.js → p-22458db2.entry.js} +1 -1
- package/dist/lime-elements/{p-557f0e46.entry.js → p-2520a91b.entry.js} +1 -1
- package/dist/lime-elements/{p-85318636.entry.js → p-25473848.entry.js} +1 -1
- package/dist/lime-elements/{p-51fde63a.entry.js → p-27000dfb.entry.js} +1 -1
- package/dist/lime-elements/{p-65199efa.entry.js → p-29800b71.entry.js} +1 -1
- package/dist/lime-elements/{p-4de3b35b.entry.js → p-2e1fd8c4.entry.js} +1 -1
- package/dist/lime-elements/{p-558a7e27.entry.js → p-2f6ee1b0.entry.js} +1 -1
- package/dist/lime-elements/{p-ae634a68.entry.js → p-427a3da3.entry.js} +1 -1
- package/dist/lime-elements/{p-46695dd3.entry.js → p-447a2633.entry.js} +1 -1
- package/dist/lime-elements/{p-e481fb53.entry.js → p-4c54780d.entry.js} +1 -1
- package/dist/lime-elements/{p-08b1bfad.entry.js → p-4f81f0b4.entry.js} +1 -1
- package/dist/lime-elements/{p-81c43fe9.entry.js → p-5062b51a.entry.js} +1 -1
- package/dist/lime-elements/{p-71ed9466.entry.js → p-5295b4c7.entry.js} +1 -1
- package/dist/lime-elements/{p-c63d294b.entry.js → p-5a1b7f4d.entry.js} +1 -1
- package/dist/lime-elements/{p-664dbc43.entry.js → p-5b9c1f8f.entry.js} +1 -1
- package/dist/lime-elements/{p-ce418df1.entry.js → p-5be1e9e8.entry.js} +1 -1
- package/dist/lime-elements/{p-da9be21e.entry.js → p-5c6589aa.entry.js} +1 -1
- package/dist/lime-elements/{p-c1dbad1e.entry.js → p-5e7ca1fd.entry.js} +1 -1
- package/dist/lime-elements/{p-083aa41f.entry.js → p-5f66e497.entry.js} +1 -1
- package/dist/lime-elements/{p-4bc550e5.entry.js → p-667759da.entry.js} +1 -1
- package/dist/lime-elements/{p-d51bf98b.entry.js → p-6a340609.entry.js} +1 -1
- package/dist/lime-elements/{p-e3cf45ed.entry.js → p-6d3cde2e.entry.js} +1 -1
- package/dist/lime-elements/{p-63f2f0b7.entry.js → p-6e529563.entry.js} +1 -1
- package/dist/lime-elements/{p-b6334f4b.entry.js → p-743f014f.entry.js} +1 -1
- package/dist/lime-elements/{p-5fcb39b8.entry.js → p-7aa034e2.entry.js} +1 -1
- package/dist/lime-elements/{p-507965d9.entry.js → p-7b2ec934.entry.js} +1 -1
- package/dist/lime-elements/p-7b99624f.entry.js +1 -0
- package/dist/lime-elements/{p-1c7fcafc.entry.js → p-7ea96b80.entry.js} +1 -1
- package/dist/lime-elements/{p-a1cd0dc0.entry.js → p-7fe1d9ad.entry.js} +1 -1
- package/dist/lime-elements/{p-9e5a15d1.entry.js → p-842694af.entry.js} +1 -1
- package/dist/lime-elements/{p-9cbfedad.entry.js → p-848aeaa6.entry.js} +1 -1
- package/dist/lime-elements/{p-15f5e45e.entry.js → p-868a8b12.entry.js} +1 -1
- package/dist/lime-elements/{p-4eee17f7.entry.js → p-891f6a07.entry.js} +1 -1
- package/dist/lime-elements/{p-b810b854.entry.js → p-8dcb9ef1.entry.js} +1 -1
- package/dist/lime-elements/{p-2a5113ef.entry.js → p-92f79a62.entry.js} +1 -1
- package/dist/lime-elements/{p-61c81d09.entry.js → p-93907698.entry.js} +2 -2
- package/dist/lime-elements/{p-718431c1.entry.js → p-9b3c7341.entry.js} +1 -1
- package/dist/lime-elements/{p-_1yBt1pG.js → p-BJrZuSu3.js} +1 -1
- package/dist/lime-elements/{p-Cadm4-WZ.js → p-BzHrLZdr.js} +1 -1
- package/dist/lime-elements/{p-BU9IJqli.js → p-D3SUrFhp.js} +2 -2
- package/dist/lime-elements/p-DpXrxCh5.js +1 -0
- package/dist/lime-elements/p-DwxRLqY6.js +1 -0
- package/dist/lime-elements/{p-3f9acb22.entry.js → p-a0501e84.entry.js} +1 -1
- package/dist/lime-elements/{p-3a421be9.entry.js → p-a5419b44.entry.js} +1 -1
- package/dist/lime-elements/{p-22aaa1ae.entry.js → p-abd612b3.entry.js} +1 -1
- package/dist/lime-elements/{p-c6eed240.entry.js → p-aeac9588.entry.js} +2 -2
- package/dist/lime-elements/p-b01e8af9.entry.js +1 -0
- package/dist/lime-elements/{p-f97ec7a5.entry.js → p-b08c9b52.entry.js} +1 -1
- package/dist/lime-elements/{p-be653ca9.entry.js → p-b1f6412e.entry.js} +1 -1
- package/dist/lime-elements/{p-6b6b8ffe.entry.js → p-b3967ab3.entry.js} +1 -1
- package/dist/lime-elements/{p-eb812303.entry.js → p-b8bfec0e.entry.js} +1 -1
- package/dist/lime-elements/{p-490ac19d.entry.js → p-ba4b44ad.entry.js} +1 -1
- package/dist/lime-elements/{p-783fd221.entry.js → p-bf726f16.entry.js} +1 -1
- package/dist/lime-elements/{p-1e699935.entry.js → p-c2f27d2a.entry.js} +1 -1
- package/dist/lime-elements/{p-271662d4.entry.js → p-c3bd19ea.entry.js} +1 -1
- package/dist/lime-elements/{p-8e46d111.entry.js → p-cc560bbd.entry.js} +1 -1
- package/dist/lime-elements/{p-e8665e99.entry.js → p-d2953c11.entry.js} +1 -1
- package/dist/lime-elements/{p-156ea100.entry.js → p-d3d01dd4.entry.js} +1 -1
- package/dist/lime-elements/{p-4b75e653.entry.js → p-d9e6175b.entry.js} +1 -1
- package/dist/lime-elements/{p-373032c0.entry.js → p-dab5421d.entry.js} +1 -1
- package/dist/lime-elements/{p-c3d1aa57.entry.js → p-dcaeefc9.entry.js} +1 -1
- package/dist/lime-elements/{p-1fa0fd7a.entry.js → p-df8aa135.entry.js} +1 -1
- package/dist/lime-elements/{p-d2f784a8.entry.js → p-e2fb2af4.entry.js} +1 -1
- package/dist/lime-elements/{p-c7bcae67.entry.js → p-e929fc64.entry.js} +1 -1
- package/dist/lime-elements/{p-3d6ba932.entry.js → p-ea02dade.entry.js} +1 -1
- package/dist/lime-elements/{p-0700e83f.entry.js → p-ecd633cb.entry.js} +1 -1
- package/dist/lime-elements/{p-c3b86df2.entry.js → p-f5cd53e8.entry.js} +1 -1
- package/dist/lime-elements/{p-127ff801.entry.js → p-f7cae25a.entry.js} +1 -1
- package/dist/types/components/chart/chart.d.ts +59 -8
- package/dist/types/components/chart/chart.types.d.ts +23 -0
- package/dist/types/components/chart/options.d.ts +83 -8
- package/dist/types/components/chart/scale.d.ts +10 -0
- package/dist/types/components/chart/series.d.ts +71 -0
- package/dist/types/components.d.ts +42 -15
- package/package.json +2 -2
- package/dist/lime-elements/p-2d698983.entry.js +0 -1
- package/dist/lime-elements/p-391305a7.entry.js +0 -56
- package/dist/lime-elements/p-N9vxZMhe.js +0 -1
- package/dist/lime-elements/p-bb45a5bb.entry.js +0 -1
- package/dist/lime-elements/p-eF09GxA_.js +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, H as Host, a as getElement } from './index-
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host, f as forceUpdate, a as getElement } from './index-D3SUrFhp.js';
|
|
2
2
|
import { g as getSupportedLocale, t as translations } from './translations--i932i_D.js';
|
|
3
|
-
import { i as isNavigationKey, f as
|
|
3
|
+
import { i as isNavigationKey, f as findTabStop, a as findNavigationTarget, N as NO_NAVIGATION_TARGET } from './keyboard-navigation-DeMxdkNf.js';
|
|
4
4
|
import './keycodes-DQ5DmW_Y.js';
|
|
5
5
|
|
|
6
6
|
/*! *****************************************************************************
|
|
@@ -25328,7 +25328,7 @@ var tmpNotUsedArr = [];
|
|
|
25328
25328
|
* specific language governing permissions and limitations
|
|
25329
25329
|
* under the License.
|
|
25330
25330
|
*/
|
|
25331
|
-
var AXIS_TYPES = {
|
|
25331
|
+
var AXIS_TYPES$1 = {
|
|
25332
25332
|
value: 1,
|
|
25333
25333
|
category: 1,
|
|
25334
25334
|
time: 1,
|
|
@@ -25344,7 +25344,7 @@ function determineAxisType(model) {
|
|
|
25344
25344
|
// PENDING: Theoretically, a customized `Scale` is probably impossible, since
|
|
25345
25345
|
// the interface of `Scale` does not guarantee stability. But we still literally
|
|
25346
25346
|
// support it for backward compat, though type incorrect.
|
|
25347
|
-
|| !hasOwn(AXIS_TYPES, type) && !Scale.getClass(type)) {
|
|
25347
|
+
|| !hasOwn(AXIS_TYPES$1, type) && !Scale.getClass(type)) {
|
|
25348
25348
|
type = 'value';
|
|
25349
25349
|
}
|
|
25350
25350
|
return type;
|
|
@@ -42059,7 +42059,7 @@ var axisDefault = {
|
|
|
42059
42059
|
* @param axisName 'x' 'y' 'radius' 'angle' 'parallel' ...
|
|
42060
42060
|
*/
|
|
42061
42061
|
function axisModelCreator(registers, axisName, BaseAxisModelClass, extraDefaultOption) {
|
|
42062
|
-
each$3(AXIS_TYPES, function (v, axisType) {
|
|
42062
|
+
each$3(AXIS_TYPES$1, function (v, axisType) {
|
|
42063
42063
|
var defaultOption = merge(merge({}, axisDefault[axisType], true), extraDefaultOption, true);
|
|
42064
42064
|
var AxisModel = /** @class */function (_super) {
|
|
42065
42065
|
__extends$1(AxisModel, _super);
|
|
@@ -50188,12 +50188,21 @@ const WHOLE_TYPES = new Set([
|
|
|
50188
50188
|
'doughnut',
|
|
50189
50189
|
'ring',
|
|
50190
50190
|
]);
|
|
50191
|
-
|
|
50191
|
+
/**
|
|
50192
|
+
* Types that draw their values along an axis, against the texts of the items
|
|
50193
|
+
* along another one.
|
|
50194
|
+
*/
|
|
50195
|
+
const AXIS_TYPES = new Set([
|
|
50192
50196
|
'bar',
|
|
50193
50197
|
'dot',
|
|
50194
50198
|
'area',
|
|
50195
50199
|
'line',
|
|
50196
50200
|
]);
|
|
50201
|
+
const STACK_TYPES = new Set([
|
|
50202
|
+
'bar',
|
|
50203
|
+
'area',
|
|
50204
|
+
'line',
|
|
50205
|
+
]);
|
|
50197
50206
|
/**
|
|
50198
50207
|
* Whether the items of a chart of this type are parts of one whole.
|
|
50199
50208
|
* @param type - the chart type
|
|
@@ -50207,7 +50216,21 @@ function isPartOfWhole(type) {
|
|
|
50207
50216
|
* @param type - the chart type
|
|
50208
50217
|
*/
|
|
50209
50218
|
function usesAxisIncrement(type) {
|
|
50210
|
-
return
|
|
50219
|
+
return AXIS_TYPES.has(type);
|
|
50220
|
+
}
|
|
50221
|
+
/**
|
|
50222
|
+
* Whether a chart of this type can draw `series`.
|
|
50223
|
+
* @param type - the chart type
|
|
50224
|
+
*/
|
|
50225
|
+
function canDrawSeries(type) {
|
|
50226
|
+
return AXIS_TYPES.has(type);
|
|
50227
|
+
}
|
|
50228
|
+
/**
|
|
50229
|
+
* Whether a chart of this type can stack its `series` on each other.
|
|
50230
|
+
* @param type - the chart type
|
|
50231
|
+
*/
|
|
50232
|
+
function canStack(type) {
|
|
50233
|
+
return STACK_TYPES.has(type);
|
|
50211
50234
|
}
|
|
50212
50235
|
/**
|
|
50213
50236
|
* Whether the item has a `[start, end]` range, or an `[x, y]` point in a
|
|
@@ -50779,11 +50802,123 @@ function findLocale(language) {
|
|
|
50779
50802
|
return locales.get(language);
|
|
50780
50803
|
}
|
|
50781
50804
|
|
|
50805
|
+
/**
|
|
50806
|
+
* Lines up the items of the series by their text, since items of different
|
|
50807
|
+
* series that have the same text belong to the same category. When a series
|
|
50808
|
+
* has several items with the same text, its second item with that text lines
|
|
50809
|
+
* up with the second one of the other series, and so on.
|
|
50810
|
+
* @param series - the series
|
|
50811
|
+
*/
|
|
50812
|
+
function alignSeries(series) {
|
|
50813
|
+
const categories = [];
|
|
50814
|
+
const placesOfTexts = new Map();
|
|
50815
|
+
const placedSeries = series.map((current) => {
|
|
50816
|
+
var _a;
|
|
50817
|
+
const timesSeen = new Map();
|
|
50818
|
+
return ((_a = current.items) !== null && _a !== void 0 ? _a : []).map((item) => {
|
|
50819
|
+
var _a, _b;
|
|
50820
|
+
const occurrence = (_a = timesSeen.get(item.text)) !== null && _a !== void 0 ? _a : 0;
|
|
50821
|
+
timesSeen.set(item.text, occurrence + 1);
|
|
50822
|
+
const places = (_b = placesOfTexts.get(item.text)) !== null && _b !== void 0 ? _b : [];
|
|
50823
|
+
placesOfTexts.set(item.text, places);
|
|
50824
|
+
if (occurrence === places.length) {
|
|
50825
|
+
places.push(categories.length);
|
|
50826
|
+
categories.push(item.text);
|
|
50827
|
+
}
|
|
50828
|
+
return { item: item, index: places[occurrence] };
|
|
50829
|
+
});
|
|
50830
|
+
});
|
|
50831
|
+
return {
|
|
50832
|
+
categories: categories,
|
|
50833
|
+
series: series.map((current, index) => {
|
|
50834
|
+
const itemsByCategory = new Map(placedSeries[index].map((placed) => [placed.index, placed.item]));
|
|
50835
|
+
return {
|
|
50836
|
+
text: current.text,
|
|
50837
|
+
color: current.color,
|
|
50838
|
+
items: categories.map((_, category) => itemsByCategory.get(category)),
|
|
50839
|
+
};
|
|
50840
|
+
}),
|
|
50841
|
+
};
|
|
50842
|
+
}
|
|
50843
|
+
/**
|
|
50844
|
+
* The item at a position, if there is one.
|
|
50845
|
+
* @param grid - the series
|
|
50846
|
+
* @param position - where the item is
|
|
50847
|
+
*/
|
|
50848
|
+
function getItemAt(grid, position) {
|
|
50849
|
+
var _a;
|
|
50850
|
+
return (_a = grid.series[position.series]) === null || _a === void 0 ? void 0 : _a.items[position.index];
|
|
50851
|
+
}
|
|
50852
|
+
/**
|
|
50853
|
+
* The series that has an item at a place on the axis and is nearest to a
|
|
50854
|
+
* series: the series itself when it has an item there, otherwise the closest
|
|
50855
|
+
* one, and the earlier of two that are as close.
|
|
50856
|
+
* @param grid - the series
|
|
50857
|
+
* @param position - the place on the axis, and the series to start from
|
|
50858
|
+
*/
|
|
50859
|
+
function getNearestSeries(grid, position) {
|
|
50860
|
+
const distance = (series) => Math.abs(series - position.series);
|
|
50861
|
+
const [nearest] = [...grid.series.keys()]
|
|
50862
|
+
.filter((series) => getItemAt(grid, Object.assign(Object.assign({}, position), { series: series })))
|
|
50863
|
+
.sort((a, b) => distance(a) - distance(b));
|
|
50864
|
+
return nearest;
|
|
50865
|
+
}
|
|
50866
|
+
/**
|
|
50867
|
+
* The items of every series, in no particular order.
|
|
50868
|
+
* @param grid - the series
|
|
50869
|
+
*/
|
|
50870
|
+
function getAllItems(grid) {
|
|
50871
|
+
return grid.series.flatMap((series) => series.items.filter((item) => item !== undefined));
|
|
50872
|
+
}
|
|
50873
|
+
/**
|
|
50874
|
+
* The items that the value axis has to reach: every item, or, when the
|
|
50875
|
+
* series are stacked, the two ends of the stack at each place on the axis.
|
|
50876
|
+
* Positive and negative values are stacked on their own side of zero, and a
|
|
50877
|
+
* range adds its extent to the stack.
|
|
50878
|
+
* @param grid - the series
|
|
50879
|
+
* @param stacked - whether the series are stacked on each other
|
|
50880
|
+
*/
|
|
50881
|
+
function getAxisItems(grid, stacked) {
|
|
50882
|
+
if (!stacked) {
|
|
50883
|
+
return getAllItems(grid);
|
|
50884
|
+
}
|
|
50885
|
+
return grid.categories.flatMap((text, index) => {
|
|
50886
|
+
const values = grid.series
|
|
50887
|
+
.map((series) => series.items[index])
|
|
50888
|
+
.filter((item) => item !== undefined)
|
|
50889
|
+
.map((item) => getValueSpan(item));
|
|
50890
|
+
const sum = (side) => values.filter((value) => side(value)).reduce((a, b) => a + b, 0);
|
|
50891
|
+
return [
|
|
50892
|
+
{ text: text, value: sum((value) => value > 0) },
|
|
50893
|
+
{ text: text, value: sum((value) => value < 0) },
|
|
50894
|
+
];
|
|
50895
|
+
});
|
|
50896
|
+
}
|
|
50897
|
+
/**
|
|
50898
|
+
* Whether the item at a position ends its stack, since no later series has
|
|
50899
|
+
* an item on the same side of zero at that place on the axis.
|
|
50900
|
+
* @param grid - the stacked series
|
|
50901
|
+
* @param position - where the item is
|
|
50902
|
+
*/
|
|
50903
|
+
function endsStack(grid, position) {
|
|
50904
|
+
const side = Math.sign(getStackedValue(grid, position));
|
|
50905
|
+
return grid.series.slice(position.series + 1).every((_, offset) => Math.sign(getStackedValue(grid, {
|
|
50906
|
+
series: position.series + 1 + offset,
|
|
50907
|
+
index: position.index,
|
|
50908
|
+
})) !== side);
|
|
50909
|
+
}
|
|
50910
|
+
function getStackedValue(grid, position) {
|
|
50911
|
+
const item = getItemAt(grid, position);
|
|
50912
|
+
return item ? getValueSpan(item) : 0;
|
|
50913
|
+
}
|
|
50914
|
+
|
|
50782
50915
|
const DOT_SIZE = 8;
|
|
50783
50916
|
const LINE_DOT_SIZE = 6;
|
|
50784
50917
|
const CONNECTOR_WIDTH = 2;
|
|
50785
50918
|
const DIMMED_OPACITY = 0.4;
|
|
50786
50919
|
const AREA_OPACITY = 0.4;
|
|
50920
|
+
const SERIES_AREA_OPACITY = 0.15;
|
|
50921
|
+
const SERIES_STACK = { stack: 'series', stackStrategy: 'samesign' };
|
|
50787
50922
|
const PADDING = 8;
|
|
50788
50923
|
const NPS_MIN = -100;
|
|
50789
50924
|
const NPS_MAX = 100;
|
|
@@ -50794,6 +50929,15 @@ const NPS_ARC_WIDTH = 16;
|
|
|
50794
50929
|
const ITEM_TEXT_MIN_WIDTH = 40;
|
|
50795
50930
|
const ITEM_TEXT_GAP = 4;
|
|
50796
50931
|
const ITEM_TEXT_LINE_HEIGHT = 14;
|
|
50932
|
+
const SWATCH = {
|
|
50933
|
+
width: '0.625rem',
|
|
50934
|
+
height: '0.625rem',
|
|
50935
|
+
'border-radius': '0.125rem',
|
|
50936
|
+
};
|
|
50937
|
+
const SWATCH_SHAPES = {
|
|
50938
|
+
line: { height: '0.125rem' },
|
|
50939
|
+
dot: { 'border-radius': '50%' },
|
|
50940
|
+
};
|
|
50797
50941
|
const emphasis = { focus: 'self' };
|
|
50798
50942
|
const blur = { itemStyle: { opacity: DIMMED_OPACITY } };
|
|
50799
50943
|
const hidden = { show: false };
|
|
@@ -50805,34 +50949,116 @@ const hidden = { show: false };
|
|
|
50805
50949
|
* when it is known from an earlier drawing
|
|
50806
50950
|
*/
|
|
50807
50951
|
function drawChart(settings, theme, itemSpace) {
|
|
50808
|
-
const
|
|
50809
|
-
|
|
50810
|
-
|
|
50811
|
-
|
|
50812
|
-
|
|
50813
|
-
|
|
50814
|
-
|
|
50815
|
-
|
|
50816
|
-
|
|
50817
|
-
}
|
|
50818
|
-
/**
|
|
50819
|
-
* The
|
|
50952
|
+
const drawn = getDrawnSettings(settings);
|
|
50953
|
+
const grid = getSeriesGrid(drawn);
|
|
50954
|
+
const drawing = drawSeries(drawn, grid, theme, itemSpace);
|
|
50955
|
+
return Object.assign(Object.assign({}, drawing), { option: Object.assign({ animation: theme.animate, textStyle: { fontFamily: theme.fontFamily, color: theme.textColor }, tooltip: Object.assign({ appendTo: 'body', backgroundColor: theme.surfaceColor, borderColor: theme.axisLineColor, textStyle: { color: theme.textColor } }, (drawn.series
|
|
50956
|
+
? getCategoryTooltipOption(drawn, grid, theme)
|
|
50957
|
+
: {
|
|
50958
|
+
trigger: 'item',
|
|
50959
|
+
formatter: (params) => getTooltip(drawn, findItem(drawing, params).index),
|
|
50960
|
+
})) }, drawing.option) });
|
|
50961
|
+
}
|
|
50962
|
+
/**
|
|
50963
|
+
* The item drawn at a position, if an item is drawn there. A position in a
|
|
50964
|
+
* series of ECharts that draws no items of its own, such as the invisible
|
|
50965
|
+
* column of an item, belongs to the first series.
|
|
50820
50966
|
* @param drawing - the drawing of the chart
|
|
50821
50967
|
* @param location - a position within the drawn series
|
|
50822
50968
|
*/
|
|
50823
|
-
function
|
|
50824
|
-
|
|
50969
|
+
function findItem(drawing, location) {
|
|
50970
|
+
var _a, _b;
|
|
50971
|
+
if (drawing.itemsAreSeries) {
|
|
50972
|
+
return { series: 0, index: location.seriesIndex };
|
|
50973
|
+
}
|
|
50974
|
+
return {
|
|
50975
|
+
series: (_b = (_a = drawing.partsOfSeries) === null || _a === void 0 ? void 0 : _a[location.seriesIndex]) !== null && _b !== void 0 ? _b : 0,
|
|
50976
|
+
index: location.dataIndex,
|
|
50977
|
+
};
|
|
50825
50978
|
}
|
|
50826
50979
|
/**
|
|
50827
50980
|
* Where an item is drawn, for highlighting it and showing its tooltip.
|
|
50828
50981
|
* @param drawing - the drawing of the chart
|
|
50829
|
-
* @param
|
|
50982
|
+
* @param position - where the item is among the series
|
|
50830
50983
|
*/
|
|
50831
|
-
function locateItem(drawing,
|
|
50984
|
+
function locateItem(drawing, position) {
|
|
50832
50985
|
if (drawing.itemsAreSeries) {
|
|
50833
|
-
return { seriesIndex: index, dataIndex: 0 };
|
|
50986
|
+
return { seriesIndex: position.index, dataIndex: 0 };
|
|
50987
|
+
}
|
|
50988
|
+
return {
|
|
50989
|
+
seriesIndex: drawing.seriesIndexes[position.series],
|
|
50990
|
+
dataIndex: position.index,
|
|
50991
|
+
};
|
|
50992
|
+
}
|
|
50993
|
+
/**
|
|
50994
|
+
* The series that the chart draws: its series, when its type can draw them.
|
|
50995
|
+
* @param settings - what the chart is given
|
|
50996
|
+
*/
|
|
50997
|
+
function getDrawnSeries(settings) {
|
|
50998
|
+
var _a;
|
|
50999
|
+
if (!((_a = settings.series) === null || _a === void 0 ? void 0 : _a.length) || !canDrawSeries(settings.type)) {
|
|
51000
|
+
return;
|
|
51001
|
+
}
|
|
51002
|
+
return settings.series;
|
|
51003
|
+
}
|
|
51004
|
+
/**
|
|
51005
|
+
* The series whose items the chart draws as its items: its first series,
|
|
51006
|
+
* when its type cannot draw series and it has no items.
|
|
51007
|
+
* @param settings - what the chart is given
|
|
51008
|
+
*/
|
|
51009
|
+
function getSeriesOfDrawnItems(settings) {
|
|
51010
|
+
var _a, _b;
|
|
51011
|
+
if (getDrawnSeries(settings) || ((_a = settings.items) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
51012
|
+
return;
|
|
51013
|
+
}
|
|
51014
|
+
return (_b = settings.series) === null || _b === void 0 ? void 0 : _b[0];
|
|
51015
|
+
}
|
|
51016
|
+
/**
|
|
51017
|
+
* The items that the chart draws when it draws no series: its items, or the
|
|
51018
|
+
* items of its first series when it has no items.
|
|
51019
|
+
* @param settings - what the chart is given
|
|
51020
|
+
*/
|
|
51021
|
+
function getDrawnItems(settings) {
|
|
51022
|
+
var _a, _b, _c;
|
|
51023
|
+
if (getDrawnSeries(settings)) {
|
|
51024
|
+
return [];
|
|
50834
51025
|
}
|
|
50835
|
-
return
|
|
51026
|
+
return (_c = (_b = (_a = getSeriesOfDrawnItems(settings)) === null || _a === void 0 ? void 0 : _a.items) !== null && _b !== void 0 ? _b : settings.items) !== null && _c !== void 0 ? _c : [];
|
|
51027
|
+
}
|
|
51028
|
+
/**
|
|
51029
|
+
* Whether the chart stacks its series on each other. Only the types that
|
|
51030
|
+
* can stack series do, and never with dates, since a sum of dates means
|
|
51031
|
+
* nothing.
|
|
51032
|
+
* @param settings - what the chart is given
|
|
51033
|
+
*/
|
|
51034
|
+
function isStacked(settings) {
|
|
51035
|
+
return Boolean(settings.stacked &&
|
|
51036
|
+
getDrawnSeries(settings) &&
|
|
51037
|
+
canStack(settings.type) &&
|
|
51038
|
+
settings.valueFormat !== 'date');
|
|
51039
|
+
}
|
|
51040
|
+
function getDrawnSettings(settings) {
|
|
51041
|
+
return Object.assign(Object.assign({}, settings), { items: getDrawnItems(settings), series: getDrawnSeries(settings), stacked: isStacked(settings) });
|
|
51042
|
+
}
|
|
51043
|
+
/**
|
|
51044
|
+
* The series that the chart draws lined up by category, or the items it
|
|
51045
|
+
* draws as the only series when it draws no series.
|
|
51046
|
+
* @param settings - what the chart is given
|
|
51047
|
+
*/
|
|
51048
|
+
function getSeriesGrid(settings) {
|
|
51049
|
+
var _a;
|
|
51050
|
+
return alignSeries((_a = getDrawnSeries(settings)) !== null && _a !== void 0 ? _a : [
|
|
51051
|
+
{ text: '', items: getDrawnItems(settings) },
|
|
51052
|
+
]);
|
|
51053
|
+
}
|
|
51054
|
+
/**
|
|
51055
|
+
* The style of the marker of a series, in the legend and in the tooltip: a
|
|
51056
|
+
* square for bars and areas, a line for lines, and a dot for dots.
|
|
51057
|
+
* @param type - the chart type
|
|
51058
|
+
* @param color - the color of the series
|
|
51059
|
+
*/
|
|
51060
|
+
function getSwatchStyle(type, color = '') {
|
|
51061
|
+
return Object.assign(Object.assign(Object.assign({}, SWATCH), SWATCH_SHAPES[type]), { 'background-color': color });
|
|
50836
51062
|
}
|
|
50837
51063
|
/**
|
|
50838
51064
|
* Shows the text of every item on the axis, cut short to the space of the
|
|
@@ -50891,7 +51117,51 @@ function getTooltip(settings, index) {
|
|
|
50891
51117
|
.map((text) => encodeHTML(text))
|
|
50892
51118
|
.join('<br/>');
|
|
50893
51119
|
}
|
|
50894
|
-
|
|
51120
|
+
/**
|
|
51121
|
+
* The tooltip of a category of a chart with series, as HTML: its text, and
|
|
51122
|
+
* the name and value of each series that has an item there.
|
|
51123
|
+
* @param grid - the series of the chart, lined up by category
|
|
51124
|
+
* @param style - how the chart writes values
|
|
51125
|
+
* @param index - the index of the category
|
|
51126
|
+
*/
|
|
51127
|
+
function getCategoryTooltip(grid, style, index) {
|
|
51128
|
+
const category = grid.categories[index];
|
|
51129
|
+
if (category === undefined) {
|
|
51130
|
+
return '';
|
|
51131
|
+
}
|
|
51132
|
+
const lines = grid.series
|
|
51133
|
+
.filter((series) => series.items[index] !== undefined)
|
|
51134
|
+
.map((series) => {
|
|
51135
|
+
var _a;
|
|
51136
|
+
const item = series.items[index];
|
|
51137
|
+
return getTooltipLine(getSwatch(style.type, (_a = item.color) !== null && _a !== void 0 ? _a : series.color), series.text, formatValue(item, style));
|
|
51138
|
+
});
|
|
51139
|
+
return [`<div>${encodeHTML(category)}</div>`, ...lines].join('');
|
|
51140
|
+
}
|
|
51141
|
+
function getTooltipLine(swatch, name, value) {
|
|
51142
|
+
return `<div style="display:flex;justify-content:space-between;gap:1rem"><span>${swatch}${encodeHTML(name)}</span><span>${encodeHTML(value)}</span></div>`;
|
|
51143
|
+
}
|
|
51144
|
+
function getSwatch(type, color = '') {
|
|
51145
|
+
const style = Object.assign({ display: 'inline-block', 'vertical-align': 'middle', 'margin-right': '0.375rem' }, getSwatchStyle(type, encodeHTML(color)));
|
|
51146
|
+
const declarations = Object.entries(style).map(([property, value]) => `${property}:${value}`);
|
|
51147
|
+
return `<span style="${declarations.join(';')}"></span>`;
|
|
51148
|
+
}
|
|
51149
|
+
function getCategoryTooltipOption(settings, grid, theme) {
|
|
51150
|
+
return {
|
|
51151
|
+
trigger: 'axis',
|
|
51152
|
+
axisPointer: settings.type === 'bar'
|
|
51153
|
+
? {
|
|
51154
|
+
type: 'shadow',
|
|
51155
|
+
shadowStyle: { color: theme.axisLineColor, opacity: 0.2 },
|
|
51156
|
+
}
|
|
51157
|
+
: { type: 'line', lineStyle: { color: theme.axisLineColor } },
|
|
51158
|
+
formatter: (params) => {
|
|
51159
|
+
const [first] = [params].flat();
|
|
51160
|
+
return getCategoryTooltip(grid, settings, first === null || first === void 0 ? void 0 : first.dataIndex);
|
|
51161
|
+
},
|
|
51162
|
+
};
|
|
51163
|
+
}
|
|
51164
|
+
function drawSeries(settings, grid, theme, itemSpace) {
|
|
50895
51165
|
switch (settings.type) {
|
|
50896
51166
|
case 'pie':
|
|
50897
51167
|
case 'doughnut': {
|
|
@@ -50910,46 +51180,54 @@ function drawSeries(settings, theme, itemSpace) {
|
|
|
50910
51180
|
return drawNps(settings, theme);
|
|
50911
51181
|
}
|
|
50912
51182
|
default: {
|
|
50913
|
-
return drawOnAxes(settings, theme, itemSpace);
|
|
51183
|
+
return drawOnAxes(settings, grid, theme, itemSpace);
|
|
50914
51184
|
}
|
|
50915
51185
|
}
|
|
50916
51186
|
}
|
|
50917
|
-
function drawOnAxes(settings, theme, itemSpace) {
|
|
50918
|
-
const {
|
|
50919
|
-
const range = settings
|
|
50920
|
-
|
|
50921
|
-
|
|
50922
|
-
getMaximumValue(item),
|
|
50923
|
-
]), settings.maxValue)
|
|
50924
|
-
: getAxisRange(items, settings.maxValue, settings.axisIncrement);
|
|
50925
|
-
const itemTextAxis = getItemTextAxis(settings);
|
|
50926
|
-
const categoryAxis = Object.assign(Object.assign(Object.assign({}, getCategoryAxis(settings)), { axisLabel: Object.assign({ show: settings.displayItemText, color: theme.textColor }, (itemTextAxis &&
|
|
51187
|
+
function drawOnAxes(settings, grid, theme, itemSpace) {
|
|
51188
|
+
const { orientation } = settings;
|
|
51189
|
+
const range = getValueRange(settings, grid);
|
|
51190
|
+
const itemTextAxis = getItemTextAxis(settings, grid);
|
|
51191
|
+
const categoryAxis = Object.assign(Object.assign(Object.assign({}, getCategoryAxis(settings, grid)), { axisLabel: Object.assign({ show: settings.displayItemText, color: theme.textColor }, (itemTextAxis &&
|
|
50927
51192
|
itemSpace &&
|
|
50928
51193
|
getItemTextLayout(itemTextAxis, itemSpace))), axisTick: hidden, axisLine: { lineStyle: { color: theme.axisLineColor } } }), getAxisName(settings, settings.itemsLabel, theme));
|
|
50929
51194
|
const valueAxis = getValueAxis(range, getAxisName(settings, settings.valuesLabel, theme), settings, theme);
|
|
50930
|
-
const { series,
|
|
51195
|
+
const { series, seriesIndexes, partsOfSeries } = getAxisSeries(settings, grid, theme);
|
|
50931
51196
|
const option = {
|
|
50932
51197
|
grid: getGrid(theme),
|
|
50933
51198
|
xAxis: orientation === 'landscape' ? categoryAxis : valueAxis,
|
|
50934
51199
|
yAxis: orientation === 'landscape' ? valueAxis : categoryAxis,
|
|
50935
51200
|
series: series,
|
|
50936
51201
|
};
|
|
51202
|
+
const hasColumns = settings.type !== 'bar' && !settings.series;
|
|
50937
51203
|
return {
|
|
50938
|
-
|
|
51204
|
+
seriesIndexes: seriesIndexes,
|
|
51205
|
+
partsOfSeries: partsOfSeries,
|
|
50939
51206
|
itemsAreSeries: false,
|
|
50940
51207
|
itemTextAxis: itemTextAxis,
|
|
50941
|
-
|
|
51208
|
+
valueRange: range,
|
|
51209
|
+
option: hasColumns ? withColumns(option, settings, grid) : option,
|
|
50942
51210
|
};
|
|
50943
51211
|
}
|
|
50944
|
-
function
|
|
51212
|
+
function getValueRange(settings, grid) {
|
|
51213
|
+
const items = getAxisItems(grid, Boolean(settings.stacked));
|
|
51214
|
+
if (settings.valueFormat === 'date') {
|
|
51215
|
+
return getDateRange(items.flatMap((item) => [
|
|
51216
|
+
getMinimumValue(item),
|
|
51217
|
+
getMaximumValue(item),
|
|
51218
|
+
]), settings.maxValue);
|
|
51219
|
+
}
|
|
51220
|
+
return getAxisRange(items, settings.maxValue, settings.axisIncrement);
|
|
51221
|
+
}
|
|
51222
|
+
function getCategoryAxis(settings, grid) {
|
|
50945
51223
|
return {
|
|
50946
51224
|
type: 'category',
|
|
50947
|
-
data:
|
|
51225
|
+
data: grid.categories,
|
|
50948
51226
|
inverse: settings.orientation === 'portrait',
|
|
50949
51227
|
};
|
|
50950
51228
|
}
|
|
50951
|
-
function getItemTextAxis(settings) {
|
|
50952
|
-
if (!settings.displayItemText ||
|
|
51229
|
+
function getItemTextAxis(settings, grid) {
|
|
51230
|
+
if (!settings.displayItemText || grid.categories.length < 2) {
|
|
50953
51231
|
return;
|
|
50954
51232
|
}
|
|
50955
51233
|
return settings.orientation === 'landscape' ? 'xAxis' : 'yAxis';
|
|
@@ -50958,9 +51236,9 @@ function getItemTextAxis(settings) {
|
|
|
50958
51236
|
// column across the whole plot that shows its tooltip and takes its clicks.
|
|
50959
51237
|
// The columns have axes of their own, so they are not laid out next to the
|
|
50960
51238
|
// bars that draw ranges.
|
|
50961
|
-
function withColumns(option, settings) {
|
|
51239
|
+
function withColumns(option, settings, grid) {
|
|
50962
51240
|
const { items, orientation } = settings;
|
|
50963
|
-
const categoryAxis = Object.assign(Object.assign({}, getCategoryAxis(settings)), { show: false });
|
|
51241
|
+
const categoryAxis = Object.assign(Object.assign({}, getCategoryAxis(settings, grid)), { show: false });
|
|
50964
51242
|
const valueAxis = { type: 'value', min: 0, max: 1, show: false };
|
|
50965
51243
|
const columns = {
|
|
50966
51244
|
type: 'bar',
|
|
@@ -50975,78 +51253,140 @@ function withColumns(option, settings) {
|
|
|
50975
51253
|
const landscape = orientation === 'landscape';
|
|
50976
51254
|
return Object.assign(Object.assign({}, option), { xAxis: [option.xAxis, landscape ? categoryAxis : valueAxis], yAxis: [option.yAxis, landscape ? valueAxis : categoryAxis], series: [...option.series, columns] });
|
|
50977
51255
|
}
|
|
50978
|
-
function getAxisSeries(settings, theme) {
|
|
51256
|
+
function getAxisSeries(settings, grid, theme) {
|
|
51257
|
+
const series = [];
|
|
51258
|
+
const seriesIndexes = [];
|
|
51259
|
+
const partsOfSeries = [];
|
|
51260
|
+
for (const index of grid.series.keys()) {
|
|
51261
|
+
const drawn = drawItemSeries(settings, grid, index, theme);
|
|
51262
|
+
seriesIndexes.push(series.length + drawn.seriesIndex);
|
|
51263
|
+
series.push(...drawn.series);
|
|
51264
|
+
partsOfSeries.push(...drawn.series.map(() => index));
|
|
51265
|
+
}
|
|
51266
|
+
return {
|
|
51267
|
+
series: series,
|
|
51268
|
+
seriesIndexes: seriesIndexes,
|
|
51269
|
+
partsOfSeries: partsOfSeries,
|
|
51270
|
+
};
|
|
51271
|
+
}
|
|
51272
|
+
function drawItemSeries(settings, grid, index, theme) {
|
|
51273
|
+
const series = grid.series[index];
|
|
50979
51274
|
if (settings.type === 'line' || settings.type === 'area') {
|
|
50980
|
-
return getLineSeries(settings, theme);
|
|
51275
|
+
return getLineSeries(settings, series, index, theme);
|
|
50981
51276
|
}
|
|
50982
51277
|
if (settings.type === 'dot') {
|
|
50983
|
-
return getDotSeries(settings, theme);
|
|
51278
|
+
return getDotSeries(settings, series, index, theme);
|
|
50984
51279
|
}
|
|
50985
|
-
|
|
51280
|
+
if (settings.stacked) {
|
|
51281
|
+
return {
|
|
51282
|
+
series: [getStackedBars(settings, grid, index, theme)],
|
|
51283
|
+
seriesIndex: 0,
|
|
51284
|
+
};
|
|
51285
|
+
}
|
|
51286
|
+
return getBarSeries(settings, series, index, theme);
|
|
50986
51287
|
}
|
|
50987
|
-
function
|
|
50988
|
-
const
|
|
51288
|
+
function getStackedBars(settings, grid, index, theme) {
|
|
51289
|
+
const series = grid.series[index];
|
|
51290
|
+
return Object.assign(Object.assign({ type: 'bar' }, SERIES_STACK), { data: series.items.map((item, category) => item
|
|
51291
|
+
? {
|
|
51292
|
+
value: getValueSpan(item),
|
|
51293
|
+
itemStyle: {
|
|
51294
|
+
color: item.color,
|
|
51295
|
+
borderRadius: endsStack(grid, {
|
|
51296
|
+
series: index,
|
|
51297
|
+
index: category,
|
|
51298
|
+
})
|
|
51299
|
+
? getOuterCorners(settings, item, theme)
|
|
51300
|
+
: 0,
|
|
51301
|
+
borderColor: theme.dividerColor,
|
|
51302
|
+
borderWidth: 1,
|
|
51303
|
+
},
|
|
51304
|
+
}
|
|
51305
|
+
: null), label: Object.assign(Object.assign({}, getValueLabel(settings, series, theme)), { position: 'inside', color: undefined }), cursor: getSeriesCursor(series.items), emphasis: emphasis, blur: blur });
|
|
51306
|
+
}
|
|
51307
|
+
function getOuterCorners(settings, item, theme) {
|
|
51308
|
+
const [topLeft, topRight, bottomRight, bottomLeft] = theme.itemBorderRadius;
|
|
51309
|
+
const positive = getValueSpan(item) >= 0;
|
|
51310
|
+
if (settings.orientation === 'portrait') {
|
|
51311
|
+
return positive
|
|
51312
|
+
? [0, topRight, bottomRight, 0]
|
|
51313
|
+
: [topLeft, 0, 0, bottomLeft];
|
|
51314
|
+
}
|
|
51315
|
+
return positive
|
|
51316
|
+
? [topLeft, topRight, 0, 0]
|
|
51317
|
+
: [0, 0, bottomRight, bottomLeft];
|
|
51318
|
+
}
|
|
51319
|
+
function getBarSeries(settings, series, index, theme) {
|
|
51320
|
+
const { items } = series;
|
|
50989
51321
|
const bars = {
|
|
50990
51322
|
type: 'bar',
|
|
50991
|
-
data: items.map((item) =>
|
|
50992
|
-
|
|
50993
|
-
|
|
50994
|
-
|
|
50995
|
-
|
|
50996
|
-
|
|
50997
|
-
|
|
50998
|
-
|
|
51323
|
+
data: items.map((item) => item
|
|
51324
|
+
? {
|
|
51325
|
+
value: getValueSpan(item),
|
|
51326
|
+
itemStyle: {
|
|
51327
|
+
color: item.color,
|
|
51328
|
+
borderRadius: theme.itemBorderRadius,
|
|
51329
|
+
},
|
|
51330
|
+
}
|
|
51331
|
+
: null),
|
|
51332
|
+
label: getValueLabel(settings, series, theme),
|
|
50999
51333
|
cursor: getSeriesCursor(items),
|
|
51000
51334
|
emphasis: emphasis,
|
|
51001
51335
|
blur: blur,
|
|
51002
51336
|
};
|
|
51003
|
-
if (
|
|
51337
|
+
if (!hasRanges(items)) {
|
|
51004
51338
|
return { series: [bars], seriesIndex: 0 };
|
|
51005
51339
|
}
|
|
51006
51340
|
return {
|
|
51007
51341
|
series: [
|
|
51008
|
-
Object.assign(Object.assign({ type: 'bar' },
|
|
51009
|
-
Object.assign(Object.assign({}, bars),
|
|
51342
|
+
Object.assign(Object.assign({ type: 'bar' }, getRangeBase(index)), { data: getRangeStarts(items) }),
|
|
51343
|
+
Object.assign(Object.assign({}, bars), getRangeStack(index)),
|
|
51010
51344
|
],
|
|
51011
51345
|
seriesIndex: 1,
|
|
51012
51346
|
};
|
|
51013
51347
|
}
|
|
51014
|
-
function getDotSeries(settings, theme) {
|
|
51015
|
-
const { items
|
|
51016
|
-
const
|
|
51348
|
+
function getDotSeries(settings, series, index, theme) {
|
|
51349
|
+
const { items } = series;
|
|
51350
|
+
const { orientation } = settings;
|
|
51351
|
+
const point = (category, value) => orientation === 'landscape' ? [category, value] : [value, category];
|
|
51017
51352
|
const ends = {
|
|
51018
51353
|
type: 'scatter',
|
|
51019
51354
|
symbolSize: DOT_SIZE,
|
|
51020
|
-
data: items.map((item,
|
|
51021
|
-
|
|
51022
|
-
|
|
51023
|
-
|
|
51024
|
-
|
|
51355
|
+
data: items.map((item, category) => item
|
|
51356
|
+
? {
|
|
51357
|
+
value: point(category, getMaximumValue(item)),
|
|
51358
|
+
itemStyle: { color: item.color },
|
|
51359
|
+
}
|
|
51360
|
+
: null),
|
|
51361
|
+
label: getValueLabel(settings, series, theme),
|
|
51025
51362
|
cursor: getSeriesCursor(items),
|
|
51026
51363
|
emphasis: emphasis,
|
|
51027
51364
|
blur: blur,
|
|
51028
51365
|
};
|
|
51029
|
-
if (
|
|
51366
|
+
if (!hasRanges(items)) {
|
|
51030
51367
|
return { series: [ends], seriesIndex: 0 };
|
|
51031
51368
|
}
|
|
51032
|
-
const connectors = Object.assign(Object.assign({ type: 'bar' },
|
|
51033
|
-
|
|
51034
|
-
|
|
51035
|
-
|
|
51369
|
+
const connectors = Object.assign(Object.assign({ type: 'bar' }, getRangeStack(index)), { cursor: getSeriesCursor(items), emphasis: { disabled: true }, barWidth: CONNECTOR_WIDTH, barGap: '-100%', data: items.map((item) => item && isRangeItem(item)
|
|
51370
|
+
? {
|
|
51371
|
+
value: getValueSpan(item),
|
|
51372
|
+
itemStyle: { color: item.color },
|
|
51373
|
+
}
|
|
51374
|
+
: null) });
|
|
51036
51375
|
const starts = {
|
|
51037
51376
|
type: 'scatter',
|
|
51038
|
-
|
|
51377
|
+
cursor: getSeriesCursor(items),
|
|
51378
|
+
emphasis: { disabled: true },
|
|
51039
51379
|
symbolSize: DOT_SIZE,
|
|
51040
|
-
data: items.map((item,
|
|
51041
|
-
|
|
51042
|
-
|
|
51043
|
-
:
|
|
51044
|
-
|
|
51045
|
-
|
|
51380
|
+
data: items.map((item, category) => item && isRangeItem(item)
|
|
51381
|
+
? {
|
|
51382
|
+
value: point(category, getMinimumValue(item)),
|
|
51383
|
+
itemStyle: { color: item.color },
|
|
51384
|
+
}
|
|
51385
|
+
: null),
|
|
51046
51386
|
};
|
|
51047
51387
|
return {
|
|
51048
51388
|
series: [
|
|
51049
|
-
Object.assign(Object.assign({ type: 'bar' },
|
|
51389
|
+
Object.assign(Object.assign({ type: 'bar' }, getRangeBase(index)), { barGap: '-100%', data: getRangeStarts(items) }),
|
|
51050
51390
|
connectors,
|
|
51051
51391
|
starts,
|
|
51052
51392
|
ends,
|
|
@@ -51054,38 +51394,63 @@ function getDotSeries(settings, theme) {
|
|
|
51054
51394
|
seriesIndex: 3,
|
|
51055
51395
|
};
|
|
51056
51396
|
}
|
|
51057
|
-
function getLineSeries(settings, theme) {
|
|
51058
|
-
|
|
51059
|
-
const
|
|
51397
|
+
function getLineSeries(settings, series, index, theme) {
|
|
51398
|
+
var _a;
|
|
51399
|
+
const { items } = series;
|
|
51400
|
+
const color = (_a = series.color) !== null && _a !== void 0 ? _a : theme.lineColor;
|
|
51060
51401
|
const area = settings.type === 'area';
|
|
51061
|
-
const line = {
|
|
51062
|
-
|
|
51063
|
-
|
|
51064
|
-
|
|
51065
|
-
|
|
51066
|
-
|
|
51067
|
-
|
|
51068
|
-
|
|
51069
|
-
|
|
51070
|
-
|
|
51071
|
-
|
|
51072
|
-
|
|
51073
|
-
|
|
51074
|
-
|
|
51075
|
-
}
|
|
51076
|
-
if (
|
|
51402
|
+
const line = Object.assign(Object.assign({ type: 'line', color: color, symbol: 'circle', symbolSize: LINE_DOT_SIZE }, (settings.series &&
|
|
51403
|
+
hasClickableItems(items) && {
|
|
51404
|
+
showAllSymbol: true,
|
|
51405
|
+
labelLayout: { hideOverlap: true },
|
|
51406
|
+
})), { data: items.map((item) => item
|
|
51407
|
+
? {
|
|
51408
|
+
value: getValueSpan(item),
|
|
51409
|
+
itemStyle: { color: item.color },
|
|
51410
|
+
}
|
|
51411
|
+
: null), areaStyle: area
|
|
51412
|
+
? { color: color, opacity: getAreaOpacity(settings) }
|
|
51413
|
+
: undefined, label: getValueLabel(settings, series, theme), cursor: getSeriesCursor(items), emphasis: emphasis, blur: blur });
|
|
51414
|
+
if (settings.stacked) {
|
|
51415
|
+
return { series: [Object.assign(Object.assign({}, line), SERIES_STACK)], seriesIndex: 0 };
|
|
51416
|
+
}
|
|
51417
|
+
if (!hasRanges(items)) {
|
|
51077
51418
|
return { series: [line], seriesIndex: 0 };
|
|
51078
51419
|
}
|
|
51079
|
-
const base = Object.assign(Object.assign({ type: 'line' },
|
|
51080
|
-
return {
|
|
51420
|
+
const base = Object.assign(Object.assign({ type: 'line' }, getRangeBase(index)), { symbol: 'none', color: color, lineStyle: { opacity: area ? 0 : 1 }, data: getRangeStarts(items) });
|
|
51421
|
+
return {
|
|
51422
|
+
series: [base, Object.assign(Object.assign({}, line), getRangeStack(index))],
|
|
51423
|
+
seriesIndex: 1,
|
|
51424
|
+
};
|
|
51425
|
+
}
|
|
51426
|
+
function getAreaOpacity(settings) {
|
|
51427
|
+
var _a;
|
|
51428
|
+
return ((_a = settings.series) === null || _a === void 0 ? void 0 : _a.length) > 1 && !settings.stacked
|
|
51429
|
+
? SERIES_AREA_OPACITY
|
|
51430
|
+
: AREA_OPACITY;
|
|
51431
|
+
}
|
|
51432
|
+
function hasClickableItems(items) {
|
|
51433
|
+
return items.some((item) => item === null || item === void 0 ? void 0 : item.clickable);
|
|
51434
|
+
}
|
|
51435
|
+
function hasRanges(items) {
|
|
51436
|
+
return items.some((item) => item && isRangeItem(item));
|
|
51081
51437
|
}
|
|
51082
|
-
const stacked = { stack: 'range', stackStrategy: 'all' };
|
|
51083
51438
|
// A range is drawn as a stack of an invisible part from zero to its start,
|
|
51084
51439
|
// and a visible part from its start to its end. Items that are not ranges
|
|
51085
|
-
// start at zero.
|
|
51086
|
-
|
|
51440
|
+
// start at zero. Each series has a stack of its own.
|
|
51441
|
+
function getRangeStack(index) {
|
|
51442
|
+
return { stack: `range${index}`, stackStrategy: 'all' };
|
|
51443
|
+
}
|
|
51444
|
+
function getRangeBase(index) {
|
|
51445
|
+
return Object.assign(Object.assign({}, getRangeStack(index)), { silent: true, tooltip: hidden, emphasis: { disabled: true }, itemStyle: { color: 'transparent' } });
|
|
51446
|
+
}
|
|
51087
51447
|
function getRangeStarts(items) {
|
|
51088
|
-
return items.map((item) =>
|
|
51448
|
+
return items.map((item) => {
|
|
51449
|
+
if (!item) {
|
|
51450
|
+
return null;
|
|
51451
|
+
}
|
|
51452
|
+
return isRangeItem(item) ? getMinimumValue(item) : 0;
|
|
51453
|
+
});
|
|
51089
51454
|
}
|
|
51090
51455
|
function drawScatter(settings, theme) {
|
|
51091
51456
|
const { items } = settings;
|
|
@@ -51115,7 +51480,7 @@ function drawScatter(settings, theme) {
|
|
|
51115
51480
|
blur: blur,
|
|
51116
51481
|
};
|
|
51117
51482
|
return {
|
|
51118
|
-
|
|
51483
|
+
seriesIndexes: [0],
|
|
51119
51484
|
itemsAreSeries: false,
|
|
51120
51485
|
option: {
|
|
51121
51486
|
grid: getGrid(theme),
|
|
@@ -51144,7 +51509,7 @@ function drawPie(settings, theme) {
|
|
|
51144
51509
|
}
|
|
51145
51510
|
const innerRadius = settings.type === 'doughnut' ? '50%' : 0;
|
|
51146
51511
|
return {
|
|
51147
|
-
|
|
51512
|
+
seriesIndexes: [0],
|
|
51148
51513
|
itemsAreSeries: false,
|
|
51149
51514
|
option: {
|
|
51150
51515
|
series: [
|
|
@@ -51179,7 +51544,7 @@ function drawProportionBar(settings, theme) {
|
|
|
51179
51544
|
const categoryAxis = { type: 'category', data: [''], show: false };
|
|
51180
51545
|
const landscape = settings.orientation === 'landscape';
|
|
51181
51546
|
return {
|
|
51182
|
-
|
|
51547
|
+
seriesIndexes: [0],
|
|
51183
51548
|
itemsAreSeries: true,
|
|
51184
51549
|
option: {
|
|
51185
51550
|
backgroundColor: theme.backgroundColor,
|
|
@@ -51208,7 +51573,7 @@ function drawRing(settings, theme) {
|
|
|
51208
51573
|
const { items } = settings;
|
|
51209
51574
|
const whole = getWholeRange(items, settings.maxValue).totalRange;
|
|
51210
51575
|
return {
|
|
51211
|
-
|
|
51576
|
+
seriesIndexes: [0],
|
|
51212
51577
|
itemsAreSeries: false,
|
|
51213
51578
|
option: {
|
|
51214
51579
|
polar: { radius: ['20%', '90%'] },
|
|
@@ -51245,7 +51610,7 @@ function drawRing(settings, theme) {
|
|
|
51245
51610
|
function drawNps(settings, theme) {
|
|
51246
51611
|
const { items } = settings;
|
|
51247
51612
|
return {
|
|
51248
|
-
|
|
51613
|
+
seriesIndexes: [0],
|
|
51249
51614
|
itemsAreSeries: false,
|
|
51250
51615
|
option: {
|
|
51251
51616
|
series: [
|
|
@@ -51334,8 +51699,8 @@ function getAxisName(settings, name, theme) {
|
|
|
51334
51699
|
nameTextStyle: { color: theme.textColor },
|
|
51335
51700
|
};
|
|
51336
51701
|
}
|
|
51337
|
-
function getValueLabel(settings, theme) {
|
|
51338
|
-
return Object.assign(Object.assign({ show: settings.displayItemValue, position: settings.orientation === 'landscape' ? 'top' : 'right' }, getLabelStyle(theme)), { formatter: ({ dataIndex }) => formatValue(
|
|
51702
|
+
function getValueLabel(settings, series, theme) {
|
|
51703
|
+
return Object.assign(Object.assign({ show: settings.displayItemValue, position: settings.orientation === 'landscape' ? 'top' : 'right' }, getLabelStyle(theme)), { formatter: ({ dataIndex }) => formatValue(series.items[dataIndex], settings) });
|
|
51339
51704
|
}
|
|
51340
51705
|
function getLabelStyle(theme) {
|
|
51341
51706
|
return { color: theme.textColor, textBorderWidth: 0 };
|
|
@@ -51351,7 +51716,7 @@ function getPointLabel(settings, item) {
|
|
|
51351
51716
|
return parts.join(' ');
|
|
51352
51717
|
}
|
|
51353
51718
|
function getSeriesCursor(items) {
|
|
51354
|
-
return getCursor(items
|
|
51719
|
+
return getCursor(hasClickableItems(items));
|
|
51355
51720
|
}
|
|
51356
51721
|
function getCursor(clickable) {
|
|
51357
51722
|
return clickable ? 'pointer' : 'default';
|
|
@@ -51503,9 +51868,18 @@ function paintToRgba(context, color) {
|
|
|
51503
51868
|
return `rgba(${red}, ${green}, ${blue}, ${alpha / MAX_CHANNEL})`;
|
|
51504
51869
|
}
|
|
51505
51870
|
|
|
51506
|
-
const chartCss = () => `@charset "UTF-8";:host(limel-chart){--limel-chart-item-color:var( --chart-item-color, rgb(var(--contrast-1100), 0.8) );--limel-chart-axis-line-color:var( --chart-axis-line-color, rgb(var(--contrast-900), 0.4) );--limel-chart-background-color:var(--chart-background-color, transparent);--limel-chart-item-divider-color:var( --chart-item-divider-color, rgb(var(--contrast-100), 0.6) );--limel-chart-item-border-radius:var(--chart-item-border-radius, 0);--limel-chart-scatter-item-size:var(--chart-scatter-item-size, 0.5rem);--limel-chart-text-color:rgb(var(--contrast-1000));--limel-chart-line-color:rgb(var(--contrast-900));--limel-chart-surface-color:rgb(var(--contrast-100));--limel-chart-nps-detractors-color:rgb(var(--color-coral-default));--limel-chart-nps-passives-color:rgb(var(--color-amber-light));--limel-chart-nps-good-color:rgb(var(--color-lime-light));--limel-chart-nps-excellent-color:rgb(var(--color-lime-default));box-sizing:border-box;position:relative;display:flex;width:100%;height:100%;min-width:0;min-height:0}:host(limel-chart[type=bar]){--limel-chart-item-border-radius:var(--chart-item-border-radius, 0.125rem)}:host(limel-chart[type=proportion-bar]),:host(limel-chart[type=stacked-bar]){--limel-chart-background-color:var( --chart-background-color, rgb(var(--contrast-800), 0.2) )}:host(limel-chart[type=proportion-bar][orientation=landscape]),:host(limel-chart[type=proportion-bar][orientation=landscape]) .plot,:host(limel-chart[type=stacked-bar][orientation=landscape]),:host(limel-chart[type=stacked-bar][orientation=landscape]) .plot{min-height:0.5rem}:host(limel-chart[type=proportion-bar][orientation=portrait]),:host(limel-chart[type=proportion-bar][orientation=portrait]) .plot,:host(limel-chart[type=stacked-bar][orientation=portrait]),:host(limel-chart[type=stacked-bar][orientation=portrait]) .plot{min-width:0.5rem}:host(limel-chart[type=pie]),:host(limel-chart[type=doughnut]),:host(limel-chart[type=ring]){--limel-chart-background-color:var( --chart-background-color, rgb(var(--contrast-200)) )}:host(limel-chart[type=nps]){--limel-chart-background-color:var( --chart-background-color, rgb(var(--contrast-100)) )}:host(limel-chart[type=pie]),:host(limel-chart[type=doughnut]),:host(limel-chart[type=ring]),:host(limel-chart[type=nps]){aspect-ratio:1}:host(limel-chart[type=bar][data-fallback-height]),:host(limel-chart[type=dot][data-fallback-height]),:host(limel-chart[type=line][data-fallback-height]),:host(limel-chart[type=area][data-fallback-height]),:host(limel-chart[type=scatter][data-fallback-height]){aspect-ratio:2}.plot{flex-grow:1;contain:size}:host(limel-chart[type=proportion-bar]) .plot,:host(limel-chart[type=stacked-bar]) .plot{border-radius:0.25rem;overflow:hidden}table{position:absolute;width:0;height:0;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0, 0, 0, 0);clip-path:inset(50%);white-space:nowrap}limel-spinner{margin:auto}`;
|
|
51871
|
+
const chartCss = () => `@charset "UTF-8";:host(limel-chart){--limel-chart-item-color:var( --chart-item-color, rgb(var(--contrast-1100), 0.8) );--limel-chart-axis-line-color:var( --chart-axis-line-color, rgb(var(--contrast-900), 0.4) );--limel-chart-background-color:var(--chart-background-color, transparent);--limel-chart-item-divider-color:var( --chart-item-divider-color, rgb(var(--contrast-100), 0.6) );--limel-chart-item-border-radius:var(--chart-item-border-radius, 0);--limel-chart-scatter-item-size:var(--chart-scatter-item-size, 0.5rem);--limel-chart-text-color:rgb(var(--contrast-1000));--limel-chart-line-color:rgb(var(--contrast-900));--limel-chart-surface-color:rgb(var(--contrast-100));--limel-chart-nps-detractors-color:rgb(var(--color-coral-default));--limel-chart-nps-passives-color:rgb(var(--color-amber-light));--limel-chart-nps-good-color:rgb(var(--color-lime-light));--limel-chart-nps-excellent-color:rgb(var(--color-lime-default));--limel-chart-series-color-1:rgb(var(--color-blue-default));--limel-chart-series-color-2:rgb(var(--color-coral-default));--limel-chart-series-color-3:rgb(var(--color-teal-default));--limel-chart-series-color-4:rgb(var(--color-amber-default));--limel-chart-series-color-5:rgb(var(--color-magenta-default));--limel-chart-series-color-6:rgb(var(--color-green-default));--limel-chart-series-color-7:rgb(var(--color-violet-default));--limel-chart-series-color-8:rgb(var(--color-red-default));box-sizing:border-box;position:relative;display:flex;flex-direction:column;width:100%;height:100%;min-width:0;min-height:0}:host(limel-chart[type=bar]){--limel-chart-item-border-radius:var(--chart-item-border-radius, 0.125rem)}:host(limel-chart[type=proportion-bar]),:host(limel-chart[type=stacked-bar]){--limel-chart-background-color:var( --chart-background-color, rgb(var(--contrast-800), 0.2) )}:host(limel-chart[type=proportion-bar][orientation=landscape]),:host(limel-chart[type=proportion-bar][orientation=landscape]) .plot,:host(limel-chart[type=stacked-bar][orientation=landscape]),:host(limel-chart[type=stacked-bar][orientation=landscape]) .plot{min-height:0.5rem}:host(limel-chart[type=proportion-bar][orientation=portrait]),:host(limel-chart[type=proportion-bar][orientation=portrait]) .plot,:host(limel-chart[type=stacked-bar][orientation=portrait]),:host(limel-chart[type=stacked-bar][orientation=portrait]) .plot{min-width:0.5rem}:host(limel-chart[type=pie]),:host(limel-chart[type=doughnut]),:host(limel-chart[type=ring]){--limel-chart-background-color:var( --chart-background-color, rgb(var(--contrast-200)) )}:host(limel-chart[type=nps]){--limel-chart-background-color:var( --chart-background-color, rgb(var(--contrast-100)) )}:host(limel-chart[type=pie]),:host(limel-chart[type=doughnut]),:host(limel-chart[type=ring]),:host(limel-chart[type=nps]){aspect-ratio:1}:host(limel-chart[type=bar][data-fallback-height]),:host(limel-chart[type=dot][data-fallback-height]),:host(limel-chart[type=line][data-fallback-height]),:host(limel-chart[type=area][data-fallback-height]),:host(limel-chart[type=scatter][data-fallback-height]){aspect-ratio:2}.plot{flex-grow:1;contain:size}ul{display:flex;flex-wrap:wrap;gap:0.25rem 0.875rem;margin:0 0 0.5rem 0;padding:0;list-style:none;font-size:0.75rem;color:rgb(var(--contrast-1100))}li{display:inline-flex;align-items:center;gap:0.375rem}li>span{flex-shrink:0}:host(limel-chart[type=proportion-bar]) .plot,:host(limel-chart[type=stacked-bar]) .plot{border-radius:0.25rem;overflow:hidden}table{position:absolute;width:0;height:0;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0, 0, 0, 0);clip-path:inset(50%);white-space:nowrap}limel-spinner{margin:auto}`;
|
|
51507
51872
|
|
|
51508
51873
|
const orientations = ['horizontal', 'vertical'];
|
|
51874
|
+
const SERIES_COLOR_COUNT = 8;
|
|
51875
|
+
const getDefaultSeriesColor = (index) => `var(--limel-chart-series-color-${(index % SERIES_COLOR_COUNT) + 1})`;
|
|
51876
|
+
const copyItem = (item) => ({
|
|
51877
|
+
text: item.text,
|
|
51878
|
+
value: item.value,
|
|
51879
|
+
formattedValue: item.formattedValue,
|
|
51880
|
+
color: item.color,
|
|
51881
|
+
clickable: item.clickable,
|
|
51882
|
+
});
|
|
51509
51883
|
const extensions = [
|
|
51510
51884
|
install$9,
|
|
51511
51885
|
install$5,
|
|
@@ -51552,6 +51926,15 @@ const Chart = class {
|
|
|
51552
51926
|
* Applies to `proportion-bar`, `pie`, `doughnut`, and `ring` charts.
|
|
51553
51927
|
*/
|
|
51554
51928
|
this.displayItemPercentage = true;
|
|
51929
|
+
/**
|
|
51930
|
+
* Stacks the `series` on each other, so that each place on the axis
|
|
51931
|
+
* shows their total, such as the revenue of each product, which adds up
|
|
51932
|
+
* to the revenue of the month. Positive and negative values are stacked
|
|
51933
|
+
* on their own side of zero, and a range adds its extent to the stack.
|
|
51934
|
+
* Applies to `bar`, `line`, and `area` charts, but not when
|
|
51935
|
+
* `valueFormat` is `date`.
|
|
51936
|
+
*/
|
|
51937
|
+
this.stacked = false;
|
|
51555
51938
|
/**
|
|
51556
51939
|
* Defines how items are visualized in the chart.
|
|
51557
51940
|
* `stacked-bar` is the old name of `proportion-bar`. It still works, but
|
|
@@ -51580,7 +51963,9 @@ const Chart = class {
|
|
|
51580
51963
|
/**
|
|
51581
51964
|
* The item that last had focus, which is the one that Tab returns to.
|
|
51582
51965
|
*/
|
|
51583
|
-
this.
|
|
51966
|
+
this.focusedPosition = { series: 0, index: 0 };
|
|
51967
|
+
this.grid = { categories: [], series: [] };
|
|
51968
|
+
this.seriesColors = [];
|
|
51584
51969
|
this.themeMayHaveChanged = false;
|
|
51585
51970
|
this.warnings = new Map();
|
|
51586
51971
|
this.invalidColors = new Set();
|
|
@@ -51599,7 +51984,7 @@ const Chart = class {
|
|
|
51599
51984
|
if (!this.drawing) {
|
|
51600
51985
|
return;
|
|
51601
51986
|
}
|
|
51602
|
-
const item = this.getClickableItem(
|
|
51987
|
+
const item = this.getClickableItem(this.getClickedPosition(event));
|
|
51603
51988
|
if (!item) {
|
|
51604
51989
|
return;
|
|
51605
51990
|
}
|
|
@@ -51613,7 +51998,7 @@ const Chart = class {
|
|
|
51613
51998
|
this.highlightItemAt(event, false);
|
|
51614
51999
|
};
|
|
51615
52000
|
this.handleClick = (event) => {
|
|
51616
|
-
const item = this.getClickableItem(this.
|
|
52001
|
+
const item = this.getClickableItem(this.getEventPosition(event));
|
|
51617
52002
|
if (!item) {
|
|
51618
52003
|
return;
|
|
51619
52004
|
}
|
|
@@ -51624,13 +52009,13 @@ const Chart = class {
|
|
|
51624
52009
|
const orientation = orientations.find((option) => isNavigationKey(event, { orientation: option }));
|
|
51625
52010
|
if (orientation) {
|
|
51626
52011
|
event.preventDefault();
|
|
51627
|
-
this.focusItem(
|
|
52012
|
+
this.focusItem(this.findTarget(event.key, this.getEventPosition(event), orientation));
|
|
51628
52013
|
return;
|
|
51629
52014
|
}
|
|
51630
52015
|
if (event.key !== 'Enter' && event.key !== ' ') {
|
|
51631
52016
|
return;
|
|
51632
52017
|
}
|
|
51633
|
-
const item = this.getClickableItem(this.
|
|
52018
|
+
const item = this.getClickableItem(this.getEventPosition(event));
|
|
51634
52019
|
if (!item) {
|
|
51635
52020
|
return;
|
|
51636
52021
|
}
|
|
@@ -51638,9 +52023,9 @@ const Chart = class {
|
|
|
51638
52023
|
this.interact.emit(item);
|
|
51639
52024
|
};
|
|
51640
52025
|
this.handleFocus = (event) => {
|
|
51641
|
-
const
|
|
51642
|
-
this.
|
|
51643
|
-
this.showItem(
|
|
52026
|
+
const element = event.currentTarget;
|
|
52027
|
+
this.focusedPosition = this.getPosition(element);
|
|
52028
|
+
this.showItem(element, true);
|
|
51644
52029
|
};
|
|
51645
52030
|
this.handleBlur = (event) => {
|
|
51646
52031
|
this.showItem(event.currentTarget, false);
|
|
@@ -51650,10 +52035,17 @@ const Chart = class {
|
|
|
51650
52035
|
this.warnAboutOldTypeName();
|
|
51651
52036
|
}
|
|
51652
52037
|
componentWillRender() {
|
|
52038
|
+
this.grid = getSeriesGrid({
|
|
52039
|
+
type: this.chartType,
|
|
52040
|
+
items: this.items,
|
|
52041
|
+
series: this.series,
|
|
52042
|
+
});
|
|
51653
52043
|
this.warnOnChange('axisIncrement', this.getAxisIncrementWarning());
|
|
51654
52044
|
this.warnOnChange('language', this.getLanguageWarning());
|
|
51655
52045
|
this.warnOnChange('currency', this.getCurrencyWarning());
|
|
51656
52046
|
this.warnOnChange('items', this.getDateWarning());
|
|
52047
|
+
this.warnOnChange('series', this.getSeriesWarning());
|
|
52048
|
+
this.warnOnChange('stacked', this.getStackedWarning());
|
|
51657
52049
|
}
|
|
51658
52050
|
connectedCallback() {
|
|
51659
52051
|
this.draw();
|
|
@@ -51695,11 +52087,10 @@ const Chart = class {
|
|
|
51695
52087
|
return `limel-chart: \`currency\` must be a three-letter code such as \`SEK\` when \`valueFormat\` is \`currency\`, but was ${JSON.stringify(this.currency)}. Writing the values as numbers instead.`;
|
|
51696
52088
|
}
|
|
51697
52089
|
getDateWarning() {
|
|
51698
|
-
var _a;
|
|
51699
52090
|
if (this.valueFormat !== 'date') {
|
|
51700
52091
|
return;
|
|
51701
52092
|
}
|
|
51702
|
-
const wrong = (
|
|
52093
|
+
const wrong = getAllItems(this.grid)
|
|
51703
52094
|
.flatMap((item) => [item.value].flat())
|
|
51704
52095
|
.find((value) => !isDate(value));
|
|
51705
52096
|
if (wrong === undefined) {
|
|
@@ -51708,6 +52099,56 @@ const Chart = class {
|
|
|
51708
52099
|
const shown = typeof wrong === 'number' ? wrong : JSON.stringify(wrong);
|
|
51709
52100
|
return `limel-chart: with \`valueFormat\` \`date\`, each value must be a date in milliseconds since 1970, as \`Date.getTime()\` gives, but was ${shown}. Showing it as it is.`;
|
|
51710
52101
|
}
|
|
52102
|
+
getSeriesWarning() {
|
|
52103
|
+
var _a, _b, _c;
|
|
52104
|
+
if (!((_a = this.series) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
52105
|
+
return;
|
|
52106
|
+
}
|
|
52107
|
+
if (!canDrawSeries(this.chartType)) {
|
|
52108
|
+
const drawn = ((_b = this.items) === null || _b === void 0 ? void 0 : _b.length)
|
|
52109
|
+
? '`items`'
|
|
52110
|
+
: 'the items of the first series';
|
|
52111
|
+
return `limel-chart: \`series\` can only be drawn by \`bar\`, \`dot\`, \`line\`, and \`area\` charts, but \`type\` is \`${this.type}\`. Drawing ${drawn} instead.`;
|
|
52112
|
+
}
|
|
52113
|
+
if ((_c = this.items) === null || _c === void 0 ? void 0 : _c.length) {
|
|
52114
|
+
return 'limel-chart: both `items` and `series` are set. Drawing `series`, and leaving out `items`.';
|
|
52115
|
+
}
|
|
52116
|
+
}
|
|
52117
|
+
getStackedWarning() {
|
|
52118
|
+
if (!this.stacked) {
|
|
52119
|
+
return;
|
|
52120
|
+
}
|
|
52121
|
+
if (!canStack(this.chartType)) {
|
|
52122
|
+
return `limel-chart: \`stacked\` can only stack the series of \`bar\`, \`line\`, and \`area\` charts, but \`type\` is \`${this.type}\`. Ignoring \`stacked\`.`;
|
|
52123
|
+
}
|
|
52124
|
+
if (this.valueFormat === 'date') {
|
|
52125
|
+
return 'limel-chart: `stacked` cannot stack dates. Ignoring `stacked`.';
|
|
52126
|
+
}
|
|
52127
|
+
if (!this.drawsSeries) {
|
|
52128
|
+
return 'limel-chart: `stacked` stacks the `series` of a chart, but this chart has none. Ignoring `stacked`.';
|
|
52129
|
+
}
|
|
52130
|
+
}
|
|
52131
|
+
get stacksSeries() {
|
|
52132
|
+
return isStacked({
|
|
52133
|
+
type: this.chartType,
|
|
52134
|
+
series: this.series,
|
|
52135
|
+
stacked: this.stacked,
|
|
52136
|
+
valueFormat: this.valueFormat,
|
|
52137
|
+
});
|
|
52138
|
+
}
|
|
52139
|
+
get drawsSeries() {
|
|
52140
|
+
return Boolean(this.drawnSeries);
|
|
52141
|
+
}
|
|
52142
|
+
get drawnSeries() {
|
|
52143
|
+
return getDrawnSeries({ type: this.chartType, series: this.series });
|
|
52144
|
+
}
|
|
52145
|
+
get drawnItems() {
|
|
52146
|
+
return getDrawnItems({
|
|
52147
|
+
type: this.chartType,
|
|
52148
|
+
items: this.items,
|
|
52149
|
+
series: this.series,
|
|
52150
|
+
});
|
|
52151
|
+
}
|
|
51711
52152
|
get valueStyle() {
|
|
51712
52153
|
return {
|
|
51713
52154
|
type: this.chartType,
|
|
@@ -51720,7 +52161,6 @@ const Chart = class {
|
|
|
51720
52161
|
return this.type === 'stacked-bar' ? 'proportion-bar' : this.type;
|
|
51721
52162
|
}
|
|
51722
52163
|
getAxisIncrementWarning() {
|
|
51723
|
-
var _a;
|
|
51724
52164
|
const increment = this.axisIncrement;
|
|
51725
52165
|
if (increment === undefined ||
|
|
51726
52166
|
increment === null ||
|
|
@@ -51733,7 +52173,7 @@ const Chart = class {
|
|
|
51733
52173
|
if (!usesAxisIncrement(this.chartType)) {
|
|
51734
52174
|
return;
|
|
51735
52175
|
}
|
|
51736
|
-
const range = getAxisRange((
|
|
52176
|
+
const range = getAxisRange(getAxisItems(this.grid, this.stacksSeries), this.maxValue, increment);
|
|
51737
52177
|
if (range.increment !== increment) {
|
|
51738
52178
|
return `limel-chart: \`axisIncrement\` ${increment} would divide the axis into more than ${MAX_AXIS_STEPS} steps. Working out a step from the values instead.`;
|
|
51739
52179
|
}
|
|
@@ -51742,7 +52182,19 @@ const Chart = class {
|
|
|
51742
52182
|
if (this.loading) {
|
|
51743
52183
|
return h("limel-spinner", { limeBranded: false });
|
|
51744
52184
|
}
|
|
51745
|
-
return (h(Host, null, h("div", { class: "plot", "aria-hidden": "true", ref: this.setPlot }), h("table", { "aria-live": "polite" }, this.renderCaption(), this.renderTableHeader(), h("tbody", null, this.
|
|
52185
|
+
return (h(Host, null, this.renderLegend(), h("div", { class: "plot", "aria-hidden": "true", ref: this.setPlot }), h("table", { "aria-live": "polite" }, this.renderCaption(), this.renderTableHeader(), h("tbody", null, this.drawsSeries
|
|
52186
|
+
? this.renderCategories()
|
|
52187
|
+
: this.renderItems()))));
|
|
52188
|
+
}
|
|
52189
|
+
get hasLegend() {
|
|
52190
|
+
var _a, _b;
|
|
52191
|
+
return ((_b = (_a = this.drawnSeries) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 1;
|
|
52192
|
+
}
|
|
52193
|
+
renderLegend() {
|
|
52194
|
+
if (!this.hasLegend) {
|
|
52195
|
+
return;
|
|
52196
|
+
}
|
|
52197
|
+
return (h("ul", { "aria-hidden": "true" }, this.drawnSeries.map((series, index) => (h("li", null, h("span", { style: getSwatchStyle(this.chartType, this.seriesColors[index]) }), series.text)))));
|
|
51746
52198
|
}
|
|
51747
52199
|
renderCaption() {
|
|
51748
52200
|
if (!this.accessibleLabel) {
|
|
@@ -51751,7 +52203,18 @@ const Chart = class {
|
|
|
51751
52203
|
return h("caption", null, this.accessibleLabel);
|
|
51752
52204
|
}
|
|
51753
52205
|
renderTableHeader() {
|
|
51754
|
-
|
|
52206
|
+
var _a, _b;
|
|
52207
|
+
const columns = (_b = (_a = this.drawnSeries) === null || _a === void 0 ? void 0 : _a.map((series) => series.text)) !== null && _b !== void 0 ? _b : [
|
|
52208
|
+
this.valuesLabel,
|
|
52209
|
+
];
|
|
52210
|
+
return (h("thead", null, this.renderSeriesGroupHeader(), h("tr", null, h("th", { scope: "col" }, this.itemsLabel), columns.map((column) => (h("th", { scope: "col" }, column))))));
|
|
52211
|
+
}
|
|
52212
|
+
renderSeriesGroupHeader() {
|
|
52213
|
+
const allSeries = this.drawnSeries;
|
|
52214
|
+
if (!allSeries || !this.accessibleValuesLabel) {
|
|
52215
|
+
return;
|
|
52216
|
+
}
|
|
52217
|
+
return (h("tr", null, h("td", null), h("th", { scope: "col", colSpan: allSeries.length }, this.accessibleValuesLabel)));
|
|
51755
52218
|
}
|
|
51756
52219
|
get itemsLabel() {
|
|
51757
52220
|
var _a;
|
|
@@ -51762,13 +52225,46 @@ const Chart = class {
|
|
|
51762
52225
|
return ((_a = this.accessibleValuesLabel) !== null && _a !== void 0 ? _a : translations.get('value', this.language));
|
|
51763
52226
|
}
|
|
51764
52227
|
renderItems() {
|
|
51765
|
-
|
|
51766
|
-
const tabStop = findTabStop(
|
|
51767
|
-
return
|
|
52228
|
+
const items = this.drawnItems;
|
|
52229
|
+
const tabStop = findTabStop(items, this.focusedPosition.index);
|
|
52230
|
+
return items.map((item, index) => (h("tr", { "data-index": index, "aria-description": this.getRowDescription(index), tabIndex: index === tabStop ? 0 : -1, role: item.clickable ? 'button' : null, onClick: this.handleClick, onKeyDown: this.handleKeyDown, onFocus: this.handleFocus, onBlur: this.handleBlur }, h("td", null, item.text), h("td", null, formatValue(item, this.valueStyle)))));
|
|
51768
52231
|
}
|
|
51769
52232
|
getRowDescription(index) {
|
|
51770
|
-
const
|
|
51771
|
-
|
|
52233
|
+
const items = this.drawnItems;
|
|
52234
|
+
const label = getItemLabel(Object.assign(Object.assign({}, this.valueStyle), { items: items, maxValue: this.maxValue, displayItemPercentage: this.displayItemPercentage }), index);
|
|
52235
|
+
return label === items[index].text ? undefined : label;
|
|
52236
|
+
}
|
|
52237
|
+
renderCategories() {
|
|
52238
|
+
const grid = this.grid;
|
|
52239
|
+
const tabStop = this.findTabStopInGrid(grid);
|
|
52240
|
+
return grid.categories.map((category, index) => (h("tr", null, h("th", { scope: "row" }, category), grid.series.map((series, seriesIndex) => this.renderCell(series.items[index], { series: seriesIndex, index: index }, tabStop)))));
|
|
52241
|
+
}
|
|
52242
|
+
renderCell(item, position, tabStop) {
|
|
52243
|
+
if (!item) {
|
|
52244
|
+
return h("td", null);
|
|
52245
|
+
}
|
|
52246
|
+
const isTabStop = position.series === (tabStop === null || tabStop === void 0 ? void 0 : tabStop.series) &&
|
|
52247
|
+
position.index === (tabStop === null || tabStop === void 0 ? void 0 : tabStop.index);
|
|
52248
|
+
return (h("td", { "data-series": position.series, "data-index": position.index, tabIndex: isTabStop ? 0 : -1, role: item.clickable ? 'button' : undefined, "aria-label": item.clickable ? this.getButtonLabel(item, position) : null, onClick: this.handleClick, onKeyDown: this.handleKeyDown, onFocus: this.handleFocus, onBlur: this.handleBlur }, formatValue(item, this.valueStyle)));
|
|
52249
|
+
}
|
|
52250
|
+
getButtonLabel(item, position) {
|
|
52251
|
+
return [
|
|
52252
|
+
this.grid.categories[position.index],
|
|
52253
|
+
this.grid.series[position.series].text,
|
|
52254
|
+
formatValue(item, this.valueStyle),
|
|
52255
|
+
].join(', ');
|
|
52256
|
+
}
|
|
52257
|
+
findTabStopInGrid(grid) {
|
|
52258
|
+
const focused = this.focusedPosition;
|
|
52259
|
+
if (getItemAt(grid, focused)) {
|
|
52260
|
+
return focused;
|
|
52261
|
+
}
|
|
52262
|
+
const first = { series: 0, index: 0 };
|
|
52263
|
+
const series = getNearestSeries(grid, first);
|
|
52264
|
+
if (series === undefined) {
|
|
52265
|
+
return;
|
|
52266
|
+
}
|
|
52267
|
+
return Object.assign(Object.assign({}, first), { series: series });
|
|
51772
52268
|
}
|
|
51773
52269
|
draw() {
|
|
51774
52270
|
var _a;
|
|
@@ -51845,20 +52341,23 @@ const Chart = class {
|
|
|
51845
52341
|
this.chart.on('mouseout', this.handleChartOut);
|
|
51846
52342
|
}
|
|
51847
52343
|
updateChart() {
|
|
51848
|
-
var _a, _b;
|
|
52344
|
+
var _a, _b, _c, _d;
|
|
51849
52345
|
const settings = this.getSettings();
|
|
51850
52346
|
const drawnSettings = JSON.stringify(settings);
|
|
51851
52347
|
if (drawnSettings === this.drawnSettings && !this.themeMayHaveChanged) {
|
|
51852
52348
|
return;
|
|
51853
52349
|
}
|
|
51854
52350
|
this.themeMayHaveChanged = false;
|
|
51855
|
-
(_a = this.
|
|
51856
|
-
|
|
51857
|
-
const theme = this.themeReader.theme();
|
|
52351
|
+
(_a = this.stopWatchingTheme) !== null && _a !== void 0 ? _a : (this.stopWatchingTheme = watchTheme(this.host, this.handleThemeChange));
|
|
52352
|
+
const theme = this.getThemeReader().theme();
|
|
51858
52353
|
const coloredSettings = this.withItemColors(settings, theme);
|
|
51859
52354
|
const drawnTheme = JSON.stringify({
|
|
51860
52355
|
theme: theme,
|
|
51861
52356
|
itemColors: coloredSettings.items.map((item) => item.color),
|
|
52357
|
+
seriesColors: (_b = coloredSettings.series) === null || _b === void 0 ? void 0 : _b.map((series) => [
|
|
52358
|
+
series.color,
|
|
52359
|
+
...series.items.map((item) => item.color),
|
|
52360
|
+
]),
|
|
51862
52361
|
});
|
|
51863
52362
|
if (drawnSettings === this.drawnSettings &&
|
|
51864
52363
|
drawnTheme === this.drawnTheme) {
|
|
@@ -51868,9 +52367,10 @@ const Chart = class {
|
|
|
51868
52367
|
this.drawnTheme = drawnTheme;
|
|
51869
52368
|
this.drawing = drawChart(coloredSettings, theme, this.itemSpace);
|
|
51870
52369
|
this.chart.setOption(this.drawing.option, { notMerge: true });
|
|
51871
|
-
|
|
51872
|
-
|
|
51873
|
-
|
|
52370
|
+
this.showSeriesColors((_d = (_c = coloredSettings.series) === null || _c === void 0 ? void 0 : _c.map((series) => series.color)) !== null && _d !== void 0 ? _d : []);
|
|
52371
|
+
const focused = this.host.shadowRoot.activeElement;
|
|
52372
|
+
if (focused instanceof HTMLElement && focused.dataset.index) {
|
|
52373
|
+
this.showItem(focused, true);
|
|
51874
52374
|
}
|
|
51875
52375
|
}
|
|
51876
52376
|
fitItemTextsToSize() {
|
|
@@ -51890,33 +52390,74 @@ const Chart = class {
|
|
|
51890
52390
|
}
|
|
51891
52391
|
getSettings() {
|
|
51892
52392
|
var _a;
|
|
51893
|
-
return Object.assign(Object.assign({ items: ((_a = this.
|
|
51894
|
-
|
|
51895
|
-
|
|
51896
|
-
|
|
51897
|
-
|
|
51898
|
-
|
|
51899
|
-
|
|
52393
|
+
return Object.assign(Object.assign({ items: this.drawnItems.map((item) => copyItem(item)), series: (_a = this.drawnSeries) === null || _a === void 0 ? void 0 : _a.map((series) => {
|
|
52394
|
+
var _a;
|
|
52395
|
+
return ({
|
|
52396
|
+
text: series.text,
|
|
52397
|
+
color: series.color,
|
|
52398
|
+
items: ((_a = series.items) !== null && _a !== void 0 ? _a : []).map((item) => copyItem(item)),
|
|
52399
|
+
});
|
|
52400
|
+
}), stacked: this.stacksSeries }, this.valueStyle), { orientation: this.orientation, maxValue: this.maxValue, axisIncrement: this.axisIncrement, displayAxisLabels: this.displayAxisLabels, itemsLabel: this.itemsLabel, valuesLabel: this.valuesLabel, displayItemText: this.displayItemText, displayItemValue: this.displayItemValue, displayItemPercentage: this.displayItemPercentage });
|
|
51900
52401
|
}
|
|
51901
52402
|
withItemColors(settings, theme) {
|
|
51902
|
-
|
|
52403
|
+
var _a;
|
|
52404
|
+
const seriesOfItems = getSeriesOfDrawnItems({
|
|
52405
|
+
type: this.chartType,
|
|
52406
|
+
items: this.items,
|
|
52407
|
+
series: this.series,
|
|
52408
|
+
});
|
|
52409
|
+
const itemColor = seriesOfItems
|
|
52410
|
+
? this.getSeriesColor(seriesOfItems, 0, theme)
|
|
52411
|
+
: theme.itemColor;
|
|
52412
|
+
const itemFallback = seriesOfItems
|
|
52413
|
+
? 'the color of its series'
|
|
52414
|
+
: 'the default item color';
|
|
52415
|
+
return Object.assign(Object.assign({}, settings), { items: settings.items.map((item) => {
|
|
52416
|
+
var _a;
|
|
52417
|
+
return (Object.assign(Object.assign({}, item), { color: (_a = this.readColor(item.color, 'item', itemFallback)) !== null && _a !== void 0 ? _a : itemColor }));
|
|
52418
|
+
}), series: (_a = settings.series) === null || _a === void 0 ? void 0 : _a.map((series, index) => {
|
|
52419
|
+
const color = this.getSeriesColor(series, index, theme);
|
|
52420
|
+
return Object.assign(Object.assign({}, series), { color: color, items: series.items.map((item) => {
|
|
52421
|
+
var _a;
|
|
52422
|
+
return (Object.assign(Object.assign({}, item), { color: (_a = this.readColor(item.color, 'item', 'the color of its series')) !== null && _a !== void 0 ? _a : color }));
|
|
52423
|
+
}) });
|
|
52424
|
+
}) });
|
|
52425
|
+
}
|
|
52426
|
+
getSeriesColor(series, index, theme) {
|
|
52427
|
+
var _a, _b;
|
|
52428
|
+
return ((_b = (_a = this.readColor(series.color, 'series', 'the default series color')) !== null && _a !== void 0 ? _a : this.getThemeReader().color(getDefaultSeriesColor(index))) !== null && _b !== void 0 ? _b : theme.itemColor);
|
|
51903
52429
|
}
|
|
51904
|
-
|
|
51905
|
-
|
|
51906
|
-
|
|
52430
|
+
showSeriesColors(colors) {
|
|
52431
|
+
const shown = this.seriesColors;
|
|
52432
|
+
const same = colors.length === shown.length &&
|
|
52433
|
+
colors.every((color, index) => color === shown[index]);
|
|
52434
|
+
if (same) {
|
|
52435
|
+
return;
|
|
51907
52436
|
}
|
|
51908
|
-
|
|
51909
|
-
if (
|
|
51910
|
-
|
|
52437
|
+
this.seriesColors = colors;
|
|
52438
|
+
if (this.hasLegend) {
|
|
52439
|
+
forceUpdate(this);
|
|
52440
|
+
}
|
|
52441
|
+
}
|
|
52442
|
+
readColor(color, owner, fallback) {
|
|
52443
|
+
if (!color) {
|
|
52444
|
+
return;
|
|
51911
52445
|
}
|
|
51912
|
-
|
|
51913
|
-
|
|
51914
|
-
|
|
52446
|
+
const resolved = this.getThemeReader().color(color);
|
|
52447
|
+
if (!resolved && !this.invalidColors.has(color)) {
|
|
52448
|
+
this.invalidColors.add(color);
|
|
52449
|
+
const hint = color.includes('var(')
|
|
51915
52450
|
? ' Check that its variables are set, and that they make a color.'
|
|
51916
52451
|
: '';
|
|
51917
|
-
|
|
52452
|
+
const article = owner === 'item' ? 'an' : 'a';
|
|
52453
|
+
console.warn(`limel-chart: the color of ${article} ${owner} must be a CSS color, but was \`${color}\`.${hint} Using ${fallback} instead.`);
|
|
51918
52454
|
}
|
|
51919
|
-
return
|
|
52455
|
+
return resolved;
|
|
52456
|
+
}
|
|
52457
|
+
getThemeReader() {
|
|
52458
|
+
var _a;
|
|
52459
|
+
(_a = this.themeReader) !== null && _a !== void 0 ? _a : (this.themeReader = createThemeReader(this.host.shadowRoot));
|
|
52460
|
+
return this.themeReader;
|
|
51920
52461
|
}
|
|
51921
52462
|
observeSize() {
|
|
51922
52463
|
if (this.resizeObserver || typeof ResizeObserver === 'undefined') {
|
|
@@ -51934,40 +52475,102 @@ const Chart = class {
|
|
|
51934
52475
|
this.drawnTheme = undefined;
|
|
51935
52476
|
this.itemSpace = undefined;
|
|
51936
52477
|
}
|
|
52478
|
+
getClickedPosition(event) {
|
|
52479
|
+
const position = findItem(this.drawing, event);
|
|
52480
|
+
if (event.seriesType !== 'line' || !event.event) {
|
|
52481
|
+
return position;
|
|
52482
|
+
}
|
|
52483
|
+
return Object.assign(Object.assign({}, position), { index: this.getNearestPlace(event.event) });
|
|
52484
|
+
}
|
|
52485
|
+
getNearestPlace(pixel) {
|
|
52486
|
+
const landscape = this.orientation === 'landscape';
|
|
52487
|
+
const place = this.chart.convertFromPixel(landscape ? { xAxisIndex: 0 } : { yAxisIndex: 0 }, landscape ? pixel.offsetX : pixel.offsetY);
|
|
52488
|
+
return Math.round(place);
|
|
52489
|
+
}
|
|
51937
52490
|
highlightItemAt(event, highlight) {
|
|
51938
52491
|
if (!this.drawing) {
|
|
51939
52492
|
return;
|
|
51940
52493
|
}
|
|
51941
|
-
const location = locateItem(this.drawing,
|
|
52494
|
+
const location = locateItem(this.drawing, findItem(this.drawing, event));
|
|
51942
52495
|
if (location.seriesIndex === event.seriesIndex) {
|
|
51943
52496
|
return;
|
|
51944
52497
|
}
|
|
51945
52498
|
this.chart.dispatchAction(Object.assign({ type: highlight ? 'highlight' : 'downplay' }, location));
|
|
51946
52499
|
}
|
|
51947
|
-
getClickableItem(
|
|
51948
|
-
const item = this.
|
|
52500
|
+
getClickableItem(position) {
|
|
52501
|
+
const item = getItemAt(this.grid, position);
|
|
51949
52502
|
if (!(item === null || item === void 0 ? void 0 : item.clickable)) {
|
|
51950
52503
|
return;
|
|
51951
52504
|
}
|
|
51952
52505
|
return item;
|
|
51953
52506
|
}
|
|
51954
|
-
|
|
51955
|
-
|
|
52507
|
+
getPosition(element) {
|
|
52508
|
+
var _a;
|
|
52509
|
+
return {
|
|
52510
|
+
series: Number((_a = element.dataset.series) !== null && _a !== void 0 ? _a : 0),
|
|
52511
|
+
index: Number(element.dataset.index),
|
|
52512
|
+
};
|
|
52513
|
+
}
|
|
52514
|
+
getEventPosition(event) {
|
|
52515
|
+
return this.getPosition(event.currentTarget);
|
|
51956
52516
|
}
|
|
51957
|
-
|
|
51958
|
-
if (
|
|
52517
|
+
findTarget(key, position, orientation) {
|
|
52518
|
+
if (!this.drawsSeries) {
|
|
52519
|
+
const items = this.drawnItems;
|
|
52520
|
+
const index = findNavigationTarget(items, key, position.index, {
|
|
52521
|
+
orientation: orientation,
|
|
52522
|
+
});
|
|
52523
|
+
return { series: 0, index: index };
|
|
52524
|
+
}
|
|
52525
|
+
const grid = this.grid;
|
|
52526
|
+
if (orientation === 'horizontal') {
|
|
52527
|
+
const items = grid.series.map((series) => series.items[position.index]);
|
|
52528
|
+
const series = findNavigationTarget(items, key, position.series, {
|
|
52529
|
+
orientation: orientation,
|
|
52530
|
+
isDisabled: (item) => !item,
|
|
52531
|
+
});
|
|
52532
|
+
return { series: series, index: position.index };
|
|
52533
|
+
}
|
|
52534
|
+
const index = findNavigationTarget(grid.categories, key, position.index, { orientation: orientation });
|
|
52535
|
+
const series = getNearestSeries(grid, {
|
|
52536
|
+
series: position.series,
|
|
52537
|
+
index: index,
|
|
52538
|
+
});
|
|
52539
|
+
return { series: series !== null && series !== void 0 ? series : NO_NAVIGATION_TARGET, index: index };
|
|
52540
|
+
}
|
|
52541
|
+
focusItem(position) {
|
|
52542
|
+
if (position.series === NO_NAVIGATION_TARGET ||
|
|
52543
|
+
position.index === NO_NAVIGATION_TARGET) {
|
|
51959
52544
|
return;
|
|
51960
52545
|
}
|
|
51961
|
-
const
|
|
51962
|
-
|
|
52546
|
+
const series = this.drawsSeries
|
|
52547
|
+
? `[data-series="${position.series}"]`
|
|
52548
|
+
: '';
|
|
52549
|
+
const element = this.host.shadowRoot.querySelector(`tbody [data-index="${position.index}"]${series}`);
|
|
52550
|
+
element === null || element === void 0 ? void 0 : element.focus();
|
|
51963
52551
|
}
|
|
51964
|
-
showItem(
|
|
52552
|
+
showItem(element, show) {
|
|
51965
52553
|
if (!this.chart || !this.drawing) {
|
|
51966
52554
|
return;
|
|
51967
52555
|
}
|
|
51968
|
-
const
|
|
52556
|
+
const position = this.getPosition(element);
|
|
52557
|
+
const location = locateItem(this.drawing, position);
|
|
51969
52558
|
this.chart.dispatchAction(Object.assign({ type: show ? 'highlight' : 'downplay' }, location));
|
|
51970
|
-
|
|
52559
|
+
if (!show) {
|
|
52560
|
+
this.chart.dispatchAction(this.drawsSeries
|
|
52561
|
+
? { type: 'updateAxisPointer', currTrigger: 'leave' }
|
|
52562
|
+
: { type: 'hideTip' });
|
|
52563
|
+
return;
|
|
52564
|
+
}
|
|
52565
|
+
this.chart.dispatchAction(Object.assign({ type: 'showTip' }, (this.drawsSeries
|
|
52566
|
+
? this.getMiddleOfPlace(position.index)
|
|
52567
|
+
: location)));
|
|
52568
|
+
}
|
|
52569
|
+
getMiddleOfPlace(index) {
|
|
52570
|
+
const { minValue, maxValue } = this.drawing.valueRange;
|
|
52571
|
+
const middle = (minValue + maxValue) / 2;
|
|
52572
|
+
const [x, y] = this.chart.convertToPixel({ gridIndex: 0 }, this.orientation === 'landscape' ? [index, middle] : [middle, index]);
|
|
52573
|
+
return { x: x, y: y };
|
|
51971
52574
|
}
|
|
51972
52575
|
get host() { return getElement(this); }
|
|
51973
52576
|
static get watchers() { return {
|