q2-tecton-elements 1.23.0-alpha.0 → 1.24.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/dist/cjs/action-sheet-4b366e9a.js +84 -0
- package/dist/cjs/charting-d02cba1f.js +3127 -0
- package/dist/cjs/{index-3518c78c.js → index-e00b4210.js} +33 -7
- package/dist/cjs/{installCanvasRenderer-b4d10c92.js → installCanvasRenderer-6c4fbcc9.js} +230 -1130
- package/dist/cjs/installLabelLayout-d6b548fe.js +1048 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/q2-action-sheet.cjs.entry.js +218 -0
- package/dist/cjs/q2-badge_2.cjs.entry.js +1 -1
- package/dist/cjs/q2-btn_2.cjs.entry.js +2 -2
- package/dist/cjs/q2-calendar.cjs.entry.js +1 -1
- package/dist/cjs/q2-card.cjs.entry.js +2 -2
- package/dist/cjs/q2-carousel-pane.cjs.entry.js +1 -1
- package/dist/cjs/q2-carousel.cjs.entry.js +1 -1
- package/dist/cjs/q2-chart-area.cjs.entry.js +4569 -0
- package/dist/cjs/q2-chart-bar.cjs.entry.js +25 -3133
- package/dist/cjs/q2-chart-donut.cjs.entry.js +9 -8
- package/dist/cjs/q2-checkbox-group.cjs.entry.js +1 -1
- package/dist/cjs/q2-checkbox.cjs.entry.js +2 -2
- package/dist/cjs/q2-dropdown-item.cjs.entry.js +1 -1
- package/dist/cjs/q2-dropdown.cjs.entry.js +1 -1
- package/dist/cjs/q2-editable-field.cjs.entry.js +1 -1
- package/dist/cjs/q2-icon.cjs.entry.js +1 -1
- package/dist/cjs/q2-loading-element.cjs.entry.js +1 -1
- package/dist/cjs/q2-loc.cjs.entry.js +1 -1
- package/dist/cjs/q2-message.cjs.entry.js +1 -1
- package/dist/cjs/q2-month-picker.cjs.entry.js +1 -1
- package/dist/cjs/q2-optgroup_2.cjs.entry.js +93 -0
- package/dist/cjs/q2-option-list_2.cjs.entry.js +230 -88
- package/dist/cjs/q2-pagination.cjs.entry.js +1 -1
- package/dist/cjs/q2-pill.cjs.entry.js +57 -18
- package/dist/cjs/q2-radio-group.cjs.entry.js +1 -1
- package/dist/cjs/q2-radio.cjs.entry.js +1 -1
- package/dist/cjs/q2-section.cjs.entry.js +1 -1
- package/dist/cjs/q2-select.cjs.entry.js +149 -409
- package/dist/cjs/q2-stepper-pane.cjs.entry.js +1 -1
- package/dist/cjs/q2-stepper-vertical.cjs.entry.js +1 -1
- package/dist/cjs/q2-stepper.cjs.entry.js +1 -1
- package/dist/cjs/q2-tab-container.cjs.entry.js +1 -1
- package/dist/cjs/q2-tag.cjs.entry.js +21 -6
- package/dist/cjs/q2-tecton-elements.cjs.js +1 -1
- package/dist/cjs/q2-textarea.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/q2-action-sheet/index.js +345 -0
- package/dist/collection/components/q2-action-sheet/styles.css +215 -0
- package/dist/collection/components/q2-card/index.js +1 -1
- package/dist/collection/components/q2-chart-area/index.js +622 -0
- package/dist/collection/components/q2-chart-area/styles.css +82 -0
- package/dist/collection/components/q2-chart-bar/index.js +4 -4
- package/dist/collection/components/q2-chart-bar/styles.css +3 -6
- package/dist/collection/components/q2-chart-donut/index.js +1 -1
- package/dist/collection/components/q2-checkbox/index.js +2 -2
- package/dist/collection/components/q2-checkbox/styles.css +1 -0
- package/dist/collection/components/q2-dropdown/index.js +1 -1
- package/dist/collection/components/q2-loading/index.js +1 -1
- package/dist/collection/components/q2-loading/skeleton/q2-loading-element/styles.css +4 -0
- package/dist/collection/components/q2-loading/styles.css +4 -0
- package/dist/collection/components/q2-optgroup/styles.css +2 -2
- package/dist/collection/components/q2-option/index.js +1 -56
- package/dist/collection/components/q2-option/styles.css +7 -0
- package/dist/collection/components/q2-option-list/index.js +290 -102
- package/dist/collection/components/q2-pill/index.js +79 -18
- package/dist/collection/components/q2-pill/styles.css +1 -2
- package/dist/collection/components/q2-popover/index.js +21 -5
- package/dist/collection/components/q2-popover/styles.css +10 -67
- package/dist/collection/components/q2-radio/index.js +2 -2
- package/dist/collection/components/q2-select/index.js +197 -427
- package/dist/collection/components/q2-select/styles.css +5 -11
- package/dist/collection/components/q2-tag/index.js +38 -5
- package/dist/collection/utils/action-sheet.js +79 -0
- package/dist/collection/utils/index.js +31 -7
- package/dist/components/action-sheet.js +81 -0
- package/dist/components/charting.js +3113 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -0
- package/dist/components/index10.js +1 -1
- package/dist/components/index11.js +42 -353
- package/dist/components/index12.js +44 -97
- package/dist/components/index13.js +495 -580
- package/dist/components/index14.js +137 -0
- package/dist/components/index15.js +626 -0
- package/dist/components/index5.js +1 -1
- package/dist/components/index6.js +1 -1
- package/dist/components/index7.js +1 -1
- package/dist/components/index8.js +1 -1
- package/dist/components/index9.js +3 -3
- package/dist/components/installCanvasRenderer.js +188 -1123
- package/dist/components/installLabelLayout.js +1042 -0
- package/dist/components/q2-action-sheet.d.ts +11 -0
- package/dist/components/q2-action-sheet.js +282 -0
- package/dist/components/q2-calendar.js +1 -1
- package/dist/components/q2-card.js +2 -2
- package/dist/components/q2-carousel-pane.js +1 -1
- package/dist/components/q2-carousel.js +1 -1
- package/dist/components/q2-chart-area.d.ts +11 -0
- package/dist/components/q2-chart-area.js +4604 -0
- package/dist/components/q2-chart-bar.js +11 -3119
- package/dist/components/q2-chart-donut.js +4 -3
- package/dist/components/q2-checkbox-group.js +1 -1
- package/dist/components/q2-checkbox.js +2 -2
- package/dist/components/q2-dropdown.js +2 -2
- package/dist/components/q2-editable-field.js +1 -1
- package/dist/components/q2-loading-element.js +1 -1
- package/dist/components/q2-loc.js +1 -1
- package/dist/components/q2-month-picker.js +1 -1
- package/dist/components/q2-optgroup.js +1 -70
- package/dist/components/q2-option-list.js +1 -1
- package/dist/components/q2-option.js +1 -76
- package/dist/components/q2-pagination.js +1 -1
- package/dist/components/q2-pill.js +62 -21
- package/dist/components/q2-popover.js +1 -1
- package/dist/components/q2-radio-group.js +1 -1
- package/dist/components/q2-radio.js +3 -3
- package/dist/components/q2-section.js +1 -1
- package/dist/components/q2-select.js +181 -427
- package/dist/components/q2-stepper-pane.js +1 -1
- package/dist/components/q2-stepper-vertical.js +1 -1
- package/dist/components/q2-stepper.js +1 -1
- package/dist/components/q2-tab-container.js +1 -1
- package/dist/components/q2-tag.js +24 -8
- package/dist/components/q2-textarea.js +1 -1
- package/dist/esm/action-sheet-a9597b32.js +81 -0
- package/dist/esm/charting-2a73ba8e.js +3113 -0
- package/dist/esm/{index-9c591682.js → index-ca21e539.js} +32 -8
- package/dist/esm/{installCanvasRenderer-0143b52d.js → installCanvasRenderer-4a470516.js} +188 -1123
- package/dist/esm/installLabelLayout-d660eaad.js +1042 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/q2-action-sheet.entry.js +214 -0
- package/dist/esm/q2-badge_2.entry.js +1 -1
- package/dist/esm/q2-btn_2.entry.js +2 -2
- package/dist/esm/q2-calendar.entry.js +1 -1
- package/dist/esm/q2-card.entry.js +2 -2
- package/dist/esm/q2-carousel-pane.entry.js +1 -1
- package/dist/esm/q2-carousel.entry.js +1 -1
- package/dist/esm/q2-chart-area.entry.js +4565 -0
- package/dist/esm/q2-chart-bar.entry.js +11 -3119
- package/dist/esm/q2-chart-donut.entry.js +4 -3
- package/dist/esm/q2-checkbox-group.entry.js +1 -1
- package/dist/esm/q2-checkbox.entry.js +2 -2
- package/dist/esm/q2-dropdown-item.entry.js +1 -1
- package/dist/esm/q2-dropdown.entry.js +1 -1
- package/dist/esm/q2-editable-field.entry.js +1 -1
- package/dist/esm/q2-icon.entry.js +1 -1
- package/dist/esm/q2-loading-element.entry.js +1 -1
- package/dist/esm/q2-loc.entry.js +1 -1
- package/dist/esm/q2-message.entry.js +1 -1
- package/dist/esm/q2-month-picker.entry.js +1 -1
- package/dist/esm/q2-optgroup_2.entry.js +88 -0
- package/dist/esm/q2-option-list_2.entry.js +230 -88
- package/dist/esm/q2-pagination.entry.js +1 -1
- package/dist/esm/q2-pill.entry.js +57 -18
- package/dist/esm/q2-radio-group.entry.js +1 -1
- package/dist/esm/q2-radio.entry.js +1 -1
- package/dist/esm/q2-section.entry.js +1 -1
- package/dist/esm/q2-select.entry.js +149 -409
- package/dist/esm/q2-stepper-pane.entry.js +1 -1
- package/dist/esm/q2-stepper-vertical.entry.js +1 -1
- package/dist/esm/q2-stepper.entry.js +1 -1
- package/dist/esm/q2-tab-container.entry.js +1 -1
- package/dist/esm/q2-tag.entry.js +21 -6
- package/dist/esm/q2-tecton-elements.js +1 -1
- package/dist/esm/q2-textarea.entry.js +1 -1
- package/dist/q2-tecton-elements/{p-db873db2.entry.js → p-0473f4f7.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-520c40f6.entry.js → p-13a1390b.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-9ebb283a.entry.js → p-13deb3ed.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-0ba564b1.entry.js → p-1d854203.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-1f71774f.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-18cc4758.entry.js → p-256d3fe6.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-9281adaa.entry.js → p-282f0f8c.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-2d2c5af2.entry.js → p-30969629.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-30cd888b.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-fc134a5d.entry.js → p-37cf9c97.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-fb37e67e.entry.js → p-388349b5.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-458b1987.js +1 -0
- package/dist/q2-tecton-elements/p-52063431.js +39 -0
- package/dist/q2-tecton-elements/p-5589ae0f.entry.js +1 -0
- package/dist/q2-tecton-elements/p-619aed74.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-4625184b.entry.js → p-63b67260.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-e4dc9ac0.entry.js → p-63e363ad.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-cbd1289a.entry.js → p-6736df05.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-72fe10cc.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-c4640b55.entry.js → p-75b817c6.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-c3f27fe2.entry.js → p-7a116095.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-7c94119b.entry.js +1 -0
- package/dist/q2-tecton-elements/p-833398d1.js +1 -0
- package/dist/q2-tecton-elements/{p-ce015552.entry.js → p-90572e43.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-91153c61.entry.js +1 -0
- package/dist/q2-tecton-elements/p-9792de8a.entry.js +1 -0
- package/dist/q2-tecton-elements/p-9acfa94e.js +1 -0
- package/dist/q2-tecton-elements/p-a1926e65.js +1 -0
- package/dist/q2-tecton-elements/{p-ffb48ccc.entry.js → p-b3a8cdc5.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-ce3f203c.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-041b3a82.entry.js → p-ce91cd9b.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-b8b00394.entry.js → p-cefc9d0b.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-d05beeb7.entry.js +1 -0
- package/dist/q2-tecton-elements/p-dc7c8371.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-16c11d74.entry.js → p-e58581fc.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-f800fd1e.entry.js → p-e886c55b.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-6e6b5b80.entry.js → p-f0ec4d2c.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-97aa8423.entry.js → p-f94e7043.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-c444a60b.entry.js → p-fcb7d191.entry.js} +1 -1
- package/dist/q2-tecton-elements/q2-tecton-elements.esm.js +1 -1
- package/dist/test/helpers.js +3 -2
- package/dist/types/components/q2-action-sheet/index.d.ts +52 -0
- package/dist/types/components/q2-card/index.d.ts +1 -1
- package/dist/types/components/q2-chart-area/index.d.ts +40 -0
- package/dist/types/components/q2-chart-bar/index.d.ts +2 -2
- package/dist/types/components/q2-chart-donut/index.d.ts +1 -1
- package/dist/types/components/q2-checkbox/index.d.ts +4 -1
- package/dist/types/components/q2-option/index.d.ts +0 -3
- package/dist/types/components/q2-option-list/index.d.ts +16 -8
- package/dist/types/components/q2-pill/index.d.ts +10 -1
- package/dist/types/components/q2-popover/index.d.ts +2 -0
- package/dist/types/components/q2-select/index.d.ts +46 -47
- package/dist/types/components/q2-tag/index.d.ts +3 -2
- package/dist/types/components.d.ts +100 -13
- package/dist/types/global.d.ts +10 -1
- package/dist/types/utils/action-sheet.d.ts +12 -0
- package/dist/types/utils/index.d.ts +3 -1
- package/dist/types/workspace/workspace/{_production_release_1.22.x-alpha → Tecton_tecton-production_master}/packages/q2-tecton-elements/.stencil/test/helpers.d.ts +1 -1
- package/package.json +3 -2
- package/dist/cjs/q2-optgroup.cjs.entry.js +0 -56
- package/dist/cjs/q2-option.cjs.entry.js +0 -46
- package/dist/esm/q2-optgroup.entry.js +0 -52
- package/dist/esm/q2-option.entry.js +0 -42
- package/dist/q2-tecton-elements/p-0d8dd75a.entry.js +0 -1
- package/dist/q2-tecton-elements/p-0fad9c5a.entry.js +0 -1
- package/dist/q2-tecton-elements/p-1f85cced.js +0 -39
- package/dist/q2-tecton-elements/p-2c9b1308.entry.js +0 -1
- package/dist/q2-tecton-elements/p-5e374fbd.js +0 -1
- package/dist/q2-tecton-elements/p-6b52a262.entry.js +0 -1
- package/dist/q2-tecton-elements/p-aaf42539.entry.js +0 -1
- package/dist/q2-tecton-elements/p-cf41970f.entry.js +0 -1
- package/dist/q2-tecton-elements/p-de164483.entry.js +0 -1
- package/dist/q2-tecton-elements/p-e6d26f39.entry.js +0 -1
- package/dist/q2-tecton-elements/p-f1d06917.entry.js +0 -1
- package/dist/q2-tecton-elements/p-f35bf6a3.entry.js +0 -1
|
@@ -0,0 +1,3113 @@
|
|
|
1
|
+
import { ad as SINGLE_REFERRING, I as each, a6 as createHashMap, ae as createSourceFromSeriesDataOption, D as isFunction, af as curry, ag as makeSeriesEncodeForAxisCoordSys, ah as prepareSeriesDataSchema, ai as enableDataStack, aj as SeriesData, ak as CoordinateSystemManager, m as map, al as SOURCE_FORMAT_ORIGINAL, a0 as isArray, am as getDataItemValue, an as getDimensionTypeByAxis, a3 as makeInner, ao as getOptionCategoryInterval, ap as makeLabelFormatter, aq as getBoundingRect, ar as shouldShowAllLabels, as as getPixelPrecision, at as linearMap, au as round, _ as __extends, av as ComponentModel, aw as mixin, ax as merge, y as defaults, ay as getLayoutParams, az as mergeLayoutParam, aA as OrdinalMeta, aB as fetchLayoutMode, a5 as filter, aC as invert, Q as BoundingRect, aD as applyTransform, aE as getScaleExtent, aF as increaseInterval, aG as IntervalScale, aH as getLayoutRect, aI as estimateLabelUnionRect, j as isObject, aJ as indexOf, aK as createScaleByModel, aL as isCartesian2DSeries, aM as findAxisModels, aN as getDataDimensionsOnAxis, aO as ifAxisCrossZero, aP as keys, aQ as isIntervalOrLogScale, aR as niceScaleExtent, V as Rect, G as Group, aS as layout, aT as AxisBuilder, a as extend, aU as groupTransition, aV as AxisView, aW as Line, aX as subPixelOptimizeLine, aY as ComponentView, a9 as use, aZ as install$3, a_ as retrieve2, E as ZRText, a$ as createTextStyle, b0 as windowOpen, d as getECData, b1 as retrieveRawValue, i as initProps, U as Sector, b2 as isString } from './installCanvasRenderer-4a470516.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @class
|
|
5
|
+
* For example:
|
|
6
|
+
* {
|
|
7
|
+
* coordSysName: 'cartesian2d',
|
|
8
|
+
* coordSysDims: ['x', 'y', ...],
|
|
9
|
+
* axisMap: HashMap({
|
|
10
|
+
* x: xAxisModel,
|
|
11
|
+
* y: yAxisModel
|
|
12
|
+
* }),
|
|
13
|
+
* categoryAxisMap: HashMap({
|
|
14
|
+
* x: xAxisModel,
|
|
15
|
+
* y: undefined
|
|
16
|
+
* }),
|
|
17
|
+
* // The index of the first category axis in `coordSysDims`.
|
|
18
|
+
* // `null/undefined` means no category axis exists.
|
|
19
|
+
* firstCategoryDimIndex: 1,
|
|
20
|
+
* // To replace user specified encode.
|
|
21
|
+
* }
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
var CoordSysInfo =
|
|
25
|
+
/** @class */
|
|
26
|
+
function () {
|
|
27
|
+
function CoordSysInfo(coordSysName) {
|
|
28
|
+
this.coordSysDims = [];
|
|
29
|
+
this.axisMap = createHashMap();
|
|
30
|
+
this.categoryAxisMap = createHashMap();
|
|
31
|
+
this.coordSysName = coordSysName;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return CoordSysInfo;
|
|
35
|
+
}();
|
|
36
|
+
|
|
37
|
+
function getCoordSysInfoBySeries(seriesModel) {
|
|
38
|
+
var coordSysName = seriesModel.get('coordinateSystem');
|
|
39
|
+
var result = new CoordSysInfo(coordSysName);
|
|
40
|
+
var fetch = fetchers[coordSysName];
|
|
41
|
+
|
|
42
|
+
if (fetch) {
|
|
43
|
+
fetch(seriesModel, result, result.axisMap, result.categoryAxisMap);
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
var fetchers = {
|
|
48
|
+
cartesian2d: function (seriesModel, result, axisMap, categoryAxisMap) {
|
|
49
|
+
var xAxisModel = seriesModel.getReferringComponents('xAxis', SINGLE_REFERRING).models[0];
|
|
50
|
+
var yAxisModel = seriesModel.getReferringComponents('yAxis', SINGLE_REFERRING).models[0];
|
|
51
|
+
|
|
52
|
+
result.coordSysDims = ['x', 'y'];
|
|
53
|
+
axisMap.set('x', xAxisModel);
|
|
54
|
+
axisMap.set('y', yAxisModel);
|
|
55
|
+
|
|
56
|
+
if (isCategory(xAxisModel)) {
|
|
57
|
+
categoryAxisMap.set('x', xAxisModel);
|
|
58
|
+
result.firstCategoryDimIndex = 0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (isCategory(yAxisModel)) {
|
|
62
|
+
categoryAxisMap.set('y', yAxisModel);
|
|
63
|
+
result.firstCategoryDimIndex == null && (result.firstCategoryDimIndex = 1);
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
singleAxis: function (seriesModel, result, axisMap, categoryAxisMap) {
|
|
67
|
+
var singleAxisModel = seriesModel.getReferringComponents('singleAxis', SINGLE_REFERRING).models[0];
|
|
68
|
+
|
|
69
|
+
result.coordSysDims = ['single'];
|
|
70
|
+
axisMap.set('single', singleAxisModel);
|
|
71
|
+
|
|
72
|
+
if (isCategory(singleAxisModel)) {
|
|
73
|
+
categoryAxisMap.set('single', singleAxisModel);
|
|
74
|
+
result.firstCategoryDimIndex = 0;
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
polar: function (seriesModel, result, axisMap, categoryAxisMap) {
|
|
78
|
+
var polarModel = seriesModel.getReferringComponents('polar', SINGLE_REFERRING).models[0];
|
|
79
|
+
var radiusAxisModel = polarModel.findAxisModel('radiusAxis');
|
|
80
|
+
var angleAxisModel = polarModel.findAxisModel('angleAxis');
|
|
81
|
+
|
|
82
|
+
result.coordSysDims = ['radius', 'angle'];
|
|
83
|
+
axisMap.set('radius', radiusAxisModel);
|
|
84
|
+
axisMap.set('angle', angleAxisModel);
|
|
85
|
+
|
|
86
|
+
if (isCategory(radiusAxisModel)) {
|
|
87
|
+
categoryAxisMap.set('radius', radiusAxisModel);
|
|
88
|
+
result.firstCategoryDimIndex = 0;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (isCategory(angleAxisModel)) {
|
|
92
|
+
categoryAxisMap.set('angle', angleAxisModel);
|
|
93
|
+
result.firstCategoryDimIndex == null && (result.firstCategoryDimIndex = 1);
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
geo: function (seriesModel, result, axisMap, categoryAxisMap) {
|
|
97
|
+
result.coordSysDims = ['lng', 'lat'];
|
|
98
|
+
},
|
|
99
|
+
parallel: function (seriesModel, result, axisMap, categoryAxisMap) {
|
|
100
|
+
var ecModel = seriesModel.ecModel;
|
|
101
|
+
var parallelModel = ecModel.getComponent('parallel', seriesModel.get('parallelIndex'));
|
|
102
|
+
var coordSysDims = result.coordSysDims = parallelModel.dimensions.slice();
|
|
103
|
+
each(parallelModel.parallelAxisIndex, function (axisIndex, index) {
|
|
104
|
+
var axisModel = ecModel.getComponent('parallelAxis', axisIndex);
|
|
105
|
+
var axisDim = coordSysDims[index];
|
|
106
|
+
axisMap.set(axisDim, axisModel);
|
|
107
|
+
|
|
108
|
+
if (isCategory(axisModel)) {
|
|
109
|
+
categoryAxisMap.set(axisDim, axisModel);
|
|
110
|
+
|
|
111
|
+
if (result.firstCategoryDimIndex == null) {
|
|
112
|
+
result.firstCategoryDimIndex = index;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
function isCategory(axisModel) {
|
|
120
|
+
return axisModel.get('type') === 'category';
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function getCoordSysDimDefs(seriesModel, coordSysInfo) {
|
|
124
|
+
var coordSysName = seriesModel.get('coordinateSystem');
|
|
125
|
+
var registeredCoordSys = CoordinateSystemManager.get(coordSysName);
|
|
126
|
+
var coordSysDimDefs;
|
|
127
|
+
|
|
128
|
+
if (coordSysInfo && coordSysInfo.coordSysDims) {
|
|
129
|
+
coordSysDimDefs = map(coordSysInfo.coordSysDims, function (dim) {
|
|
130
|
+
var dimInfo = {
|
|
131
|
+
name: dim
|
|
132
|
+
};
|
|
133
|
+
var axisModel = coordSysInfo.axisMap.get(dim);
|
|
134
|
+
|
|
135
|
+
if (axisModel) {
|
|
136
|
+
var axisType = axisModel.get('type');
|
|
137
|
+
dimInfo.type = getDimensionTypeByAxis(axisType);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return dimInfo;
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (!coordSysDimDefs) {
|
|
145
|
+
// Get dimensions from registered coordinate system
|
|
146
|
+
coordSysDimDefs = registeredCoordSys && (registeredCoordSys.getDimensionsInfo ? registeredCoordSys.getDimensionsInfo() : registeredCoordSys.dimensions.slice()) || ['x', 'y'];
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return coordSysDimDefs;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function injectOrdinalMeta(dimInfoList, createInvertedIndices, coordSysInfo) {
|
|
153
|
+
var firstCategoryDimIndex;
|
|
154
|
+
var hasNameEncode;
|
|
155
|
+
coordSysInfo && each(dimInfoList, function (dimInfo, dimIndex) {
|
|
156
|
+
var coordDim = dimInfo.coordDim;
|
|
157
|
+
var categoryAxisModel = coordSysInfo.categoryAxisMap.get(coordDim);
|
|
158
|
+
|
|
159
|
+
if (categoryAxisModel) {
|
|
160
|
+
if (firstCategoryDimIndex == null) {
|
|
161
|
+
firstCategoryDimIndex = dimIndex;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
dimInfo.ordinalMeta = categoryAxisModel.getOrdinalMeta();
|
|
165
|
+
|
|
166
|
+
if (createInvertedIndices) {
|
|
167
|
+
dimInfo.createInvertedIndices = true;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (dimInfo.otherDims.itemName != null) {
|
|
172
|
+
hasNameEncode = true;
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
if (!hasNameEncode && firstCategoryDimIndex != null) {
|
|
177
|
+
dimInfoList[firstCategoryDimIndex].otherDims.itemName = 0;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return firstCategoryDimIndex;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Caution: there are side effects to `sourceManager` in this method.
|
|
184
|
+
* Should better only be called in `Series['getInitialData']`.
|
|
185
|
+
*/
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
function createSeriesData(sourceRaw, seriesModel, opt) {
|
|
189
|
+
opt = opt || {};
|
|
190
|
+
var sourceManager = seriesModel.getSourceManager();
|
|
191
|
+
var source;
|
|
192
|
+
var isOriginalSource = false;
|
|
193
|
+
|
|
194
|
+
if (sourceRaw) {
|
|
195
|
+
isOriginalSource = true;
|
|
196
|
+
source = createSourceFromSeriesDataOption(sourceRaw);
|
|
197
|
+
} else {
|
|
198
|
+
source = sourceManager.getSource(); // Is series.data. not dataset.
|
|
199
|
+
|
|
200
|
+
isOriginalSource = source.sourceFormat === SOURCE_FORMAT_ORIGINAL;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
var coordSysInfo = getCoordSysInfoBySeries(seriesModel);
|
|
204
|
+
var coordSysDimDefs = getCoordSysDimDefs(seriesModel, coordSysInfo);
|
|
205
|
+
var useEncodeDefaulter = opt.useEncodeDefaulter;
|
|
206
|
+
var encodeDefaulter = isFunction(useEncodeDefaulter) ? useEncodeDefaulter : useEncodeDefaulter ? curry(makeSeriesEncodeForAxisCoordSys, coordSysDimDefs, seriesModel) : null;
|
|
207
|
+
var createDimensionOptions = {
|
|
208
|
+
coordDimensions: coordSysDimDefs,
|
|
209
|
+
generateCoord: opt.generateCoord,
|
|
210
|
+
encodeDefine: seriesModel.getEncode(),
|
|
211
|
+
encodeDefaulter: encodeDefaulter,
|
|
212
|
+
canOmitUnusedDimensions: !isOriginalSource
|
|
213
|
+
};
|
|
214
|
+
var schema = prepareSeriesDataSchema(source, createDimensionOptions);
|
|
215
|
+
var firstCategoryDimIndex = injectOrdinalMeta(schema.dimensions, opt.createInvertedIndices, coordSysInfo);
|
|
216
|
+
var store = !isOriginalSource ? sourceManager.getSharedDataStore(schema) : null;
|
|
217
|
+
var stackCalculationInfo = enableDataStack(seriesModel, {
|
|
218
|
+
schema: schema,
|
|
219
|
+
store: store
|
|
220
|
+
});
|
|
221
|
+
var data = new SeriesData(schema, seriesModel);
|
|
222
|
+
data.setCalculationInfo(stackCalculationInfo);
|
|
223
|
+
var dimValueGetter = firstCategoryDimIndex != null && isNeedCompleteOrdinalData(source) ? function (itemOpt, dimName, dataIndex, dimIndex) {
|
|
224
|
+
// Use dataIndex as ordinal value in categoryAxis
|
|
225
|
+
return dimIndex === firstCategoryDimIndex ? dataIndex : this.defaultDimValueGetter(itemOpt, dimName, dataIndex, dimIndex);
|
|
226
|
+
} : null;
|
|
227
|
+
data.hasItemOption = false;
|
|
228
|
+
data.initData( // Try to reuse the data store in sourceManager if using dataset.
|
|
229
|
+
isOriginalSource ? source : store, null, dimValueGetter);
|
|
230
|
+
return data;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function isNeedCompleteOrdinalData(source) {
|
|
234
|
+
if (source.sourceFormat === SOURCE_FORMAT_ORIGINAL) {
|
|
235
|
+
var sampleItem = firstDataNotNull(source.data || []);
|
|
236
|
+
return !isArray(getDataItemValue(sampleItem));
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function firstDataNotNull(arr) {
|
|
241
|
+
var i = 0;
|
|
242
|
+
|
|
243
|
+
while (i < arr.length && arr[i] == null) {
|
|
244
|
+
i++;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
return arr[i];
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/*
|
|
251
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
|
252
|
+
* or more contributor license agreements. See the NOTICE file
|
|
253
|
+
* distributed with this work for additional information
|
|
254
|
+
* regarding copyright ownership. The ASF licenses this file
|
|
255
|
+
* to you under the Apache License, Version 2.0 (the
|
|
256
|
+
* "License"); you may not use this file except in compliance
|
|
257
|
+
* with the License. You may obtain a copy of the License at
|
|
258
|
+
*
|
|
259
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
260
|
+
*
|
|
261
|
+
* Unless required by applicable law or agreed to in writing,
|
|
262
|
+
* software distributed under the License is distributed on an
|
|
263
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
264
|
+
* KIND, either express or implied. See the License for the
|
|
265
|
+
* specific language governing permissions and limitations
|
|
266
|
+
* under the License.
|
|
267
|
+
*/
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* AUTO-GENERATED FILE. DO NOT MODIFY.
|
|
272
|
+
*/
|
|
273
|
+
|
|
274
|
+
/*
|
|
275
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
|
276
|
+
* or more contributor license agreements. See the NOTICE file
|
|
277
|
+
* distributed with this work for additional information
|
|
278
|
+
* regarding copyright ownership. The ASF licenses this file
|
|
279
|
+
* to you under the Apache License, Version 2.0 (the
|
|
280
|
+
* "License"); you may not use this file except in compliance
|
|
281
|
+
* with the License. You may obtain a copy of the License at
|
|
282
|
+
*
|
|
283
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
284
|
+
*
|
|
285
|
+
* Unless required by applicable law or agreed to in writing,
|
|
286
|
+
* software distributed under the License is distributed on an
|
|
287
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
288
|
+
* KIND, either express or implied. See the License for the
|
|
289
|
+
* specific language governing permissions and limitations
|
|
290
|
+
* under the License.
|
|
291
|
+
*/
|
|
292
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
293
|
+
var AxisModelCommonMixin =
|
|
294
|
+
/** @class */
|
|
295
|
+
function () {
|
|
296
|
+
function AxisModelCommonMixin() {}
|
|
297
|
+
|
|
298
|
+
AxisModelCommonMixin.prototype.getNeedCrossZero = function () {
|
|
299
|
+
var option = this.option;
|
|
300
|
+
return !option.scale;
|
|
301
|
+
};
|
|
302
|
+
/**
|
|
303
|
+
* Should be implemented by each axis model if necessary.
|
|
304
|
+
* @return coordinate system model
|
|
305
|
+
*/
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
AxisModelCommonMixin.prototype.getCoordSysModel = function () {
|
|
309
|
+
return;
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
return AxisModelCommonMixin;
|
|
313
|
+
}();
|
|
314
|
+
|
|
315
|
+
var inner$1 = makeInner();
|
|
316
|
+
function createAxisLabels(axis) {
|
|
317
|
+
// Only ordinal scale support tick interval
|
|
318
|
+
return axis.type === 'category' ? makeCategoryLabels(axis) : makeRealNumberLabels(axis);
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* @param {module:echats/coord/Axis} axis
|
|
322
|
+
* @param {module:echarts/model/Model} tickModel For example, can be axisTick, splitLine, splitArea.
|
|
323
|
+
* @return {Object} {
|
|
324
|
+
* ticks: Array.<number>
|
|
325
|
+
* tickCategoryInterval: number
|
|
326
|
+
* }
|
|
327
|
+
*/
|
|
328
|
+
|
|
329
|
+
function createAxisTicks(axis, tickModel) {
|
|
330
|
+
// Only ordinal scale support tick interval
|
|
331
|
+
return axis.type === 'category' ? makeCategoryTicks(axis, tickModel) : {
|
|
332
|
+
ticks: map(axis.scale.getTicks(), function (tick) {
|
|
333
|
+
return tick.value;
|
|
334
|
+
})
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
function makeCategoryLabels(axis) {
|
|
339
|
+
var labelModel = axis.getLabelModel();
|
|
340
|
+
var result = makeCategoryLabelsActually(axis, labelModel);
|
|
341
|
+
return !labelModel.get('show') || axis.scale.isBlank() ? {
|
|
342
|
+
labels: [],
|
|
343
|
+
labelCategoryInterval: result.labelCategoryInterval
|
|
344
|
+
} : result;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
function makeCategoryLabelsActually(axis, labelModel) {
|
|
348
|
+
var labelsCache = getListCache(axis, 'labels');
|
|
349
|
+
var optionLabelInterval = getOptionCategoryInterval(labelModel);
|
|
350
|
+
var result = listCacheGet(labelsCache, optionLabelInterval);
|
|
351
|
+
|
|
352
|
+
if (result) {
|
|
353
|
+
return result;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
var labels;
|
|
357
|
+
var numericLabelInterval;
|
|
358
|
+
|
|
359
|
+
if (isFunction(optionLabelInterval)) {
|
|
360
|
+
labels = makeLabelsByCustomizedCategoryInterval(axis, optionLabelInterval);
|
|
361
|
+
} else {
|
|
362
|
+
numericLabelInterval = optionLabelInterval === 'auto' ? makeAutoCategoryInterval(axis) : optionLabelInterval;
|
|
363
|
+
labels = makeLabelsByNumericCategoryInterval(axis, numericLabelInterval);
|
|
364
|
+
} // Cache to avoid calling interval function repeatedly.
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
return listCacheSet(labelsCache, optionLabelInterval, {
|
|
368
|
+
labels: labels,
|
|
369
|
+
labelCategoryInterval: numericLabelInterval
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
function makeCategoryTicks(axis, tickModel) {
|
|
374
|
+
var ticksCache = getListCache(axis, 'ticks');
|
|
375
|
+
var optionTickInterval = getOptionCategoryInterval(tickModel);
|
|
376
|
+
var result = listCacheGet(ticksCache, optionTickInterval);
|
|
377
|
+
|
|
378
|
+
if (result) {
|
|
379
|
+
return result;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
var ticks;
|
|
383
|
+
var tickCategoryInterval; // Optimize for the case that large category data and no label displayed,
|
|
384
|
+
// we should not return all ticks.
|
|
385
|
+
|
|
386
|
+
if (!tickModel.get('show') || axis.scale.isBlank()) {
|
|
387
|
+
ticks = [];
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
if (isFunction(optionTickInterval)) {
|
|
391
|
+
ticks = makeLabelsByCustomizedCategoryInterval(axis, optionTickInterval, true);
|
|
392
|
+
} // Always use label interval by default despite label show. Consider this
|
|
393
|
+
// scenario, Use multiple grid with the xAxis sync, and only one xAxis shows
|
|
394
|
+
// labels. `splitLine` and `axisTick` should be consistent in this case.
|
|
395
|
+
else if (optionTickInterval === 'auto') {
|
|
396
|
+
var labelsResult = makeCategoryLabelsActually(axis, axis.getLabelModel());
|
|
397
|
+
tickCategoryInterval = labelsResult.labelCategoryInterval;
|
|
398
|
+
ticks = map(labelsResult.labels, function (labelItem) {
|
|
399
|
+
return labelItem.tickValue;
|
|
400
|
+
});
|
|
401
|
+
} else {
|
|
402
|
+
tickCategoryInterval = optionTickInterval;
|
|
403
|
+
ticks = makeLabelsByNumericCategoryInterval(axis, tickCategoryInterval, true);
|
|
404
|
+
} // Cache to avoid calling interval function repeatedly.
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
return listCacheSet(ticksCache, optionTickInterval, {
|
|
408
|
+
ticks: ticks,
|
|
409
|
+
tickCategoryInterval: tickCategoryInterval
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
function makeRealNumberLabels(axis) {
|
|
414
|
+
var ticks = axis.scale.getTicks();
|
|
415
|
+
var labelFormatter = makeLabelFormatter(axis);
|
|
416
|
+
return {
|
|
417
|
+
labels: map(ticks, function (tick, idx) {
|
|
418
|
+
return {
|
|
419
|
+
level: tick.level,
|
|
420
|
+
formattedLabel: labelFormatter(tick, idx),
|
|
421
|
+
rawLabel: axis.scale.getLabel(tick),
|
|
422
|
+
tickValue: tick.value
|
|
423
|
+
};
|
|
424
|
+
})
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
function getListCache(axis, prop) {
|
|
429
|
+
// Because key can be a function, and cache size always is small, we use array cache.
|
|
430
|
+
return inner$1(axis)[prop] || (inner$1(axis)[prop] = []);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
function listCacheGet(cache, key) {
|
|
434
|
+
for (var i = 0; i < cache.length; i++) {
|
|
435
|
+
if (cache[i].key === key) {
|
|
436
|
+
return cache[i].value;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
function listCacheSet(cache, key, value) {
|
|
442
|
+
cache.push({
|
|
443
|
+
key: key,
|
|
444
|
+
value: value
|
|
445
|
+
});
|
|
446
|
+
return value;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
function makeAutoCategoryInterval(axis) {
|
|
450
|
+
var result = inner$1(axis).autoInterval;
|
|
451
|
+
return result != null ? result : inner$1(axis).autoInterval = axis.calculateCategoryInterval();
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Calculate interval for category axis ticks and labels.
|
|
455
|
+
* To get precise result, at least one of `getRotate` and `isHorizontal`
|
|
456
|
+
* should be implemented in axis.
|
|
457
|
+
*/
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
function calculateCategoryInterval(axis) {
|
|
461
|
+
var params = fetchAutoCategoryIntervalCalculationParams(axis);
|
|
462
|
+
var labelFormatter = makeLabelFormatter(axis);
|
|
463
|
+
var rotation = (params.axisRotate - params.labelRotate) / 180 * Math.PI;
|
|
464
|
+
var ordinalScale = axis.scale;
|
|
465
|
+
var ordinalExtent = ordinalScale.getExtent(); // Providing this method is for optimization:
|
|
466
|
+
// avoid generating a long array by `getTicks`
|
|
467
|
+
// in large category data case.
|
|
468
|
+
|
|
469
|
+
var tickCount = ordinalScale.count();
|
|
470
|
+
|
|
471
|
+
if (ordinalExtent[1] - ordinalExtent[0] < 1) {
|
|
472
|
+
return 0;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
var step = 1; // Simple optimization. Empirical value: tick count should less than 40.
|
|
476
|
+
|
|
477
|
+
if (tickCount > 40) {
|
|
478
|
+
step = Math.max(1, Math.floor(tickCount / 40));
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
var tickValue = ordinalExtent[0];
|
|
482
|
+
var unitSpan = axis.dataToCoord(tickValue + 1) - axis.dataToCoord(tickValue);
|
|
483
|
+
var unitW = Math.abs(unitSpan * Math.cos(rotation));
|
|
484
|
+
var unitH = Math.abs(unitSpan * Math.sin(rotation));
|
|
485
|
+
var maxW = 0;
|
|
486
|
+
var maxH = 0; // Caution: Performance sensitive for large category data.
|
|
487
|
+
// Consider dataZoom, we should make appropriate step to avoid O(n) loop.
|
|
488
|
+
|
|
489
|
+
for (; tickValue <= ordinalExtent[1]; tickValue += step) {
|
|
490
|
+
var width = 0;
|
|
491
|
+
var height = 0; // Not precise, do not consider align and vertical align
|
|
492
|
+
// and each distance from axis line yet.
|
|
493
|
+
|
|
494
|
+
var rect = getBoundingRect(labelFormatter({
|
|
495
|
+
value: tickValue
|
|
496
|
+
}), params.font, 'center', 'top'); // Magic number
|
|
497
|
+
|
|
498
|
+
width = rect.width * 1.3;
|
|
499
|
+
height = rect.height * 1.3; // Min size, void long loop.
|
|
500
|
+
|
|
501
|
+
maxW = Math.max(maxW, width, 7);
|
|
502
|
+
maxH = Math.max(maxH, height, 7);
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
var dw = maxW / unitW;
|
|
506
|
+
var dh = maxH / unitH; // 0/0 is NaN, 1/0 is Infinity.
|
|
507
|
+
|
|
508
|
+
isNaN(dw) && (dw = Infinity);
|
|
509
|
+
isNaN(dh) && (dh = Infinity);
|
|
510
|
+
var interval = Math.max(0, Math.floor(Math.min(dw, dh)));
|
|
511
|
+
var cache = inner$1(axis.model);
|
|
512
|
+
var axisExtent = axis.getExtent();
|
|
513
|
+
var lastAutoInterval = cache.lastAutoInterval;
|
|
514
|
+
var lastTickCount = cache.lastTickCount; // Use cache to keep interval stable while moving zoom window,
|
|
515
|
+
// otherwise the calculated interval might jitter when the zoom
|
|
516
|
+
// window size is close to the interval-changing size.
|
|
517
|
+
// For example, if all of the axis labels are `a, b, c, d, e, f, g`.
|
|
518
|
+
// The jitter will cause that sometimes the displayed labels are
|
|
519
|
+
// `a, d, g` (interval: 2) sometimes `a, c, e`(interval: 1).
|
|
520
|
+
|
|
521
|
+
if (lastAutoInterval != null && lastTickCount != null && Math.abs(lastAutoInterval - interval) <= 1 && Math.abs(lastTickCount - tickCount) <= 1 // Always choose the bigger one, otherwise the critical
|
|
522
|
+
// point is not the same when zooming in or zooming out.
|
|
523
|
+
&& lastAutoInterval > interval // If the axis change is caused by chart resize, the cache should not
|
|
524
|
+
// be used. Otherwise some hidden labels might not be shown again.
|
|
525
|
+
&& cache.axisExtent0 === axisExtent[0] && cache.axisExtent1 === axisExtent[1]) {
|
|
526
|
+
interval = lastAutoInterval;
|
|
527
|
+
} // Only update cache if cache not used, otherwise the
|
|
528
|
+
// changing of interval is too insensitive.
|
|
529
|
+
else {
|
|
530
|
+
cache.lastTickCount = tickCount;
|
|
531
|
+
cache.lastAutoInterval = interval;
|
|
532
|
+
cache.axisExtent0 = axisExtent[0];
|
|
533
|
+
cache.axisExtent1 = axisExtent[1];
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
return interval;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
function fetchAutoCategoryIntervalCalculationParams(axis) {
|
|
540
|
+
var labelModel = axis.getLabelModel();
|
|
541
|
+
return {
|
|
542
|
+
axisRotate: axis.getRotate ? axis.getRotate() : axis.isHorizontal && !axis.isHorizontal() ? 90 : 0,
|
|
543
|
+
labelRotate: labelModel.get('rotate') || 0,
|
|
544
|
+
font: labelModel.getFont()
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
function makeLabelsByNumericCategoryInterval(axis, categoryInterval, onlyTick) {
|
|
549
|
+
var labelFormatter = makeLabelFormatter(axis);
|
|
550
|
+
var ordinalScale = axis.scale;
|
|
551
|
+
var ordinalExtent = ordinalScale.getExtent();
|
|
552
|
+
var labelModel = axis.getLabelModel();
|
|
553
|
+
var result = []; // TODO: axisType: ordinalTime, pick the tick from each month/day/year/...
|
|
554
|
+
|
|
555
|
+
var step = Math.max((categoryInterval || 0) + 1, 1);
|
|
556
|
+
var startTick = ordinalExtent[0];
|
|
557
|
+
var tickCount = ordinalScale.count(); // Calculate start tick based on zero if possible to keep label consistent
|
|
558
|
+
// while zooming and moving while interval > 0. Otherwise the selection
|
|
559
|
+
// of displayable ticks and symbols probably keep changing.
|
|
560
|
+
// 3 is empirical value.
|
|
561
|
+
|
|
562
|
+
if (startTick !== 0 && step > 1 && tickCount / step > 2) {
|
|
563
|
+
startTick = Math.round(Math.ceil(startTick / step) * step);
|
|
564
|
+
} // (1) Only add min max label here but leave overlap checking
|
|
565
|
+
// to render stage, which also ensure the returned list
|
|
566
|
+
// suitable for splitLine and splitArea rendering.
|
|
567
|
+
// (2) Scales except category always contain min max label so
|
|
568
|
+
// do not need to perform this process.
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
var showAllLabel = shouldShowAllLabels(axis);
|
|
572
|
+
var includeMinLabel = labelModel.get('showMinLabel') || showAllLabel;
|
|
573
|
+
var includeMaxLabel = labelModel.get('showMaxLabel') || showAllLabel;
|
|
574
|
+
|
|
575
|
+
if (includeMinLabel && startTick !== ordinalExtent[0]) {
|
|
576
|
+
addItem(ordinalExtent[0]);
|
|
577
|
+
} // Optimize: avoid generating large array by `ordinalScale.getTicks()`.
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
var tickValue = startTick;
|
|
581
|
+
|
|
582
|
+
for (; tickValue <= ordinalExtent[1]; tickValue += step) {
|
|
583
|
+
addItem(tickValue);
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
if (includeMaxLabel && tickValue - step !== ordinalExtent[1]) {
|
|
587
|
+
addItem(ordinalExtent[1]);
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
function addItem(tickValue) {
|
|
591
|
+
var tickObj = {
|
|
592
|
+
value: tickValue
|
|
593
|
+
};
|
|
594
|
+
result.push(onlyTick ? tickValue : {
|
|
595
|
+
formattedLabel: labelFormatter(tickObj),
|
|
596
|
+
rawLabel: ordinalScale.getLabel(tickObj),
|
|
597
|
+
tickValue: tickValue
|
|
598
|
+
});
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
return result;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
function makeLabelsByCustomizedCategoryInterval(axis, categoryInterval, onlyTick) {
|
|
605
|
+
var ordinalScale = axis.scale;
|
|
606
|
+
var labelFormatter = makeLabelFormatter(axis);
|
|
607
|
+
var result = [];
|
|
608
|
+
each(ordinalScale.getTicks(), function (tick) {
|
|
609
|
+
var rawLabel = ordinalScale.getLabel(tick);
|
|
610
|
+
var tickValue = tick.value;
|
|
611
|
+
|
|
612
|
+
if (categoryInterval(tick.value, rawLabel)) {
|
|
613
|
+
result.push(onlyTick ? tickValue : {
|
|
614
|
+
formattedLabel: labelFormatter(tick),
|
|
615
|
+
rawLabel: rawLabel,
|
|
616
|
+
tickValue: tickValue
|
|
617
|
+
});
|
|
618
|
+
}
|
|
619
|
+
});
|
|
620
|
+
return result;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
var NORMALIZED_EXTENT = [0, 1];
|
|
624
|
+
/**
|
|
625
|
+
* Base class of Axis.
|
|
626
|
+
*/
|
|
627
|
+
|
|
628
|
+
var Axis =
|
|
629
|
+
/** @class */
|
|
630
|
+
function () {
|
|
631
|
+
function Axis(dim, scale, extent) {
|
|
632
|
+
this.onBand = false;
|
|
633
|
+
this.inverse = false;
|
|
634
|
+
this.dim = dim;
|
|
635
|
+
this.scale = scale;
|
|
636
|
+
this._extent = extent || [0, 0];
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* If axis extent contain given coord
|
|
640
|
+
*/
|
|
641
|
+
|
|
642
|
+
|
|
643
|
+
Axis.prototype.contain = function (coord) {
|
|
644
|
+
var extent = this._extent;
|
|
645
|
+
var min = Math.min(extent[0], extent[1]);
|
|
646
|
+
var max = Math.max(extent[0], extent[1]);
|
|
647
|
+
return coord >= min && coord <= max;
|
|
648
|
+
};
|
|
649
|
+
/**
|
|
650
|
+
* If axis extent contain given data
|
|
651
|
+
*/
|
|
652
|
+
|
|
653
|
+
|
|
654
|
+
Axis.prototype.containData = function (data) {
|
|
655
|
+
return this.scale.contain(data);
|
|
656
|
+
};
|
|
657
|
+
/**
|
|
658
|
+
* Get coord extent.
|
|
659
|
+
*/
|
|
660
|
+
|
|
661
|
+
|
|
662
|
+
Axis.prototype.getExtent = function () {
|
|
663
|
+
return this._extent.slice();
|
|
664
|
+
};
|
|
665
|
+
/**
|
|
666
|
+
* Get precision used for formatting
|
|
667
|
+
*/
|
|
668
|
+
|
|
669
|
+
|
|
670
|
+
Axis.prototype.getPixelPrecision = function (dataExtent) {
|
|
671
|
+
return getPixelPrecision(dataExtent || this.scale.getExtent(), this._extent);
|
|
672
|
+
};
|
|
673
|
+
/**
|
|
674
|
+
* Set coord extent
|
|
675
|
+
*/
|
|
676
|
+
|
|
677
|
+
|
|
678
|
+
Axis.prototype.setExtent = function (start, end) {
|
|
679
|
+
var extent = this._extent;
|
|
680
|
+
extent[0] = start;
|
|
681
|
+
extent[1] = end;
|
|
682
|
+
};
|
|
683
|
+
/**
|
|
684
|
+
* Convert data to coord. Data is the rank if it has an ordinal scale
|
|
685
|
+
*/
|
|
686
|
+
|
|
687
|
+
|
|
688
|
+
Axis.prototype.dataToCoord = function (data, clamp) {
|
|
689
|
+
var extent = this._extent;
|
|
690
|
+
var scale = this.scale;
|
|
691
|
+
data = scale.normalize(data);
|
|
692
|
+
|
|
693
|
+
if (this.onBand && scale.type === 'ordinal') {
|
|
694
|
+
extent = extent.slice();
|
|
695
|
+
fixExtentWithBands(extent, scale.count());
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
return linearMap(data, NORMALIZED_EXTENT, extent, clamp);
|
|
699
|
+
};
|
|
700
|
+
/**
|
|
701
|
+
* Convert coord to data. Data is the rank if it has an ordinal scale
|
|
702
|
+
*/
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
Axis.prototype.coordToData = function (coord, clamp) {
|
|
706
|
+
var extent = this._extent;
|
|
707
|
+
var scale = this.scale;
|
|
708
|
+
|
|
709
|
+
if (this.onBand && scale.type === 'ordinal') {
|
|
710
|
+
extent = extent.slice();
|
|
711
|
+
fixExtentWithBands(extent, scale.count());
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
var t = linearMap(coord, extent, NORMALIZED_EXTENT, clamp);
|
|
715
|
+
return this.scale.scale(t);
|
|
716
|
+
};
|
|
717
|
+
/**
|
|
718
|
+
* Convert pixel point to data in axis
|
|
719
|
+
*/
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
Axis.prototype.pointToData = function (point, clamp) {
|
|
723
|
+
// Should be implemented in derived class if necessary.
|
|
724
|
+
return;
|
|
725
|
+
};
|
|
726
|
+
/**
|
|
727
|
+
* Different from `zrUtil.map(axis.getTicks(), axis.dataToCoord, axis)`,
|
|
728
|
+
* `axis.getTicksCoords` considers `onBand`, which is used by
|
|
729
|
+
* `boundaryGap:true` of category axis and splitLine and splitArea.
|
|
730
|
+
* @param opt.tickModel default: axis.model.getModel('axisTick')
|
|
731
|
+
* @param opt.clamp If `true`, the first and the last
|
|
732
|
+
* tick must be at the axis end points. Otherwise, clip ticks
|
|
733
|
+
* that outside the axis extent.
|
|
734
|
+
*/
|
|
735
|
+
|
|
736
|
+
|
|
737
|
+
Axis.prototype.getTicksCoords = function (opt) {
|
|
738
|
+
opt = opt || {};
|
|
739
|
+
var tickModel = opt.tickModel || this.getTickModel();
|
|
740
|
+
var result = createAxisTicks(this, tickModel);
|
|
741
|
+
var ticks = result.ticks;
|
|
742
|
+
var ticksCoords = map(ticks, function (tickVal) {
|
|
743
|
+
return {
|
|
744
|
+
coord: this.dataToCoord(this.scale.type === 'ordinal' ? this.scale.getRawOrdinalNumber(tickVal) : tickVal),
|
|
745
|
+
tickValue: tickVal
|
|
746
|
+
};
|
|
747
|
+
}, this);
|
|
748
|
+
var alignWithLabel = tickModel.get('alignWithLabel');
|
|
749
|
+
fixOnBandTicksCoords(this, ticksCoords, alignWithLabel, opt.clamp);
|
|
750
|
+
return ticksCoords;
|
|
751
|
+
};
|
|
752
|
+
|
|
753
|
+
Axis.prototype.getMinorTicksCoords = function () {
|
|
754
|
+
if (this.scale.type === 'ordinal') {
|
|
755
|
+
// Category axis doesn't support minor ticks
|
|
756
|
+
return [];
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
var minorTickModel = this.model.getModel('minorTick');
|
|
760
|
+
var splitNumber = minorTickModel.get('splitNumber'); // Protection.
|
|
761
|
+
|
|
762
|
+
if (!(splitNumber > 0 && splitNumber < 100)) {
|
|
763
|
+
splitNumber = 5;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
var minorTicks = this.scale.getMinorTicks(splitNumber);
|
|
767
|
+
var minorTicksCoords = map(minorTicks, function (minorTicksGroup) {
|
|
768
|
+
return map(minorTicksGroup, function (minorTick) {
|
|
769
|
+
return {
|
|
770
|
+
coord: this.dataToCoord(minorTick),
|
|
771
|
+
tickValue: minorTick
|
|
772
|
+
};
|
|
773
|
+
}, this);
|
|
774
|
+
}, this);
|
|
775
|
+
return minorTicksCoords;
|
|
776
|
+
};
|
|
777
|
+
|
|
778
|
+
Axis.prototype.getViewLabels = function () {
|
|
779
|
+
return createAxisLabels(this).labels;
|
|
780
|
+
};
|
|
781
|
+
|
|
782
|
+
Axis.prototype.getLabelModel = function () {
|
|
783
|
+
return this.model.getModel('axisLabel');
|
|
784
|
+
};
|
|
785
|
+
/**
|
|
786
|
+
* Notice here we only get the default tick model. For splitLine
|
|
787
|
+
* or splitArea, we should pass the splitLineModel or splitAreaModel
|
|
788
|
+
* manually when calling `getTicksCoords`.
|
|
789
|
+
* In GL, this method may be overridden to:
|
|
790
|
+
* `axisModel.getModel('axisTick', grid3DModel.getModel('axisTick'));`
|
|
791
|
+
*/
|
|
792
|
+
|
|
793
|
+
|
|
794
|
+
Axis.prototype.getTickModel = function () {
|
|
795
|
+
return this.model.getModel('axisTick');
|
|
796
|
+
};
|
|
797
|
+
/**
|
|
798
|
+
* Get width of band
|
|
799
|
+
*/
|
|
800
|
+
|
|
801
|
+
|
|
802
|
+
Axis.prototype.getBandWidth = function () {
|
|
803
|
+
var axisExtent = this._extent;
|
|
804
|
+
var dataExtent = this.scale.getExtent();
|
|
805
|
+
var len = dataExtent[1] - dataExtent[0] + (this.onBand ? 1 : 0); // Fix #2728, avoid NaN when only one data.
|
|
806
|
+
|
|
807
|
+
len === 0 && (len = 1);
|
|
808
|
+
var size = Math.abs(axisExtent[1] - axisExtent[0]);
|
|
809
|
+
return Math.abs(size) / len;
|
|
810
|
+
};
|
|
811
|
+
/**
|
|
812
|
+
* Only be called in category axis.
|
|
813
|
+
* Can be overridden, consider other axes like in 3D.
|
|
814
|
+
* @return Auto interval for cateogry axis tick and label
|
|
815
|
+
*/
|
|
816
|
+
|
|
817
|
+
|
|
818
|
+
Axis.prototype.calculateCategoryInterval = function () {
|
|
819
|
+
return calculateCategoryInterval(this);
|
|
820
|
+
};
|
|
821
|
+
|
|
822
|
+
return Axis;
|
|
823
|
+
}();
|
|
824
|
+
|
|
825
|
+
function fixExtentWithBands(extent, nTick) {
|
|
826
|
+
var size = extent[1] - extent[0];
|
|
827
|
+
var len = nTick;
|
|
828
|
+
var margin = size / len / 2;
|
|
829
|
+
extent[0] += margin;
|
|
830
|
+
extent[1] -= margin;
|
|
831
|
+
} // If axis has labels [1, 2, 3, 4]. Bands on the axis are
|
|
832
|
+
// |---1---|---2---|---3---|---4---|.
|
|
833
|
+
// So the displayed ticks and splitLine/splitArea should between
|
|
834
|
+
// each data item, otherwise cause misleading (e.g., split tow bars
|
|
835
|
+
// of a single data item when there are two bar series).
|
|
836
|
+
// Also consider if tickCategoryInterval > 0 and onBand, ticks and
|
|
837
|
+
// splitLine/spliteArea should layout appropriately corresponding
|
|
838
|
+
// to displayed labels. (So we should not use `getBandWidth` in this
|
|
839
|
+
// case).
|
|
840
|
+
|
|
841
|
+
|
|
842
|
+
function fixOnBandTicksCoords(axis, ticksCoords, alignWithLabel, clamp) {
|
|
843
|
+
var ticksLen = ticksCoords.length;
|
|
844
|
+
|
|
845
|
+
if (!axis.onBand || alignWithLabel || !ticksLen) {
|
|
846
|
+
return;
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
var axisExtent = axis.getExtent();
|
|
850
|
+
var last;
|
|
851
|
+
var diffSize;
|
|
852
|
+
|
|
853
|
+
if (ticksLen === 1) {
|
|
854
|
+
ticksCoords[0].coord = axisExtent[0];
|
|
855
|
+
last = ticksCoords[1] = {
|
|
856
|
+
coord: axisExtent[0]
|
|
857
|
+
};
|
|
858
|
+
} else {
|
|
859
|
+
var crossLen = ticksCoords[ticksLen - 1].tickValue - ticksCoords[0].tickValue;
|
|
860
|
+
var shift_1 = (ticksCoords[ticksLen - 1].coord - ticksCoords[0].coord) / crossLen;
|
|
861
|
+
each(ticksCoords, function (ticksItem) {
|
|
862
|
+
ticksItem.coord -= shift_1 / 2;
|
|
863
|
+
});
|
|
864
|
+
var dataExtent = axis.scale.getExtent();
|
|
865
|
+
diffSize = 1 + dataExtent[1] - ticksCoords[ticksLen - 1].tickValue;
|
|
866
|
+
last = {
|
|
867
|
+
coord: ticksCoords[ticksLen - 1].coord + shift_1 * diffSize
|
|
868
|
+
};
|
|
869
|
+
ticksCoords.push(last);
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
var inverse = axisExtent[0] > axisExtent[1]; // Handling clamp.
|
|
873
|
+
|
|
874
|
+
if (littleThan(ticksCoords[0].coord, axisExtent[0])) {
|
|
875
|
+
clamp ? ticksCoords[0].coord = axisExtent[0] : ticksCoords.shift();
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
if (clamp && littleThan(axisExtent[0], ticksCoords[0].coord)) {
|
|
879
|
+
ticksCoords.unshift({
|
|
880
|
+
coord: axisExtent[0]
|
|
881
|
+
});
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
if (littleThan(axisExtent[1], last.coord)) {
|
|
885
|
+
clamp ? last.coord = axisExtent[1] : ticksCoords.pop();
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
if (clamp && littleThan(last.coord, axisExtent[1])) {
|
|
889
|
+
ticksCoords.push({
|
|
890
|
+
coord: axisExtent[1]
|
|
891
|
+
});
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
function littleThan(a, b) {
|
|
895
|
+
// Avoid rounding error cause calculated tick coord different with extent.
|
|
896
|
+
// It may cause an extra unnecessary tick added.
|
|
897
|
+
a = round(a);
|
|
898
|
+
b = round(b);
|
|
899
|
+
return inverse ? a > b : a < b;
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
var GridModel =
|
|
904
|
+
/** @class */
|
|
905
|
+
function (_super) {
|
|
906
|
+
__extends(GridModel, _super);
|
|
907
|
+
|
|
908
|
+
function GridModel() {
|
|
909
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
GridModel.type = 'grid';
|
|
913
|
+
GridModel.dependencies = ['xAxis', 'yAxis'];
|
|
914
|
+
GridModel.layoutMode = 'box';
|
|
915
|
+
GridModel.defaultOption = {
|
|
916
|
+
show: false,
|
|
917
|
+
// zlevel: 0,
|
|
918
|
+
z: 0,
|
|
919
|
+
left: '10%',
|
|
920
|
+
top: 60,
|
|
921
|
+
right: '10%',
|
|
922
|
+
bottom: 70,
|
|
923
|
+
// If grid size contain label
|
|
924
|
+
containLabel: false,
|
|
925
|
+
// width: {totalWidth} - left - right,
|
|
926
|
+
// height: {totalHeight} - top - bottom,
|
|
927
|
+
backgroundColor: 'rgba(0,0,0,0)',
|
|
928
|
+
borderWidth: 1,
|
|
929
|
+
borderColor: '#ccc'
|
|
930
|
+
};
|
|
931
|
+
return GridModel;
|
|
932
|
+
}(ComponentModel);
|
|
933
|
+
|
|
934
|
+
var CartesianAxisModel =
|
|
935
|
+
/** @class */
|
|
936
|
+
function (_super) {
|
|
937
|
+
__extends(CartesianAxisModel, _super);
|
|
938
|
+
|
|
939
|
+
function CartesianAxisModel() {
|
|
940
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
CartesianAxisModel.prototype.getCoordSysModel = function () {
|
|
944
|
+
return this.getReferringComponents('grid', SINGLE_REFERRING).models[0];
|
|
945
|
+
};
|
|
946
|
+
|
|
947
|
+
CartesianAxisModel.type = 'cartesian2dAxis';
|
|
948
|
+
return CartesianAxisModel;
|
|
949
|
+
}(ComponentModel);
|
|
950
|
+
mixin(CartesianAxisModel, AxisModelCommonMixin);
|
|
951
|
+
|
|
952
|
+
var defaultOption = {
|
|
953
|
+
show: true,
|
|
954
|
+
// zlevel: 0,
|
|
955
|
+
z: 0,
|
|
956
|
+
// Inverse the axis.
|
|
957
|
+
inverse: false,
|
|
958
|
+
// Axis name displayed.
|
|
959
|
+
name: '',
|
|
960
|
+
// 'start' | 'middle' | 'end'
|
|
961
|
+
nameLocation: 'end',
|
|
962
|
+
// By degree. By default auto rotate by nameLocation.
|
|
963
|
+
nameRotate: null,
|
|
964
|
+
nameTruncate: {
|
|
965
|
+
maxWidth: null,
|
|
966
|
+
ellipsis: '...',
|
|
967
|
+
placeholder: '.'
|
|
968
|
+
},
|
|
969
|
+
// Use global text style by default.
|
|
970
|
+
nameTextStyle: {},
|
|
971
|
+
// The gap between axisName and axisLine.
|
|
972
|
+
nameGap: 15,
|
|
973
|
+
// Default `false` to support tooltip.
|
|
974
|
+
silent: false,
|
|
975
|
+
// Default `false` to avoid legacy user event listener fail.
|
|
976
|
+
triggerEvent: false,
|
|
977
|
+
tooltip: {
|
|
978
|
+
show: false
|
|
979
|
+
},
|
|
980
|
+
axisPointer: {},
|
|
981
|
+
axisLine: {
|
|
982
|
+
show: true,
|
|
983
|
+
onZero: true,
|
|
984
|
+
onZeroAxisIndex: null,
|
|
985
|
+
lineStyle: {
|
|
986
|
+
color: '#6E7079',
|
|
987
|
+
width: 1,
|
|
988
|
+
type: 'solid'
|
|
989
|
+
},
|
|
990
|
+
// The arrow at both ends the the axis.
|
|
991
|
+
symbol: ['none', 'none'],
|
|
992
|
+
symbolSize: [10, 15]
|
|
993
|
+
},
|
|
994
|
+
axisTick: {
|
|
995
|
+
show: true,
|
|
996
|
+
// Whether axisTick is inside the grid or outside the grid.
|
|
997
|
+
inside: false,
|
|
998
|
+
// The length of axisTick.
|
|
999
|
+
length: 5,
|
|
1000
|
+
lineStyle: {
|
|
1001
|
+
width: 1
|
|
1002
|
+
}
|
|
1003
|
+
},
|
|
1004
|
+
axisLabel: {
|
|
1005
|
+
show: true,
|
|
1006
|
+
// Whether axisLabel is inside the grid or outside the grid.
|
|
1007
|
+
inside: false,
|
|
1008
|
+
rotate: 0,
|
|
1009
|
+
// true | false | null/undefined (auto)
|
|
1010
|
+
showMinLabel: null,
|
|
1011
|
+
// true | false | null/undefined (auto)
|
|
1012
|
+
showMaxLabel: null,
|
|
1013
|
+
margin: 8,
|
|
1014
|
+
// formatter: null,
|
|
1015
|
+
fontSize: 12
|
|
1016
|
+
},
|
|
1017
|
+
splitLine: {
|
|
1018
|
+
show: true,
|
|
1019
|
+
lineStyle: {
|
|
1020
|
+
color: ['#E0E6F1'],
|
|
1021
|
+
width: 1,
|
|
1022
|
+
type: 'solid'
|
|
1023
|
+
}
|
|
1024
|
+
},
|
|
1025
|
+
splitArea: {
|
|
1026
|
+
show: false,
|
|
1027
|
+
areaStyle: {
|
|
1028
|
+
color: ['rgba(250,250,250,0.2)', 'rgba(210,219,238,0.2)']
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
};
|
|
1032
|
+
var categoryAxis = merge({
|
|
1033
|
+
// The gap at both ends of the axis. For categoryAxis, boolean.
|
|
1034
|
+
boundaryGap: true,
|
|
1035
|
+
// Set false to faster category collection.
|
|
1036
|
+
deduplication: null,
|
|
1037
|
+
// splitArea: {
|
|
1038
|
+
// show: false
|
|
1039
|
+
// },
|
|
1040
|
+
splitLine: {
|
|
1041
|
+
show: false
|
|
1042
|
+
},
|
|
1043
|
+
axisTick: {
|
|
1044
|
+
// If tick is align with label when boundaryGap is true
|
|
1045
|
+
alignWithLabel: false,
|
|
1046
|
+
interval: 'auto'
|
|
1047
|
+
},
|
|
1048
|
+
axisLabel: {
|
|
1049
|
+
interval: 'auto'
|
|
1050
|
+
}
|
|
1051
|
+
}, defaultOption);
|
|
1052
|
+
var valueAxis = merge({
|
|
1053
|
+
boundaryGap: [0, 0],
|
|
1054
|
+
axisLine: {
|
|
1055
|
+
// Not shown when other axis is categoryAxis in cartesian
|
|
1056
|
+
show: 'auto'
|
|
1057
|
+
},
|
|
1058
|
+
axisTick: {
|
|
1059
|
+
// Not shown when other axis is categoryAxis in cartesian
|
|
1060
|
+
show: 'auto'
|
|
1061
|
+
},
|
|
1062
|
+
// TODO
|
|
1063
|
+
// min/max: [30, datamin, 60] or [20, datamin] or [datamin, 60]
|
|
1064
|
+
splitNumber: 5,
|
|
1065
|
+
minorTick: {
|
|
1066
|
+
// Minor tick, not available for cateogry axis.
|
|
1067
|
+
show: false,
|
|
1068
|
+
// Split number of minor ticks. The value should be in range of (0, 100)
|
|
1069
|
+
splitNumber: 5,
|
|
1070
|
+
// Length of minor tick
|
|
1071
|
+
length: 3,
|
|
1072
|
+
// Line style
|
|
1073
|
+
lineStyle: {// Default to be same with axisTick
|
|
1074
|
+
}
|
|
1075
|
+
},
|
|
1076
|
+
minorSplitLine: {
|
|
1077
|
+
show: false,
|
|
1078
|
+
lineStyle: {
|
|
1079
|
+
color: '#F4F7FD',
|
|
1080
|
+
width: 1
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
}, defaultOption);
|
|
1084
|
+
var timeAxis = merge({
|
|
1085
|
+
splitNumber: 6,
|
|
1086
|
+
axisLabel: {
|
|
1087
|
+
// To eliminate labels that are not nice
|
|
1088
|
+
showMinLabel: false,
|
|
1089
|
+
showMaxLabel: false,
|
|
1090
|
+
rich: {
|
|
1091
|
+
primary: {
|
|
1092
|
+
fontWeight: 'bold'
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
},
|
|
1096
|
+
splitLine: {
|
|
1097
|
+
show: false
|
|
1098
|
+
}
|
|
1099
|
+
}, valueAxis);
|
|
1100
|
+
var logAxis = defaults({
|
|
1101
|
+
logBase: 10
|
|
1102
|
+
}, valueAxis);
|
|
1103
|
+
const axisDefault = {
|
|
1104
|
+
category: categoryAxis,
|
|
1105
|
+
value: valueAxis,
|
|
1106
|
+
time: timeAxis,
|
|
1107
|
+
log: logAxis
|
|
1108
|
+
};
|
|
1109
|
+
|
|
1110
|
+
/*
|
|
1111
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
|
1112
|
+
* or more contributor license agreements. See the NOTICE file
|
|
1113
|
+
* distributed with this work for additional information
|
|
1114
|
+
* regarding copyright ownership. The ASF licenses this file
|
|
1115
|
+
* to you under the Apache License, Version 2.0 (the
|
|
1116
|
+
* "License"); you may not use this file except in compliance
|
|
1117
|
+
* with the License. You may obtain a copy of the License at
|
|
1118
|
+
*
|
|
1119
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1120
|
+
*
|
|
1121
|
+
* Unless required by applicable law or agreed to in writing,
|
|
1122
|
+
* software distributed under the License is distributed on an
|
|
1123
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
1124
|
+
* KIND, either express or implied. See the License for the
|
|
1125
|
+
* specific language governing permissions and limitations
|
|
1126
|
+
* under the License.
|
|
1127
|
+
*/
|
|
1128
|
+
|
|
1129
|
+
|
|
1130
|
+
/**
|
|
1131
|
+
* AUTO-GENERATED FILE. DO NOT MODIFY.
|
|
1132
|
+
*/
|
|
1133
|
+
|
|
1134
|
+
/*
|
|
1135
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
|
1136
|
+
* or more contributor license agreements. See the NOTICE file
|
|
1137
|
+
* distributed with this work for additional information
|
|
1138
|
+
* regarding copyright ownership. The ASF licenses this file
|
|
1139
|
+
* to you under the Apache License, Version 2.0 (the
|
|
1140
|
+
* "License"); you may not use this file except in compliance
|
|
1141
|
+
* with the License. You may obtain a copy of the License at
|
|
1142
|
+
*
|
|
1143
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1144
|
+
*
|
|
1145
|
+
* Unless required by applicable law or agreed to in writing,
|
|
1146
|
+
* software distributed under the License is distributed on an
|
|
1147
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
1148
|
+
* KIND, either express or implied. See the License for the
|
|
1149
|
+
* specific language governing permissions and limitations
|
|
1150
|
+
* under the License.
|
|
1151
|
+
*/
|
|
1152
|
+
var AXIS_TYPES = {
|
|
1153
|
+
value: 1,
|
|
1154
|
+
category: 1,
|
|
1155
|
+
time: 1,
|
|
1156
|
+
log: 1
|
|
1157
|
+
};
|
|
1158
|
+
|
|
1159
|
+
/**
|
|
1160
|
+
* Generate sub axis model class
|
|
1161
|
+
* @param axisName 'x' 'y' 'radius' 'angle' 'parallel' ...
|
|
1162
|
+
*/
|
|
1163
|
+
|
|
1164
|
+
function axisModelCreator(registers, axisName, BaseAxisModelClass, extraDefaultOption) {
|
|
1165
|
+
each(AXIS_TYPES, function (v, axisType) {
|
|
1166
|
+
var defaultOption = merge(merge({}, axisDefault[axisType], true), extraDefaultOption, true);
|
|
1167
|
+
|
|
1168
|
+
var AxisModel =
|
|
1169
|
+
/** @class */
|
|
1170
|
+
function (_super) {
|
|
1171
|
+
__extends(AxisModel, _super);
|
|
1172
|
+
|
|
1173
|
+
function AxisModel() {
|
|
1174
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
1175
|
+
|
|
1176
|
+
_this.type = axisName + 'Axis.' + axisType;
|
|
1177
|
+
return _this;
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
AxisModel.prototype.mergeDefaultAndTheme = function (option, ecModel) {
|
|
1181
|
+
var layoutMode = fetchLayoutMode(this);
|
|
1182
|
+
var inputPositionParams = layoutMode ? getLayoutParams(option) : {};
|
|
1183
|
+
var themeModel = ecModel.getTheme();
|
|
1184
|
+
merge(option, themeModel.get(axisType + 'Axis'));
|
|
1185
|
+
merge(option, this.getDefaultOption());
|
|
1186
|
+
option.type = getAxisType(option);
|
|
1187
|
+
|
|
1188
|
+
if (layoutMode) {
|
|
1189
|
+
mergeLayoutParam(option, inputPositionParams, layoutMode);
|
|
1190
|
+
}
|
|
1191
|
+
};
|
|
1192
|
+
|
|
1193
|
+
AxisModel.prototype.optionUpdated = function () {
|
|
1194
|
+
var thisOption = this.option;
|
|
1195
|
+
|
|
1196
|
+
if (thisOption.type === 'category') {
|
|
1197
|
+
this.__ordinalMeta = OrdinalMeta.createByAxisModel(this);
|
|
1198
|
+
}
|
|
1199
|
+
};
|
|
1200
|
+
/**
|
|
1201
|
+
* Should not be called before all of 'getInitailData' finished.
|
|
1202
|
+
* Because categories are collected during initializing data.
|
|
1203
|
+
*/
|
|
1204
|
+
|
|
1205
|
+
|
|
1206
|
+
AxisModel.prototype.getCategories = function (rawData) {
|
|
1207
|
+
var option = this.option; // FIXME
|
|
1208
|
+
// warning if called before all of 'getInitailData' finished.
|
|
1209
|
+
|
|
1210
|
+
if (option.type === 'category') {
|
|
1211
|
+
if (rawData) {
|
|
1212
|
+
return option.data;
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
return this.__ordinalMeta.categories;
|
|
1216
|
+
}
|
|
1217
|
+
};
|
|
1218
|
+
|
|
1219
|
+
AxisModel.prototype.getOrdinalMeta = function () {
|
|
1220
|
+
return this.__ordinalMeta;
|
|
1221
|
+
};
|
|
1222
|
+
|
|
1223
|
+
AxisModel.type = axisName + 'Axis.' + axisType;
|
|
1224
|
+
AxisModel.defaultOption = defaultOption;
|
|
1225
|
+
return AxisModel;
|
|
1226
|
+
}(BaseAxisModelClass);
|
|
1227
|
+
|
|
1228
|
+
registers.registerComponentModel(AxisModel);
|
|
1229
|
+
});
|
|
1230
|
+
registers.registerSubTypeDefaulter(axisName + 'Axis', getAxisType);
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
function getAxisType(option) {
|
|
1234
|
+
// Default axis with data is category axis
|
|
1235
|
+
return option.type || (option.data ? 'category' : 'value');
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
var Cartesian =
|
|
1239
|
+
/** @class */
|
|
1240
|
+
function () {
|
|
1241
|
+
function Cartesian(name) {
|
|
1242
|
+
this.type = 'cartesian';
|
|
1243
|
+
this._dimList = [];
|
|
1244
|
+
this._axes = {};
|
|
1245
|
+
this.name = name || '';
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
Cartesian.prototype.getAxis = function (dim) {
|
|
1249
|
+
return this._axes[dim];
|
|
1250
|
+
};
|
|
1251
|
+
|
|
1252
|
+
Cartesian.prototype.getAxes = function () {
|
|
1253
|
+
return map(this._dimList, function (dim) {
|
|
1254
|
+
return this._axes[dim];
|
|
1255
|
+
}, this);
|
|
1256
|
+
};
|
|
1257
|
+
|
|
1258
|
+
Cartesian.prototype.getAxesByScale = function (scaleType) {
|
|
1259
|
+
scaleType = scaleType.toLowerCase();
|
|
1260
|
+
return filter(this.getAxes(), function (axis) {
|
|
1261
|
+
return axis.scale.type === scaleType;
|
|
1262
|
+
});
|
|
1263
|
+
};
|
|
1264
|
+
|
|
1265
|
+
Cartesian.prototype.addAxis = function (axis) {
|
|
1266
|
+
var dim = axis.dim;
|
|
1267
|
+
this._axes[dim] = axis;
|
|
1268
|
+
|
|
1269
|
+
this._dimList.push(dim);
|
|
1270
|
+
};
|
|
1271
|
+
|
|
1272
|
+
return Cartesian;
|
|
1273
|
+
}();
|
|
1274
|
+
|
|
1275
|
+
var cartesian2DDimensions = ['x', 'y'];
|
|
1276
|
+
|
|
1277
|
+
function canCalculateAffineTransform(scale) {
|
|
1278
|
+
return scale.type === 'interval' || scale.type === 'time';
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
var Cartesian2D =
|
|
1282
|
+
/** @class */
|
|
1283
|
+
function (_super) {
|
|
1284
|
+
__extends(Cartesian2D, _super);
|
|
1285
|
+
|
|
1286
|
+
function Cartesian2D() {
|
|
1287
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
1288
|
+
|
|
1289
|
+
_this.type = 'cartesian2d';
|
|
1290
|
+
_this.dimensions = cartesian2DDimensions;
|
|
1291
|
+
return _this;
|
|
1292
|
+
}
|
|
1293
|
+
/**
|
|
1294
|
+
* Calculate an affine transform matrix if two axes are time or value.
|
|
1295
|
+
* It's mainly for accelartion on the large time series data.
|
|
1296
|
+
*/
|
|
1297
|
+
|
|
1298
|
+
|
|
1299
|
+
Cartesian2D.prototype.calcAffineTransform = function () {
|
|
1300
|
+
this._transform = this._invTransform = null;
|
|
1301
|
+
var xAxisScale = this.getAxis('x').scale;
|
|
1302
|
+
var yAxisScale = this.getAxis('y').scale;
|
|
1303
|
+
|
|
1304
|
+
if (!canCalculateAffineTransform(xAxisScale) || !canCalculateAffineTransform(yAxisScale)) {
|
|
1305
|
+
return;
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
var xScaleExtent = xAxisScale.getExtent();
|
|
1309
|
+
var yScaleExtent = yAxisScale.getExtent();
|
|
1310
|
+
var start = this.dataToPoint([xScaleExtent[0], yScaleExtent[0]]);
|
|
1311
|
+
var end = this.dataToPoint([xScaleExtent[1], yScaleExtent[1]]);
|
|
1312
|
+
var xScaleSpan = xScaleExtent[1] - xScaleExtent[0];
|
|
1313
|
+
var yScaleSpan = yScaleExtent[1] - yScaleExtent[0];
|
|
1314
|
+
|
|
1315
|
+
if (!xScaleSpan || !yScaleSpan) {
|
|
1316
|
+
return;
|
|
1317
|
+
} // Accelerate data to point calculation on the special large time series data.
|
|
1318
|
+
|
|
1319
|
+
|
|
1320
|
+
var scaleX = (end[0] - start[0]) / xScaleSpan;
|
|
1321
|
+
var scaleY = (end[1] - start[1]) / yScaleSpan;
|
|
1322
|
+
var translateX = start[0] - xScaleExtent[0] * scaleX;
|
|
1323
|
+
var translateY = start[1] - yScaleExtent[0] * scaleY;
|
|
1324
|
+
var m = this._transform = [scaleX, 0, 0, scaleY, translateX, translateY];
|
|
1325
|
+
this._invTransform = invert([], m);
|
|
1326
|
+
};
|
|
1327
|
+
/**
|
|
1328
|
+
* Base axis will be used on stacking.
|
|
1329
|
+
*/
|
|
1330
|
+
|
|
1331
|
+
|
|
1332
|
+
Cartesian2D.prototype.getBaseAxis = function () {
|
|
1333
|
+
return this.getAxesByScale('ordinal')[0] || this.getAxesByScale('time')[0] || this.getAxis('x');
|
|
1334
|
+
};
|
|
1335
|
+
|
|
1336
|
+
Cartesian2D.prototype.containPoint = function (point) {
|
|
1337
|
+
var axisX = this.getAxis('x');
|
|
1338
|
+
var axisY = this.getAxis('y');
|
|
1339
|
+
return axisX.contain(axisX.toLocalCoord(point[0])) && axisY.contain(axisY.toLocalCoord(point[1]));
|
|
1340
|
+
};
|
|
1341
|
+
|
|
1342
|
+
Cartesian2D.prototype.containData = function (data) {
|
|
1343
|
+
return this.getAxis('x').containData(data[0]) && this.getAxis('y').containData(data[1]);
|
|
1344
|
+
};
|
|
1345
|
+
|
|
1346
|
+
Cartesian2D.prototype.containZone = function (data1, data2) {
|
|
1347
|
+
var zoneDiag1 = this.dataToPoint(data1);
|
|
1348
|
+
var zoneDiag2 = this.dataToPoint(data2);
|
|
1349
|
+
var area = this.getArea();
|
|
1350
|
+
var zone = new BoundingRect(zoneDiag1[0], zoneDiag1[1], zoneDiag2[0] - zoneDiag1[0], zoneDiag2[1] - zoneDiag1[1]);
|
|
1351
|
+
return area.intersect(zone);
|
|
1352
|
+
};
|
|
1353
|
+
|
|
1354
|
+
Cartesian2D.prototype.dataToPoint = function (data, clamp, out) {
|
|
1355
|
+
out = out || [];
|
|
1356
|
+
var xVal = data[0];
|
|
1357
|
+
var yVal = data[1]; // Fast path
|
|
1358
|
+
|
|
1359
|
+
if (this._transform // It's supported that if data is like `[Inifity, 123]`, where only Y pixel calculated.
|
|
1360
|
+
&& xVal != null && isFinite(xVal) && yVal != null && isFinite(yVal)) {
|
|
1361
|
+
return applyTransform(out, data, this._transform);
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
var xAxis = this.getAxis('x');
|
|
1365
|
+
var yAxis = this.getAxis('y');
|
|
1366
|
+
out[0] = xAxis.toGlobalCoord(xAxis.dataToCoord(xVal, clamp));
|
|
1367
|
+
out[1] = yAxis.toGlobalCoord(yAxis.dataToCoord(yVal, clamp));
|
|
1368
|
+
return out;
|
|
1369
|
+
};
|
|
1370
|
+
|
|
1371
|
+
Cartesian2D.prototype.clampData = function (data, out) {
|
|
1372
|
+
var xScale = this.getAxis('x').scale;
|
|
1373
|
+
var yScale = this.getAxis('y').scale;
|
|
1374
|
+
var xAxisExtent = xScale.getExtent();
|
|
1375
|
+
var yAxisExtent = yScale.getExtent();
|
|
1376
|
+
var x = xScale.parse(data[0]);
|
|
1377
|
+
var y = yScale.parse(data[1]);
|
|
1378
|
+
out = out || [];
|
|
1379
|
+
out[0] = Math.min(Math.max(Math.min(xAxisExtent[0], xAxisExtent[1]), x), Math.max(xAxisExtent[0], xAxisExtent[1]));
|
|
1380
|
+
out[1] = Math.min(Math.max(Math.min(yAxisExtent[0], yAxisExtent[1]), y), Math.max(yAxisExtent[0], yAxisExtent[1]));
|
|
1381
|
+
return out;
|
|
1382
|
+
};
|
|
1383
|
+
|
|
1384
|
+
Cartesian2D.prototype.pointToData = function (point, clamp) {
|
|
1385
|
+
var out = [];
|
|
1386
|
+
|
|
1387
|
+
if (this._invTransform) {
|
|
1388
|
+
return applyTransform(out, point, this._invTransform);
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
var xAxis = this.getAxis('x');
|
|
1392
|
+
var yAxis = this.getAxis('y');
|
|
1393
|
+
out[0] = xAxis.coordToData(xAxis.toLocalCoord(point[0]), clamp);
|
|
1394
|
+
out[1] = yAxis.coordToData(yAxis.toLocalCoord(point[1]), clamp);
|
|
1395
|
+
return out;
|
|
1396
|
+
};
|
|
1397
|
+
|
|
1398
|
+
Cartesian2D.prototype.getOtherAxis = function (axis) {
|
|
1399
|
+
return this.getAxis(axis.dim === 'x' ? 'y' : 'x');
|
|
1400
|
+
};
|
|
1401
|
+
/**
|
|
1402
|
+
* Get rect area of cartesian.
|
|
1403
|
+
* Area will have a contain function to determine if a point is in the coordinate system.
|
|
1404
|
+
*/
|
|
1405
|
+
|
|
1406
|
+
|
|
1407
|
+
Cartesian2D.prototype.getArea = function () {
|
|
1408
|
+
var xExtent = this.getAxis('x').getGlobalExtent();
|
|
1409
|
+
var yExtent = this.getAxis('y').getGlobalExtent();
|
|
1410
|
+
var x = Math.min(xExtent[0], xExtent[1]);
|
|
1411
|
+
var y = Math.min(yExtent[0], yExtent[1]);
|
|
1412
|
+
var width = Math.max(xExtent[0], xExtent[1]) - x;
|
|
1413
|
+
var height = Math.max(yExtent[0], yExtent[1]) - y;
|
|
1414
|
+
return new BoundingRect(x, y, width, height);
|
|
1415
|
+
};
|
|
1416
|
+
|
|
1417
|
+
return Cartesian2D;
|
|
1418
|
+
}(Cartesian);
|
|
1419
|
+
|
|
1420
|
+
var Axis2D =
|
|
1421
|
+
/** @class */
|
|
1422
|
+
function (_super) {
|
|
1423
|
+
__extends(Axis2D, _super);
|
|
1424
|
+
|
|
1425
|
+
function Axis2D(dim, scale, coordExtent, axisType, position) {
|
|
1426
|
+
var _this = _super.call(this, dim, scale, coordExtent) || this;
|
|
1427
|
+
/**
|
|
1428
|
+
* Index of axis, can be used as key
|
|
1429
|
+
* Injected outside.
|
|
1430
|
+
*/
|
|
1431
|
+
|
|
1432
|
+
|
|
1433
|
+
_this.index = 0;
|
|
1434
|
+
_this.type = axisType || 'value';
|
|
1435
|
+
_this.position = position || 'bottom';
|
|
1436
|
+
return _this;
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
Axis2D.prototype.isHorizontal = function () {
|
|
1440
|
+
var position = this.position;
|
|
1441
|
+
return position === 'top' || position === 'bottom';
|
|
1442
|
+
};
|
|
1443
|
+
/**
|
|
1444
|
+
* Each item cooresponds to this.getExtent(), which
|
|
1445
|
+
* means globalExtent[0] may greater than globalExtent[1],
|
|
1446
|
+
* unless `asc` is input.
|
|
1447
|
+
*
|
|
1448
|
+
* @param {boolean} [asc]
|
|
1449
|
+
* @return {Array.<number>}
|
|
1450
|
+
*/
|
|
1451
|
+
|
|
1452
|
+
|
|
1453
|
+
Axis2D.prototype.getGlobalExtent = function (asc) {
|
|
1454
|
+
var ret = this.getExtent();
|
|
1455
|
+
ret[0] = this.toGlobalCoord(ret[0]);
|
|
1456
|
+
ret[1] = this.toGlobalCoord(ret[1]);
|
|
1457
|
+
asc && ret[0] > ret[1] && ret.reverse();
|
|
1458
|
+
return ret;
|
|
1459
|
+
};
|
|
1460
|
+
|
|
1461
|
+
Axis2D.prototype.pointToData = function (point, clamp) {
|
|
1462
|
+
return this.coordToData(this.toLocalCoord(point[this.dim === 'x' ? 0 : 1]), clamp);
|
|
1463
|
+
};
|
|
1464
|
+
/**
|
|
1465
|
+
* Set ordinalSortInfo
|
|
1466
|
+
* @param info new OrdinalSortInfo
|
|
1467
|
+
*/
|
|
1468
|
+
|
|
1469
|
+
|
|
1470
|
+
Axis2D.prototype.setCategorySortInfo = function (info) {
|
|
1471
|
+
if (this.type !== 'category') {
|
|
1472
|
+
return false;
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1475
|
+
this.model.option.categorySortInfo = info;
|
|
1476
|
+
this.scale.setSortInfo(info);
|
|
1477
|
+
};
|
|
1478
|
+
|
|
1479
|
+
return Axis2D;
|
|
1480
|
+
}(Axis);
|
|
1481
|
+
|
|
1482
|
+
var mathLog = Math.log;
|
|
1483
|
+
function alignScaleTicks(scale, axisModel, alignToScale) {
|
|
1484
|
+
var intervalScaleProto = IntervalScale.prototype; // NOTE: There is a precondition for log scale here:
|
|
1485
|
+
// In log scale we store _interval and _extent of exponent value.
|
|
1486
|
+
// So if we use the method of InternalScale to set/get these data.
|
|
1487
|
+
// It process the exponent value, which is linear and what we want here.
|
|
1488
|
+
|
|
1489
|
+
var alignToTicks = intervalScaleProto.getTicks.call(alignToScale);
|
|
1490
|
+
var alignToNicedTicks = intervalScaleProto.getTicks.call(alignToScale, true);
|
|
1491
|
+
var alignToSplitNumber = alignToTicks.length - 1;
|
|
1492
|
+
var alignToInterval = intervalScaleProto.getInterval.call(alignToScale);
|
|
1493
|
+
var scaleExtent = getScaleExtent(scale, axisModel);
|
|
1494
|
+
var rawExtent = scaleExtent.extent;
|
|
1495
|
+
var isMinFixed = scaleExtent.fixMin;
|
|
1496
|
+
var isMaxFixed = scaleExtent.fixMax;
|
|
1497
|
+
|
|
1498
|
+
if (scale.type === 'log') {
|
|
1499
|
+
var logBase = mathLog(scale.base);
|
|
1500
|
+
rawExtent = [mathLog(rawExtent[0]) / logBase, mathLog(rawExtent[1]) / logBase];
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
scale.setExtent(rawExtent[0], rawExtent[1]);
|
|
1504
|
+
scale.calcNiceExtent({
|
|
1505
|
+
splitNumber: alignToSplitNumber,
|
|
1506
|
+
fixMin: isMinFixed,
|
|
1507
|
+
fixMax: isMaxFixed
|
|
1508
|
+
});
|
|
1509
|
+
var extent = intervalScaleProto.getExtent.call(scale); // Need to update the rawExtent.
|
|
1510
|
+
// Because value in rawExtent may be not parsed. e.g. 'dataMin', 'dataMax'
|
|
1511
|
+
|
|
1512
|
+
if (isMinFixed) {
|
|
1513
|
+
rawExtent[0] = extent[0];
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1516
|
+
if (isMaxFixed) {
|
|
1517
|
+
rawExtent[1] = extent[1];
|
|
1518
|
+
}
|
|
1519
|
+
|
|
1520
|
+
var interval = intervalScaleProto.getInterval.call(scale);
|
|
1521
|
+
var min = rawExtent[0];
|
|
1522
|
+
var max = rawExtent[1];
|
|
1523
|
+
|
|
1524
|
+
if (isMinFixed && isMaxFixed) {
|
|
1525
|
+
// User set min, max, divide to get new interval
|
|
1526
|
+
interval = (max - min) / alignToSplitNumber;
|
|
1527
|
+
} else if (isMinFixed) {
|
|
1528
|
+
max = rawExtent[0] + interval * alignToSplitNumber; // User set min, expand extent on the other side
|
|
1529
|
+
|
|
1530
|
+
while (max < rawExtent[1] && isFinite(max) && isFinite(rawExtent[1])) {
|
|
1531
|
+
interval = increaseInterval(interval);
|
|
1532
|
+
max = rawExtent[0] + interval * alignToSplitNumber;
|
|
1533
|
+
}
|
|
1534
|
+
} else if (isMaxFixed) {
|
|
1535
|
+
// User set max, expand extent on the other side
|
|
1536
|
+
min = rawExtent[1] - interval * alignToSplitNumber;
|
|
1537
|
+
|
|
1538
|
+
while (min > rawExtent[0] && isFinite(min) && isFinite(rawExtent[0])) {
|
|
1539
|
+
interval = increaseInterval(interval);
|
|
1540
|
+
min = rawExtent[1] - interval * alignToSplitNumber;
|
|
1541
|
+
}
|
|
1542
|
+
} else {
|
|
1543
|
+
var nicedSplitNumber = scale.getTicks().length - 1;
|
|
1544
|
+
|
|
1545
|
+
if (nicedSplitNumber > alignToSplitNumber) {
|
|
1546
|
+
interval = increaseInterval(interval);
|
|
1547
|
+
}
|
|
1548
|
+
|
|
1549
|
+
var range = interval * alignToSplitNumber;
|
|
1550
|
+
max = Math.ceil(rawExtent[1] / interval) * interval;
|
|
1551
|
+
min = round(max - range); // Not change the result that crossing zero.
|
|
1552
|
+
|
|
1553
|
+
if (min < 0 && rawExtent[0] >= 0) {
|
|
1554
|
+
min = 0;
|
|
1555
|
+
max = round(range);
|
|
1556
|
+
} else if (max > 0 && rawExtent[1] <= 0) {
|
|
1557
|
+
max = 0;
|
|
1558
|
+
min = -round(range);
|
|
1559
|
+
}
|
|
1560
|
+
} // Adjust min, max based on the extent of alignTo. When min or max is set in alignTo scale
|
|
1561
|
+
|
|
1562
|
+
|
|
1563
|
+
var t0 = (alignToTicks[0].value - alignToNicedTicks[0].value) / alignToInterval;
|
|
1564
|
+
var t1 = (alignToTicks[alignToSplitNumber].value - alignToNicedTicks[alignToSplitNumber].value) / alignToInterval; // NOTE: Must in setExtent -> setInterval -> setNiceExtent order.
|
|
1565
|
+
|
|
1566
|
+
intervalScaleProto.setExtent.call(scale, min + interval * t0, max + interval * t1);
|
|
1567
|
+
intervalScaleProto.setInterval.call(scale, interval);
|
|
1568
|
+
|
|
1569
|
+
if (t0 || t1) {
|
|
1570
|
+
intervalScaleProto.setNiceExtent.call(scale, min + interval, max - interval);
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
var Grid =
|
|
1575
|
+
/** @class */
|
|
1576
|
+
function () {
|
|
1577
|
+
function Grid(gridModel, ecModel, api) {
|
|
1578
|
+
// FIXME:TS where used (different from registered type 'cartesian2d')?
|
|
1579
|
+
this.type = 'grid';
|
|
1580
|
+
this._coordsMap = {};
|
|
1581
|
+
this._coordsList = [];
|
|
1582
|
+
this._axesMap = {};
|
|
1583
|
+
this._axesList = [];
|
|
1584
|
+
this.axisPointerEnabled = true;
|
|
1585
|
+
this.dimensions = cartesian2DDimensions;
|
|
1586
|
+
|
|
1587
|
+
this._initCartesian(gridModel, ecModel, api);
|
|
1588
|
+
|
|
1589
|
+
this.model = gridModel;
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1592
|
+
Grid.prototype.getRect = function () {
|
|
1593
|
+
return this._rect;
|
|
1594
|
+
};
|
|
1595
|
+
|
|
1596
|
+
Grid.prototype.update = function (ecModel, api) {
|
|
1597
|
+
var axesMap = this._axesMap;
|
|
1598
|
+
|
|
1599
|
+
this._updateScale(ecModel, this.model);
|
|
1600
|
+
|
|
1601
|
+
function updateAxisTicks(axes) {
|
|
1602
|
+
var alignTo; // Axis is added in order of axisIndex.
|
|
1603
|
+
|
|
1604
|
+
var axesIndices = keys(axes);
|
|
1605
|
+
var len = axesIndices.length;
|
|
1606
|
+
|
|
1607
|
+
if (!len) {
|
|
1608
|
+
return;
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
var axisNeedsAlign = []; // Process once and calculate the ticks for those don't use alignTicks.
|
|
1612
|
+
|
|
1613
|
+
for (var i = len - 1; i >= 0; i--) {
|
|
1614
|
+
var idx = +axesIndices[i]; // Convert to number.
|
|
1615
|
+
|
|
1616
|
+
var axis = axes[idx];
|
|
1617
|
+
var model = axis.model;
|
|
1618
|
+
var scale = axis.scale;
|
|
1619
|
+
|
|
1620
|
+
if ( // Only value and log axis without interval support alignTicks.
|
|
1621
|
+
isIntervalOrLogScale(scale) && model.get('alignTicks') && model.get('interval') == null) {
|
|
1622
|
+
axisNeedsAlign.push(axis);
|
|
1623
|
+
} else {
|
|
1624
|
+
niceScaleExtent(scale, model);
|
|
1625
|
+
|
|
1626
|
+
if (isIntervalOrLogScale(scale)) {
|
|
1627
|
+
// Can only align to interval or log axis.
|
|
1628
|
+
alignTo = axis;
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
// PENDING. Should we find the axis that both set interval, min, max and align to this one?
|
|
1633
|
+
|
|
1634
|
+
if (axisNeedsAlign.length) {
|
|
1635
|
+
if (!alignTo) {
|
|
1636
|
+
alignTo = axisNeedsAlign.pop();
|
|
1637
|
+
niceScaleExtent(alignTo.scale, alignTo.model);
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
each(axisNeedsAlign, function (axis) {
|
|
1641
|
+
alignScaleTicks(axis.scale, axis.model, alignTo.scale);
|
|
1642
|
+
});
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1646
|
+
updateAxisTicks(axesMap.x);
|
|
1647
|
+
updateAxisTicks(axesMap.y); // Key: axisDim_axisIndex, value: boolean, whether onZero target.
|
|
1648
|
+
|
|
1649
|
+
var onZeroRecords = {};
|
|
1650
|
+
each(axesMap.x, function (xAxis) {
|
|
1651
|
+
fixAxisOnZero(axesMap, 'y', xAxis, onZeroRecords);
|
|
1652
|
+
});
|
|
1653
|
+
each(axesMap.y, function (yAxis) {
|
|
1654
|
+
fixAxisOnZero(axesMap, 'x', yAxis, onZeroRecords);
|
|
1655
|
+
}); // Resize again if containLabel is enabled
|
|
1656
|
+
// FIXME It may cause getting wrong grid size in data processing stage
|
|
1657
|
+
|
|
1658
|
+
this.resize(this.model, api);
|
|
1659
|
+
};
|
|
1660
|
+
/**
|
|
1661
|
+
* Resize the grid
|
|
1662
|
+
*/
|
|
1663
|
+
|
|
1664
|
+
|
|
1665
|
+
Grid.prototype.resize = function (gridModel, api, ignoreContainLabel) {
|
|
1666
|
+
var boxLayoutParams = gridModel.getBoxLayoutParams();
|
|
1667
|
+
var isContainLabel = !ignoreContainLabel && gridModel.get('containLabel');
|
|
1668
|
+
var gridRect = getLayoutRect(boxLayoutParams, {
|
|
1669
|
+
width: api.getWidth(),
|
|
1670
|
+
height: api.getHeight()
|
|
1671
|
+
});
|
|
1672
|
+
this._rect = gridRect;
|
|
1673
|
+
var axesList = this._axesList;
|
|
1674
|
+
adjustAxes(); // Minus label size
|
|
1675
|
+
|
|
1676
|
+
if (isContainLabel) {
|
|
1677
|
+
each(axesList, function (axis) {
|
|
1678
|
+
if (!axis.model.get(['axisLabel', 'inside'])) {
|
|
1679
|
+
var labelUnionRect = estimateLabelUnionRect(axis);
|
|
1680
|
+
|
|
1681
|
+
if (labelUnionRect) {
|
|
1682
|
+
var dim = axis.isHorizontal() ? 'height' : 'width';
|
|
1683
|
+
var margin = axis.model.get(['axisLabel', 'margin']);
|
|
1684
|
+
gridRect[dim] -= labelUnionRect[dim] + margin;
|
|
1685
|
+
|
|
1686
|
+
if (axis.position === 'top') {
|
|
1687
|
+
gridRect.y += labelUnionRect.height + margin;
|
|
1688
|
+
} else if (axis.position === 'left') {
|
|
1689
|
+
gridRect.x += labelUnionRect.width + margin;
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
});
|
|
1694
|
+
adjustAxes();
|
|
1695
|
+
}
|
|
1696
|
+
|
|
1697
|
+
each(this._coordsList, function (coord) {
|
|
1698
|
+
// Calculate affine matrix to accelerate the data to point transform.
|
|
1699
|
+
// If all the axes scales are time or value.
|
|
1700
|
+
coord.calcAffineTransform();
|
|
1701
|
+
});
|
|
1702
|
+
|
|
1703
|
+
function adjustAxes() {
|
|
1704
|
+
each(axesList, function (axis) {
|
|
1705
|
+
var isHorizontal = axis.isHorizontal();
|
|
1706
|
+
var extent = isHorizontal ? [0, gridRect.width] : [0, gridRect.height];
|
|
1707
|
+
var idx = axis.inverse ? 1 : 0;
|
|
1708
|
+
axis.setExtent(extent[idx], extent[1 - idx]);
|
|
1709
|
+
updateAxisTransform(axis, isHorizontal ? gridRect.x : gridRect.y);
|
|
1710
|
+
});
|
|
1711
|
+
}
|
|
1712
|
+
};
|
|
1713
|
+
|
|
1714
|
+
Grid.prototype.getAxis = function (dim, axisIndex) {
|
|
1715
|
+
var axesMapOnDim = this._axesMap[dim];
|
|
1716
|
+
|
|
1717
|
+
if (axesMapOnDim != null) {
|
|
1718
|
+
return axesMapOnDim[axisIndex || 0];
|
|
1719
|
+
}
|
|
1720
|
+
};
|
|
1721
|
+
|
|
1722
|
+
Grid.prototype.getAxes = function () {
|
|
1723
|
+
return this._axesList.slice();
|
|
1724
|
+
};
|
|
1725
|
+
|
|
1726
|
+
Grid.prototype.getCartesian = function (xAxisIndex, yAxisIndex) {
|
|
1727
|
+
if (xAxisIndex != null && yAxisIndex != null) {
|
|
1728
|
+
var key = 'x' + xAxisIndex + 'y' + yAxisIndex;
|
|
1729
|
+
return this._coordsMap[key];
|
|
1730
|
+
}
|
|
1731
|
+
|
|
1732
|
+
if (isObject(xAxisIndex)) {
|
|
1733
|
+
yAxisIndex = xAxisIndex.yAxisIndex;
|
|
1734
|
+
xAxisIndex = xAxisIndex.xAxisIndex;
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1737
|
+
for (var i = 0, coordList = this._coordsList; i < coordList.length; i++) {
|
|
1738
|
+
if (coordList[i].getAxis('x').index === xAxisIndex || coordList[i].getAxis('y').index === yAxisIndex) {
|
|
1739
|
+
return coordList[i];
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1742
|
+
};
|
|
1743
|
+
|
|
1744
|
+
Grid.prototype.getCartesians = function () {
|
|
1745
|
+
return this._coordsList.slice();
|
|
1746
|
+
};
|
|
1747
|
+
/**
|
|
1748
|
+
* @implements
|
|
1749
|
+
*/
|
|
1750
|
+
|
|
1751
|
+
|
|
1752
|
+
Grid.prototype.convertToPixel = function (ecModel, finder, value) {
|
|
1753
|
+
var target = this._findConvertTarget(finder);
|
|
1754
|
+
|
|
1755
|
+
return target.cartesian ? target.cartesian.dataToPoint(value) : target.axis ? target.axis.toGlobalCoord(target.axis.dataToCoord(value)) : null;
|
|
1756
|
+
};
|
|
1757
|
+
/**
|
|
1758
|
+
* @implements
|
|
1759
|
+
*/
|
|
1760
|
+
|
|
1761
|
+
|
|
1762
|
+
Grid.prototype.convertFromPixel = function (ecModel, finder, value) {
|
|
1763
|
+
var target = this._findConvertTarget(finder);
|
|
1764
|
+
|
|
1765
|
+
return target.cartesian ? target.cartesian.pointToData(value) : target.axis ? target.axis.coordToData(target.axis.toLocalCoord(value)) : null;
|
|
1766
|
+
};
|
|
1767
|
+
|
|
1768
|
+
Grid.prototype._findConvertTarget = function (finder) {
|
|
1769
|
+
var seriesModel = finder.seriesModel;
|
|
1770
|
+
var xAxisModel = finder.xAxisModel || seriesModel && seriesModel.getReferringComponents('xAxis', SINGLE_REFERRING).models[0];
|
|
1771
|
+
var yAxisModel = finder.yAxisModel || seriesModel && seriesModel.getReferringComponents('yAxis', SINGLE_REFERRING).models[0];
|
|
1772
|
+
var gridModel = finder.gridModel;
|
|
1773
|
+
var coordsList = this._coordsList;
|
|
1774
|
+
var cartesian;
|
|
1775
|
+
var axis;
|
|
1776
|
+
|
|
1777
|
+
if (seriesModel) {
|
|
1778
|
+
cartesian = seriesModel.coordinateSystem;
|
|
1779
|
+
indexOf(coordsList, cartesian) < 0 && (cartesian = null);
|
|
1780
|
+
} else if (xAxisModel && yAxisModel) {
|
|
1781
|
+
cartesian = this.getCartesian(xAxisModel.componentIndex, yAxisModel.componentIndex);
|
|
1782
|
+
} else if (xAxisModel) {
|
|
1783
|
+
axis = this.getAxis('x', xAxisModel.componentIndex);
|
|
1784
|
+
} else if (yAxisModel) {
|
|
1785
|
+
axis = this.getAxis('y', yAxisModel.componentIndex);
|
|
1786
|
+
} // Lowest priority.
|
|
1787
|
+
else if (gridModel) {
|
|
1788
|
+
var grid = gridModel.coordinateSystem;
|
|
1789
|
+
|
|
1790
|
+
if (grid === this) {
|
|
1791
|
+
cartesian = this._coordsList[0];
|
|
1792
|
+
}
|
|
1793
|
+
}
|
|
1794
|
+
|
|
1795
|
+
return {
|
|
1796
|
+
cartesian: cartesian,
|
|
1797
|
+
axis: axis
|
|
1798
|
+
};
|
|
1799
|
+
};
|
|
1800
|
+
/**
|
|
1801
|
+
* @implements
|
|
1802
|
+
*/
|
|
1803
|
+
|
|
1804
|
+
|
|
1805
|
+
Grid.prototype.containPoint = function (point) {
|
|
1806
|
+
var coord = this._coordsList[0];
|
|
1807
|
+
|
|
1808
|
+
if (coord) {
|
|
1809
|
+
return coord.containPoint(point);
|
|
1810
|
+
}
|
|
1811
|
+
};
|
|
1812
|
+
/**
|
|
1813
|
+
* Initialize cartesian coordinate systems
|
|
1814
|
+
*/
|
|
1815
|
+
|
|
1816
|
+
|
|
1817
|
+
Grid.prototype._initCartesian = function (gridModel, ecModel, api) {
|
|
1818
|
+
var _this = this;
|
|
1819
|
+
|
|
1820
|
+
var grid = this;
|
|
1821
|
+
var axisPositionUsed = {
|
|
1822
|
+
left: false,
|
|
1823
|
+
right: false,
|
|
1824
|
+
top: false,
|
|
1825
|
+
bottom: false
|
|
1826
|
+
};
|
|
1827
|
+
var axesMap = {
|
|
1828
|
+
x: {},
|
|
1829
|
+
y: {}
|
|
1830
|
+
};
|
|
1831
|
+
var axesCount = {
|
|
1832
|
+
x: 0,
|
|
1833
|
+
y: 0
|
|
1834
|
+
}; // Create axis
|
|
1835
|
+
|
|
1836
|
+
ecModel.eachComponent('xAxis', createAxisCreator('x'), this);
|
|
1837
|
+
ecModel.eachComponent('yAxis', createAxisCreator('y'), this);
|
|
1838
|
+
|
|
1839
|
+
if (!axesCount.x || !axesCount.y) {
|
|
1840
|
+
// Roll back when there no either x or y axis
|
|
1841
|
+
this._axesMap = {};
|
|
1842
|
+
this._axesList = [];
|
|
1843
|
+
return;
|
|
1844
|
+
}
|
|
1845
|
+
|
|
1846
|
+
this._axesMap = axesMap; // Create cartesian2d
|
|
1847
|
+
|
|
1848
|
+
each(axesMap.x, function (xAxis, xAxisIndex) {
|
|
1849
|
+
each(axesMap.y, function (yAxis, yAxisIndex) {
|
|
1850
|
+
var key = 'x' + xAxisIndex + 'y' + yAxisIndex;
|
|
1851
|
+
var cartesian = new Cartesian2D(key);
|
|
1852
|
+
cartesian.master = _this;
|
|
1853
|
+
cartesian.model = gridModel;
|
|
1854
|
+
_this._coordsMap[key] = cartesian;
|
|
1855
|
+
|
|
1856
|
+
_this._coordsList.push(cartesian);
|
|
1857
|
+
|
|
1858
|
+
cartesian.addAxis(xAxis);
|
|
1859
|
+
cartesian.addAxis(yAxis);
|
|
1860
|
+
});
|
|
1861
|
+
});
|
|
1862
|
+
|
|
1863
|
+
function createAxisCreator(dimName) {
|
|
1864
|
+
return function (axisModel, idx) {
|
|
1865
|
+
if (!isAxisUsedInTheGrid(axisModel, gridModel)) {
|
|
1866
|
+
return;
|
|
1867
|
+
}
|
|
1868
|
+
|
|
1869
|
+
var axisPosition = axisModel.get('position');
|
|
1870
|
+
|
|
1871
|
+
if (dimName === 'x') {
|
|
1872
|
+
// Fix position
|
|
1873
|
+
if (axisPosition !== 'top' && axisPosition !== 'bottom') {
|
|
1874
|
+
// Default bottom of X
|
|
1875
|
+
axisPosition = axisPositionUsed.bottom ? 'top' : 'bottom';
|
|
1876
|
+
}
|
|
1877
|
+
} else {
|
|
1878
|
+
// Fix position
|
|
1879
|
+
if (axisPosition !== 'left' && axisPosition !== 'right') {
|
|
1880
|
+
// Default left of Y
|
|
1881
|
+
axisPosition = axisPositionUsed.left ? 'right' : 'left';
|
|
1882
|
+
}
|
|
1883
|
+
}
|
|
1884
|
+
|
|
1885
|
+
axisPositionUsed[axisPosition] = true;
|
|
1886
|
+
var axis = new Axis2D(dimName, createScaleByModel(axisModel), [0, 0], axisModel.get('type'), axisPosition);
|
|
1887
|
+
var isCategory = axis.type === 'category';
|
|
1888
|
+
axis.onBand = isCategory && axisModel.get('boundaryGap');
|
|
1889
|
+
axis.inverse = axisModel.get('inverse'); // Inject axis into axisModel
|
|
1890
|
+
|
|
1891
|
+
axisModel.axis = axis; // Inject axisModel into axis
|
|
1892
|
+
|
|
1893
|
+
axis.model = axisModel; // Inject grid info axis
|
|
1894
|
+
|
|
1895
|
+
axis.grid = grid; // Index of axis, can be used as key
|
|
1896
|
+
|
|
1897
|
+
axis.index = idx;
|
|
1898
|
+
|
|
1899
|
+
grid._axesList.push(axis);
|
|
1900
|
+
|
|
1901
|
+
axesMap[dimName][idx] = axis;
|
|
1902
|
+
axesCount[dimName]++;
|
|
1903
|
+
};
|
|
1904
|
+
}
|
|
1905
|
+
};
|
|
1906
|
+
/**
|
|
1907
|
+
* Update cartesian properties from series.
|
|
1908
|
+
*/
|
|
1909
|
+
|
|
1910
|
+
|
|
1911
|
+
Grid.prototype._updateScale = function (ecModel, gridModel) {
|
|
1912
|
+
// Reset scale
|
|
1913
|
+
each(this._axesList, function (axis) {
|
|
1914
|
+
axis.scale.setExtent(Infinity, -Infinity);
|
|
1915
|
+
|
|
1916
|
+
if (axis.type === 'category') {
|
|
1917
|
+
var categorySortInfo = axis.model.get('categorySortInfo');
|
|
1918
|
+
axis.scale.setSortInfo(categorySortInfo);
|
|
1919
|
+
}
|
|
1920
|
+
});
|
|
1921
|
+
ecModel.eachSeries(function (seriesModel) {
|
|
1922
|
+
if (isCartesian2DSeries(seriesModel)) {
|
|
1923
|
+
var axesModelMap = findAxisModels(seriesModel);
|
|
1924
|
+
var xAxisModel = axesModelMap.xAxisModel;
|
|
1925
|
+
var yAxisModel = axesModelMap.yAxisModel;
|
|
1926
|
+
|
|
1927
|
+
if (!isAxisUsedInTheGrid(xAxisModel, gridModel) || !isAxisUsedInTheGrid(yAxisModel, gridModel)) {
|
|
1928
|
+
return;
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
var cartesian = this.getCartesian(xAxisModel.componentIndex, yAxisModel.componentIndex);
|
|
1932
|
+
var data = seriesModel.getData();
|
|
1933
|
+
var xAxis = cartesian.getAxis('x');
|
|
1934
|
+
var yAxis = cartesian.getAxis('y');
|
|
1935
|
+
unionExtent(data, xAxis);
|
|
1936
|
+
unionExtent(data, yAxis);
|
|
1937
|
+
}
|
|
1938
|
+
}, this);
|
|
1939
|
+
|
|
1940
|
+
function unionExtent(data, axis) {
|
|
1941
|
+
each(getDataDimensionsOnAxis(data, axis.dim), function (dim) {
|
|
1942
|
+
axis.scale.unionExtentFromData(data, dim);
|
|
1943
|
+
});
|
|
1944
|
+
}
|
|
1945
|
+
};
|
|
1946
|
+
/**
|
|
1947
|
+
* @param dim 'x' or 'y' or 'auto' or null/undefined
|
|
1948
|
+
*/
|
|
1949
|
+
|
|
1950
|
+
|
|
1951
|
+
Grid.prototype.getTooltipAxes = function (dim) {
|
|
1952
|
+
var baseAxes = [];
|
|
1953
|
+
var otherAxes = [];
|
|
1954
|
+
each(this.getCartesians(), function (cartesian) {
|
|
1955
|
+
var baseAxis = dim != null && dim !== 'auto' ? cartesian.getAxis(dim) : cartesian.getBaseAxis();
|
|
1956
|
+
var otherAxis = cartesian.getOtherAxis(baseAxis);
|
|
1957
|
+
indexOf(baseAxes, baseAxis) < 0 && baseAxes.push(baseAxis);
|
|
1958
|
+
indexOf(otherAxes, otherAxis) < 0 && otherAxes.push(otherAxis);
|
|
1959
|
+
});
|
|
1960
|
+
return {
|
|
1961
|
+
baseAxes: baseAxes,
|
|
1962
|
+
otherAxes: otherAxes
|
|
1963
|
+
};
|
|
1964
|
+
};
|
|
1965
|
+
|
|
1966
|
+
Grid.create = function (ecModel, api) {
|
|
1967
|
+
var grids = [];
|
|
1968
|
+
ecModel.eachComponent('grid', function (gridModel, idx) {
|
|
1969
|
+
var grid = new Grid(gridModel, ecModel, api);
|
|
1970
|
+
grid.name = 'grid_' + idx; // dataSampling requires axis extent, so resize
|
|
1971
|
+
// should be performed in create stage.
|
|
1972
|
+
|
|
1973
|
+
grid.resize(gridModel, api, true);
|
|
1974
|
+
gridModel.coordinateSystem = grid;
|
|
1975
|
+
grids.push(grid);
|
|
1976
|
+
}); // Inject the coordinateSystems into seriesModel
|
|
1977
|
+
|
|
1978
|
+
ecModel.eachSeries(function (seriesModel) {
|
|
1979
|
+
if (!isCartesian2DSeries(seriesModel)) {
|
|
1980
|
+
return;
|
|
1981
|
+
}
|
|
1982
|
+
|
|
1983
|
+
var axesModelMap = findAxisModels(seriesModel);
|
|
1984
|
+
var xAxisModel = axesModelMap.xAxisModel;
|
|
1985
|
+
var yAxisModel = axesModelMap.yAxisModel;
|
|
1986
|
+
var gridModel = xAxisModel.getCoordSysModel();
|
|
1987
|
+
|
|
1988
|
+
var grid = gridModel.coordinateSystem;
|
|
1989
|
+
seriesModel.coordinateSystem = grid.getCartesian(xAxisModel.componentIndex, yAxisModel.componentIndex);
|
|
1990
|
+
});
|
|
1991
|
+
return grids;
|
|
1992
|
+
}; // For deciding which dimensions to use when creating list data
|
|
1993
|
+
|
|
1994
|
+
|
|
1995
|
+
Grid.dimensions = cartesian2DDimensions;
|
|
1996
|
+
return Grid;
|
|
1997
|
+
}();
|
|
1998
|
+
/**
|
|
1999
|
+
* Check if the axis is used in the specified grid.
|
|
2000
|
+
*/
|
|
2001
|
+
|
|
2002
|
+
|
|
2003
|
+
function isAxisUsedInTheGrid(axisModel, gridModel) {
|
|
2004
|
+
return axisModel.getCoordSysModel() === gridModel;
|
|
2005
|
+
}
|
|
2006
|
+
|
|
2007
|
+
function fixAxisOnZero(axesMap, otherAxisDim, axis, // Key: see `getOnZeroRecordKey`
|
|
2008
|
+
onZeroRecords) {
|
|
2009
|
+
axis.getAxesOnZeroOf = function () {
|
|
2010
|
+
// TODO: onZero of multiple axes.
|
|
2011
|
+
return otherAxisOnZeroOf ? [otherAxisOnZeroOf] : [];
|
|
2012
|
+
}; // onZero can not be enabled in these two situations:
|
|
2013
|
+
// 1. When any other axis is a category axis.
|
|
2014
|
+
// 2. When no axis is cross 0 point.
|
|
2015
|
+
|
|
2016
|
+
|
|
2017
|
+
var otherAxes = axesMap[otherAxisDim];
|
|
2018
|
+
var otherAxisOnZeroOf;
|
|
2019
|
+
var axisModel = axis.model;
|
|
2020
|
+
var onZero = axisModel.get(['axisLine', 'onZero']);
|
|
2021
|
+
var onZeroAxisIndex = axisModel.get(['axisLine', 'onZeroAxisIndex']);
|
|
2022
|
+
|
|
2023
|
+
if (!onZero) {
|
|
2024
|
+
return;
|
|
2025
|
+
} // If target axis is specified.
|
|
2026
|
+
|
|
2027
|
+
|
|
2028
|
+
if (onZeroAxisIndex != null) {
|
|
2029
|
+
if (canOnZeroToAxis(otherAxes[onZeroAxisIndex])) {
|
|
2030
|
+
otherAxisOnZeroOf = otherAxes[onZeroAxisIndex];
|
|
2031
|
+
}
|
|
2032
|
+
} else {
|
|
2033
|
+
// Find the first available other axis.
|
|
2034
|
+
for (var idx in otherAxes) {
|
|
2035
|
+
if (otherAxes.hasOwnProperty(idx) && canOnZeroToAxis(otherAxes[idx]) // Consider that two Y axes on one value axis,
|
|
2036
|
+
// if both onZero, the two Y axes overlap.
|
|
2037
|
+
&& !onZeroRecords[getOnZeroRecordKey(otherAxes[idx])]) {
|
|
2038
|
+
otherAxisOnZeroOf = otherAxes[idx];
|
|
2039
|
+
break;
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
2043
|
+
|
|
2044
|
+
if (otherAxisOnZeroOf) {
|
|
2045
|
+
onZeroRecords[getOnZeroRecordKey(otherAxisOnZeroOf)] = true;
|
|
2046
|
+
}
|
|
2047
|
+
|
|
2048
|
+
function getOnZeroRecordKey(axis) {
|
|
2049
|
+
return axis.dim + '_' + axis.index;
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2052
|
+
|
|
2053
|
+
function canOnZeroToAxis(axis) {
|
|
2054
|
+
return axis && axis.type !== 'category' && axis.type !== 'time' && ifAxisCrossZero(axis);
|
|
2055
|
+
}
|
|
2056
|
+
|
|
2057
|
+
function updateAxisTransform(axis, coordBase) {
|
|
2058
|
+
var axisExtent = axis.getExtent();
|
|
2059
|
+
var axisExtentSum = axisExtent[0] + axisExtent[1]; // Fast transform
|
|
2060
|
+
|
|
2061
|
+
axis.toGlobalCoord = axis.dim === 'x' ? function (coord) {
|
|
2062
|
+
return coord + coordBase;
|
|
2063
|
+
} : function (coord) {
|
|
2064
|
+
return axisExtentSum - coord + coordBase;
|
|
2065
|
+
};
|
|
2066
|
+
axis.toLocalCoord = axis.dim === 'x' ? function (coord) {
|
|
2067
|
+
return coord - coordBase;
|
|
2068
|
+
} : function (coord) {
|
|
2069
|
+
return axisExtentSum - coord + coordBase;
|
|
2070
|
+
};
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2073
|
+
var inner = makeInner();
|
|
2074
|
+
function rectCoordAxisBuildSplitArea(axisView, axisGroup, axisModel, gridModel) {
|
|
2075
|
+
var axis = axisModel.axis;
|
|
2076
|
+
|
|
2077
|
+
if (axis.scale.isBlank()) {
|
|
2078
|
+
return;
|
|
2079
|
+
} // TODO: TYPE
|
|
2080
|
+
|
|
2081
|
+
|
|
2082
|
+
var splitAreaModel = axisModel.getModel('splitArea');
|
|
2083
|
+
var areaStyleModel = splitAreaModel.getModel('areaStyle');
|
|
2084
|
+
var areaColors = areaStyleModel.get('color');
|
|
2085
|
+
var gridRect = gridModel.coordinateSystem.getRect();
|
|
2086
|
+
var ticksCoords = axis.getTicksCoords({
|
|
2087
|
+
tickModel: splitAreaModel,
|
|
2088
|
+
clamp: true
|
|
2089
|
+
});
|
|
2090
|
+
|
|
2091
|
+
if (!ticksCoords.length) {
|
|
2092
|
+
return;
|
|
2093
|
+
} // For Making appropriate splitArea animation, the color and anid
|
|
2094
|
+
// should be corresponding to previous one if possible.
|
|
2095
|
+
|
|
2096
|
+
|
|
2097
|
+
var areaColorsLen = areaColors.length;
|
|
2098
|
+
var lastSplitAreaColors = inner(axisView).splitAreaColors;
|
|
2099
|
+
var newSplitAreaColors = createHashMap();
|
|
2100
|
+
var colorIndex = 0;
|
|
2101
|
+
|
|
2102
|
+
if (lastSplitAreaColors) {
|
|
2103
|
+
for (var i = 0; i < ticksCoords.length; i++) {
|
|
2104
|
+
var cIndex = lastSplitAreaColors.get(ticksCoords[i].tickValue);
|
|
2105
|
+
|
|
2106
|
+
if (cIndex != null) {
|
|
2107
|
+
colorIndex = (cIndex + (areaColorsLen - 1) * i) % areaColorsLen;
|
|
2108
|
+
break;
|
|
2109
|
+
}
|
|
2110
|
+
}
|
|
2111
|
+
}
|
|
2112
|
+
|
|
2113
|
+
var prev = axis.toGlobalCoord(ticksCoords[0].coord);
|
|
2114
|
+
var areaStyle = areaStyleModel.getAreaStyle();
|
|
2115
|
+
areaColors = isArray(areaColors) ? areaColors : [areaColors];
|
|
2116
|
+
|
|
2117
|
+
for (var i = 1; i < ticksCoords.length; i++) {
|
|
2118
|
+
var tickCoord = axis.toGlobalCoord(ticksCoords[i].coord);
|
|
2119
|
+
var x = void 0;
|
|
2120
|
+
var y = void 0;
|
|
2121
|
+
var width = void 0;
|
|
2122
|
+
var height = void 0;
|
|
2123
|
+
|
|
2124
|
+
if (axis.isHorizontal()) {
|
|
2125
|
+
x = prev;
|
|
2126
|
+
y = gridRect.y;
|
|
2127
|
+
width = tickCoord - x;
|
|
2128
|
+
height = gridRect.height;
|
|
2129
|
+
prev = x + width;
|
|
2130
|
+
} else {
|
|
2131
|
+
x = gridRect.x;
|
|
2132
|
+
y = prev;
|
|
2133
|
+
width = gridRect.width;
|
|
2134
|
+
height = tickCoord - y;
|
|
2135
|
+
prev = y + height;
|
|
2136
|
+
}
|
|
2137
|
+
|
|
2138
|
+
var tickValue = ticksCoords[i - 1].tickValue;
|
|
2139
|
+
tickValue != null && newSplitAreaColors.set(tickValue, colorIndex);
|
|
2140
|
+
axisGroup.add(new Rect({
|
|
2141
|
+
anid: tickValue != null ? 'area_' + tickValue : null,
|
|
2142
|
+
shape: {
|
|
2143
|
+
x: x,
|
|
2144
|
+
y: y,
|
|
2145
|
+
width: width,
|
|
2146
|
+
height: height
|
|
2147
|
+
},
|
|
2148
|
+
style: defaults({
|
|
2149
|
+
fill: areaColors[colorIndex]
|
|
2150
|
+
}, areaStyle),
|
|
2151
|
+
autoBatch: true,
|
|
2152
|
+
silent: true
|
|
2153
|
+
}));
|
|
2154
|
+
colorIndex = (colorIndex + 1) % areaColorsLen;
|
|
2155
|
+
}
|
|
2156
|
+
|
|
2157
|
+
inner(axisView).splitAreaColors = newSplitAreaColors;
|
|
2158
|
+
}
|
|
2159
|
+
function rectCoordAxisHandleRemove(axisView) {
|
|
2160
|
+
inner(axisView).splitAreaColors = null;
|
|
2161
|
+
}
|
|
2162
|
+
|
|
2163
|
+
var axisBuilderAttrs = ['axisLine', 'axisTickLabel', 'axisName'];
|
|
2164
|
+
var selfBuilderAttrs = ['splitArea', 'splitLine', 'minorSplitLine'];
|
|
2165
|
+
|
|
2166
|
+
var CartesianAxisView =
|
|
2167
|
+
/** @class */
|
|
2168
|
+
function (_super) {
|
|
2169
|
+
__extends(CartesianAxisView, _super);
|
|
2170
|
+
|
|
2171
|
+
function CartesianAxisView() {
|
|
2172
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
2173
|
+
|
|
2174
|
+
_this.type = CartesianAxisView.type;
|
|
2175
|
+
_this.axisPointerClass = 'CartesianAxisPointer';
|
|
2176
|
+
return _this;
|
|
2177
|
+
}
|
|
2178
|
+
/**
|
|
2179
|
+
* @override
|
|
2180
|
+
*/
|
|
2181
|
+
|
|
2182
|
+
|
|
2183
|
+
CartesianAxisView.prototype.render = function (axisModel, ecModel, api, payload) {
|
|
2184
|
+
this.group.removeAll();
|
|
2185
|
+
var oldAxisGroup = this._axisGroup;
|
|
2186
|
+
this._axisGroup = new Group();
|
|
2187
|
+
this.group.add(this._axisGroup);
|
|
2188
|
+
|
|
2189
|
+
if (!axisModel.get('show')) {
|
|
2190
|
+
return;
|
|
2191
|
+
}
|
|
2192
|
+
|
|
2193
|
+
var gridModel = axisModel.getCoordSysModel();
|
|
2194
|
+
var layout$1 = layout(gridModel, axisModel);
|
|
2195
|
+
var axisBuilder = new AxisBuilder(axisModel, extend({
|
|
2196
|
+
handleAutoShown: function (elementType) {
|
|
2197
|
+
var cartesians = gridModel.coordinateSystem.getCartesians();
|
|
2198
|
+
|
|
2199
|
+
for (var i = 0; i < cartesians.length; i++) {
|
|
2200
|
+
if (isIntervalOrLogScale(cartesians[i].getOtherAxis(axisModel.axis).scale)) {
|
|
2201
|
+
// Still show axis tick or axisLine if other axis is value / log
|
|
2202
|
+
return true;
|
|
2203
|
+
}
|
|
2204
|
+
} // Not show axisTick or axisLine if other axis is category / time
|
|
2205
|
+
|
|
2206
|
+
|
|
2207
|
+
return false;
|
|
2208
|
+
}
|
|
2209
|
+
}, layout$1));
|
|
2210
|
+
each(axisBuilderAttrs, axisBuilder.add, axisBuilder);
|
|
2211
|
+
|
|
2212
|
+
this._axisGroup.add(axisBuilder.getGroup());
|
|
2213
|
+
|
|
2214
|
+
each(selfBuilderAttrs, function (name) {
|
|
2215
|
+
if (axisModel.get([name, 'show'])) {
|
|
2216
|
+
axisElementBuilders[name](this, this._axisGroup, axisModel, gridModel);
|
|
2217
|
+
}
|
|
2218
|
+
}, this); // THIS is a special case for bar racing chart.
|
|
2219
|
+
// Update the axis label from the natural initial layout to
|
|
2220
|
+
// sorted layout should has no animation.
|
|
2221
|
+
|
|
2222
|
+
var isInitialSortFromBarRacing = payload && payload.type === 'changeAxisOrder' && payload.isInitSort;
|
|
2223
|
+
|
|
2224
|
+
if (!isInitialSortFromBarRacing) {
|
|
2225
|
+
groupTransition(oldAxisGroup, this._axisGroup, axisModel);
|
|
2226
|
+
}
|
|
2227
|
+
|
|
2228
|
+
_super.prototype.render.call(this, axisModel, ecModel, api, payload);
|
|
2229
|
+
};
|
|
2230
|
+
|
|
2231
|
+
CartesianAxisView.prototype.remove = function () {
|
|
2232
|
+
rectCoordAxisHandleRemove(this);
|
|
2233
|
+
};
|
|
2234
|
+
|
|
2235
|
+
CartesianAxisView.type = 'cartesianAxis';
|
|
2236
|
+
return CartesianAxisView;
|
|
2237
|
+
}(AxisView);
|
|
2238
|
+
|
|
2239
|
+
var axisElementBuilders = {
|
|
2240
|
+
splitLine: function (axisView, axisGroup, axisModel, gridModel) {
|
|
2241
|
+
var axis = axisModel.axis;
|
|
2242
|
+
|
|
2243
|
+
if (axis.scale.isBlank()) {
|
|
2244
|
+
return;
|
|
2245
|
+
}
|
|
2246
|
+
|
|
2247
|
+
var splitLineModel = axisModel.getModel('splitLine');
|
|
2248
|
+
var lineStyleModel = splitLineModel.getModel('lineStyle');
|
|
2249
|
+
var lineColors = lineStyleModel.get('color');
|
|
2250
|
+
lineColors = isArray(lineColors) ? lineColors : [lineColors];
|
|
2251
|
+
var gridRect = gridModel.coordinateSystem.getRect();
|
|
2252
|
+
var isHorizontal = axis.isHorizontal();
|
|
2253
|
+
var lineCount = 0;
|
|
2254
|
+
var ticksCoords = axis.getTicksCoords({
|
|
2255
|
+
tickModel: splitLineModel
|
|
2256
|
+
});
|
|
2257
|
+
var p1 = [];
|
|
2258
|
+
var p2 = [];
|
|
2259
|
+
var lineStyle = lineStyleModel.getLineStyle();
|
|
2260
|
+
|
|
2261
|
+
for (var i = 0; i < ticksCoords.length; i++) {
|
|
2262
|
+
var tickCoord = axis.toGlobalCoord(ticksCoords[i].coord);
|
|
2263
|
+
|
|
2264
|
+
if (isHorizontal) {
|
|
2265
|
+
p1[0] = tickCoord;
|
|
2266
|
+
p1[1] = gridRect.y;
|
|
2267
|
+
p2[0] = tickCoord;
|
|
2268
|
+
p2[1] = gridRect.y + gridRect.height;
|
|
2269
|
+
} else {
|
|
2270
|
+
p1[0] = gridRect.x;
|
|
2271
|
+
p1[1] = tickCoord;
|
|
2272
|
+
p2[0] = gridRect.x + gridRect.width;
|
|
2273
|
+
p2[1] = tickCoord;
|
|
2274
|
+
}
|
|
2275
|
+
|
|
2276
|
+
var colorIndex = lineCount++ % lineColors.length;
|
|
2277
|
+
var tickValue = ticksCoords[i].tickValue;
|
|
2278
|
+
var line = new Line({
|
|
2279
|
+
anid: tickValue != null ? 'line_' + ticksCoords[i].tickValue : null,
|
|
2280
|
+
autoBatch: true,
|
|
2281
|
+
shape: {
|
|
2282
|
+
x1: p1[0],
|
|
2283
|
+
y1: p1[1],
|
|
2284
|
+
x2: p2[0],
|
|
2285
|
+
y2: p2[1]
|
|
2286
|
+
},
|
|
2287
|
+
style: defaults({
|
|
2288
|
+
stroke: lineColors[colorIndex]
|
|
2289
|
+
}, lineStyle),
|
|
2290
|
+
silent: true
|
|
2291
|
+
});
|
|
2292
|
+
subPixelOptimizeLine(line.shape, lineStyle.lineWidth);
|
|
2293
|
+
axisGroup.add(line);
|
|
2294
|
+
}
|
|
2295
|
+
},
|
|
2296
|
+
minorSplitLine: function (axisView, axisGroup, axisModel, gridModel) {
|
|
2297
|
+
var axis = axisModel.axis;
|
|
2298
|
+
var minorSplitLineModel = axisModel.getModel('minorSplitLine');
|
|
2299
|
+
var lineStyleModel = minorSplitLineModel.getModel('lineStyle');
|
|
2300
|
+
var gridRect = gridModel.coordinateSystem.getRect();
|
|
2301
|
+
var isHorizontal = axis.isHorizontal();
|
|
2302
|
+
var minorTicksCoords = axis.getMinorTicksCoords();
|
|
2303
|
+
|
|
2304
|
+
if (!minorTicksCoords.length) {
|
|
2305
|
+
return;
|
|
2306
|
+
}
|
|
2307
|
+
|
|
2308
|
+
var p1 = [];
|
|
2309
|
+
var p2 = [];
|
|
2310
|
+
var lineStyle = lineStyleModel.getLineStyle();
|
|
2311
|
+
|
|
2312
|
+
for (var i = 0; i < minorTicksCoords.length; i++) {
|
|
2313
|
+
for (var k = 0; k < minorTicksCoords[i].length; k++) {
|
|
2314
|
+
var tickCoord = axis.toGlobalCoord(minorTicksCoords[i][k].coord);
|
|
2315
|
+
|
|
2316
|
+
if (isHorizontal) {
|
|
2317
|
+
p1[0] = tickCoord;
|
|
2318
|
+
p1[1] = gridRect.y;
|
|
2319
|
+
p2[0] = tickCoord;
|
|
2320
|
+
p2[1] = gridRect.y + gridRect.height;
|
|
2321
|
+
} else {
|
|
2322
|
+
p1[0] = gridRect.x;
|
|
2323
|
+
p1[1] = tickCoord;
|
|
2324
|
+
p2[0] = gridRect.x + gridRect.width;
|
|
2325
|
+
p2[1] = tickCoord;
|
|
2326
|
+
}
|
|
2327
|
+
|
|
2328
|
+
var line = new Line({
|
|
2329
|
+
anid: 'minor_line_' + minorTicksCoords[i][k].tickValue,
|
|
2330
|
+
autoBatch: true,
|
|
2331
|
+
shape: {
|
|
2332
|
+
x1: p1[0],
|
|
2333
|
+
y1: p1[1],
|
|
2334
|
+
x2: p2[0],
|
|
2335
|
+
y2: p2[1]
|
|
2336
|
+
},
|
|
2337
|
+
style: lineStyle,
|
|
2338
|
+
silent: true
|
|
2339
|
+
});
|
|
2340
|
+
subPixelOptimizeLine(line.shape, lineStyle.lineWidth);
|
|
2341
|
+
axisGroup.add(line);
|
|
2342
|
+
}
|
|
2343
|
+
}
|
|
2344
|
+
},
|
|
2345
|
+
splitArea: function (axisView, axisGroup, axisModel, gridModel) {
|
|
2346
|
+
rectCoordAxisBuildSplitArea(axisView, axisGroup, axisModel, gridModel);
|
|
2347
|
+
}
|
|
2348
|
+
};
|
|
2349
|
+
|
|
2350
|
+
var CartesianXAxisView =
|
|
2351
|
+
/** @class */
|
|
2352
|
+
function (_super) {
|
|
2353
|
+
__extends(CartesianXAxisView, _super);
|
|
2354
|
+
|
|
2355
|
+
function CartesianXAxisView() {
|
|
2356
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
2357
|
+
|
|
2358
|
+
_this.type = CartesianXAxisView.type;
|
|
2359
|
+
return _this;
|
|
2360
|
+
}
|
|
2361
|
+
|
|
2362
|
+
CartesianXAxisView.type = 'xAxis';
|
|
2363
|
+
return CartesianXAxisView;
|
|
2364
|
+
}(CartesianAxisView);
|
|
2365
|
+
|
|
2366
|
+
var CartesianYAxisView =
|
|
2367
|
+
/** @class */
|
|
2368
|
+
function (_super) {
|
|
2369
|
+
__extends(CartesianYAxisView, _super);
|
|
2370
|
+
|
|
2371
|
+
function CartesianYAxisView() {
|
|
2372
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
2373
|
+
|
|
2374
|
+
_this.type = CartesianXAxisView.type;
|
|
2375
|
+
return _this;
|
|
2376
|
+
}
|
|
2377
|
+
|
|
2378
|
+
CartesianYAxisView.type = 'yAxis';
|
|
2379
|
+
return CartesianYAxisView;
|
|
2380
|
+
}(CartesianAxisView);
|
|
2381
|
+
|
|
2382
|
+
var GridView =
|
|
2383
|
+
/** @class */
|
|
2384
|
+
function (_super) {
|
|
2385
|
+
__extends(GridView, _super);
|
|
2386
|
+
|
|
2387
|
+
function GridView() {
|
|
2388
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
2389
|
+
|
|
2390
|
+
_this.type = 'grid';
|
|
2391
|
+
return _this;
|
|
2392
|
+
}
|
|
2393
|
+
|
|
2394
|
+
GridView.prototype.render = function (gridModel, ecModel) {
|
|
2395
|
+
this.group.removeAll();
|
|
2396
|
+
|
|
2397
|
+
if (gridModel.get('show')) {
|
|
2398
|
+
this.group.add(new Rect({
|
|
2399
|
+
shape: gridModel.coordinateSystem.getRect(),
|
|
2400
|
+
style: defaults({
|
|
2401
|
+
fill: gridModel.get('backgroundColor')
|
|
2402
|
+
}, gridModel.getItemStyle()),
|
|
2403
|
+
silent: true,
|
|
2404
|
+
z2: -1
|
|
2405
|
+
}));
|
|
2406
|
+
}
|
|
2407
|
+
};
|
|
2408
|
+
|
|
2409
|
+
GridView.type = 'grid';
|
|
2410
|
+
return GridView;
|
|
2411
|
+
}(ComponentView);
|
|
2412
|
+
|
|
2413
|
+
var extraOption = {
|
|
2414
|
+
// gridIndex: 0,
|
|
2415
|
+
// gridId: '',
|
|
2416
|
+
offset: 0
|
|
2417
|
+
};
|
|
2418
|
+
function install$2(registers) {
|
|
2419
|
+
registers.registerComponentView(GridView);
|
|
2420
|
+
registers.registerComponentModel(GridModel);
|
|
2421
|
+
registers.registerCoordinateSystem('cartesian2d', Grid);
|
|
2422
|
+
axisModelCreator(registers, 'x', CartesianAxisModel, extraOption);
|
|
2423
|
+
axisModelCreator(registers, 'y', CartesianAxisModel, extraOption);
|
|
2424
|
+
registers.registerComponentView(CartesianXAxisView);
|
|
2425
|
+
registers.registerComponentView(CartesianYAxisView);
|
|
2426
|
+
registers.registerPreprocessor(function (option) {
|
|
2427
|
+
// Only create grid when need
|
|
2428
|
+
if (option.xAxis && option.yAxis && !option.grid) {
|
|
2429
|
+
option.grid = {};
|
|
2430
|
+
}
|
|
2431
|
+
});
|
|
2432
|
+
}
|
|
2433
|
+
|
|
2434
|
+
function install$1(registers) {
|
|
2435
|
+
use(install$2);
|
|
2436
|
+
use(install$3);
|
|
2437
|
+
}
|
|
2438
|
+
|
|
2439
|
+
var TitleModel =
|
|
2440
|
+
/** @class */
|
|
2441
|
+
function (_super) {
|
|
2442
|
+
__extends(TitleModel, _super);
|
|
2443
|
+
|
|
2444
|
+
function TitleModel() {
|
|
2445
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
2446
|
+
|
|
2447
|
+
_this.type = TitleModel.type;
|
|
2448
|
+
_this.layoutMode = {
|
|
2449
|
+
type: 'box',
|
|
2450
|
+
ignoreSize: true
|
|
2451
|
+
};
|
|
2452
|
+
return _this;
|
|
2453
|
+
}
|
|
2454
|
+
|
|
2455
|
+
TitleModel.type = 'title';
|
|
2456
|
+
TitleModel.defaultOption = {
|
|
2457
|
+
// zlevel: 0,
|
|
2458
|
+
z: 6,
|
|
2459
|
+
show: true,
|
|
2460
|
+
text: '',
|
|
2461
|
+
target: 'blank',
|
|
2462
|
+
subtext: '',
|
|
2463
|
+
subtarget: 'blank',
|
|
2464
|
+
left: 0,
|
|
2465
|
+
top: 0,
|
|
2466
|
+
backgroundColor: 'rgba(0,0,0,0)',
|
|
2467
|
+
borderColor: '#ccc',
|
|
2468
|
+
borderWidth: 0,
|
|
2469
|
+
padding: 5,
|
|
2470
|
+
itemGap: 10,
|
|
2471
|
+
textStyle: {
|
|
2472
|
+
fontSize: 18,
|
|
2473
|
+
fontWeight: 'bold',
|
|
2474
|
+
color: '#464646'
|
|
2475
|
+
},
|
|
2476
|
+
subtextStyle: {
|
|
2477
|
+
fontSize: 12,
|
|
2478
|
+
color: '#6E7079'
|
|
2479
|
+
}
|
|
2480
|
+
};
|
|
2481
|
+
return TitleModel;
|
|
2482
|
+
}(ComponentModel); // View
|
|
2483
|
+
|
|
2484
|
+
|
|
2485
|
+
var TitleView =
|
|
2486
|
+
/** @class */
|
|
2487
|
+
function (_super) {
|
|
2488
|
+
__extends(TitleView, _super);
|
|
2489
|
+
|
|
2490
|
+
function TitleView() {
|
|
2491
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
2492
|
+
|
|
2493
|
+
_this.type = TitleView.type;
|
|
2494
|
+
return _this;
|
|
2495
|
+
}
|
|
2496
|
+
|
|
2497
|
+
TitleView.prototype.render = function (titleModel, ecModel, api) {
|
|
2498
|
+
this.group.removeAll();
|
|
2499
|
+
|
|
2500
|
+
if (!titleModel.get('show')) {
|
|
2501
|
+
return;
|
|
2502
|
+
}
|
|
2503
|
+
|
|
2504
|
+
var group = this.group;
|
|
2505
|
+
var textStyleModel = titleModel.getModel('textStyle');
|
|
2506
|
+
var subtextStyleModel = titleModel.getModel('subtextStyle');
|
|
2507
|
+
var textAlign = titleModel.get('textAlign');
|
|
2508
|
+
var textVerticalAlign = retrieve2(titleModel.get('textBaseline'), titleModel.get('textVerticalAlign'));
|
|
2509
|
+
var textEl = new ZRText({
|
|
2510
|
+
style: createTextStyle(textStyleModel, {
|
|
2511
|
+
text: titleModel.get('text'),
|
|
2512
|
+
fill: textStyleModel.getTextColor()
|
|
2513
|
+
}, {
|
|
2514
|
+
disableBox: true
|
|
2515
|
+
}),
|
|
2516
|
+
z2: 10
|
|
2517
|
+
});
|
|
2518
|
+
var textRect = textEl.getBoundingRect();
|
|
2519
|
+
var subText = titleModel.get('subtext');
|
|
2520
|
+
var subTextEl = new ZRText({
|
|
2521
|
+
style: createTextStyle(subtextStyleModel, {
|
|
2522
|
+
text: subText,
|
|
2523
|
+
fill: subtextStyleModel.getTextColor(),
|
|
2524
|
+
y: textRect.height + titleModel.get('itemGap'),
|
|
2525
|
+
verticalAlign: 'top'
|
|
2526
|
+
}, {
|
|
2527
|
+
disableBox: true
|
|
2528
|
+
}),
|
|
2529
|
+
z2: 10
|
|
2530
|
+
});
|
|
2531
|
+
var link = titleModel.get('link');
|
|
2532
|
+
var sublink = titleModel.get('sublink');
|
|
2533
|
+
var triggerEvent = titleModel.get('triggerEvent', true);
|
|
2534
|
+
textEl.silent = !link && !triggerEvent;
|
|
2535
|
+
subTextEl.silent = !sublink && !triggerEvent;
|
|
2536
|
+
|
|
2537
|
+
if (link) {
|
|
2538
|
+
textEl.on('click', function () {
|
|
2539
|
+
windowOpen(link, '_' + titleModel.get('target'));
|
|
2540
|
+
});
|
|
2541
|
+
}
|
|
2542
|
+
|
|
2543
|
+
if (sublink) {
|
|
2544
|
+
subTextEl.on('click', function () {
|
|
2545
|
+
windowOpen(sublink, '_' + titleModel.get('subtarget'));
|
|
2546
|
+
});
|
|
2547
|
+
}
|
|
2548
|
+
|
|
2549
|
+
getECData(textEl).eventData = getECData(subTextEl).eventData = triggerEvent ? {
|
|
2550
|
+
componentType: 'title',
|
|
2551
|
+
componentIndex: titleModel.componentIndex
|
|
2552
|
+
} : null;
|
|
2553
|
+
group.add(textEl);
|
|
2554
|
+
subText && group.add(subTextEl); // If no subText, but add subTextEl, there will be an empty line.
|
|
2555
|
+
|
|
2556
|
+
var groupRect = group.getBoundingRect();
|
|
2557
|
+
var layoutOption = titleModel.getBoxLayoutParams();
|
|
2558
|
+
layoutOption.width = groupRect.width;
|
|
2559
|
+
layoutOption.height = groupRect.height;
|
|
2560
|
+
var layoutRect = getLayoutRect(layoutOption, {
|
|
2561
|
+
width: api.getWidth(),
|
|
2562
|
+
height: api.getHeight()
|
|
2563
|
+
}, titleModel.get('padding')); // Adjust text align based on position
|
|
2564
|
+
|
|
2565
|
+
if (!textAlign) {
|
|
2566
|
+
// Align left if title is on the left. center and right is same
|
|
2567
|
+
textAlign = titleModel.get('left') || titleModel.get('right'); // @ts-ignore
|
|
2568
|
+
|
|
2569
|
+
if (textAlign === 'middle') {
|
|
2570
|
+
textAlign = 'center';
|
|
2571
|
+
} // Adjust layout by text align
|
|
2572
|
+
|
|
2573
|
+
|
|
2574
|
+
if (textAlign === 'right') {
|
|
2575
|
+
layoutRect.x += layoutRect.width;
|
|
2576
|
+
} else if (textAlign === 'center') {
|
|
2577
|
+
layoutRect.x += layoutRect.width / 2;
|
|
2578
|
+
}
|
|
2579
|
+
}
|
|
2580
|
+
|
|
2581
|
+
if (!textVerticalAlign) {
|
|
2582
|
+
textVerticalAlign = titleModel.get('top') || titleModel.get('bottom'); // @ts-ignore
|
|
2583
|
+
|
|
2584
|
+
if (textVerticalAlign === 'center') {
|
|
2585
|
+
textVerticalAlign = 'middle';
|
|
2586
|
+
}
|
|
2587
|
+
|
|
2588
|
+
if (textVerticalAlign === 'bottom') {
|
|
2589
|
+
layoutRect.y += layoutRect.height;
|
|
2590
|
+
} else if (textVerticalAlign === 'middle') {
|
|
2591
|
+
layoutRect.y += layoutRect.height / 2;
|
|
2592
|
+
}
|
|
2593
|
+
|
|
2594
|
+
textVerticalAlign = textVerticalAlign || 'top';
|
|
2595
|
+
}
|
|
2596
|
+
|
|
2597
|
+
group.x = layoutRect.x;
|
|
2598
|
+
group.y = layoutRect.y;
|
|
2599
|
+
group.markRedraw();
|
|
2600
|
+
var alignStyle = {
|
|
2601
|
+
align: textAlign,
|
|
2602
|
+
verticalAlign: textVerticalAlign
|
|
2603
|
+
};
|
|
2604
|
+
textEl.setStyle(alignStyle);
|
|
2605
|
+
subTextEl.setStyle(alignStyle); // Render background
|
|
2606
|
+
// Get groupRect again because textAlign has been changed
|
|
2607
|
+
|
|
2608
|
+
groupRect = group.getBoundingRect();
|
|
2609
|
+
var padding = layoutRect.margin;
|
|
2610
|
+
var style = titleModel.getItemStyle(['color', 'opacity']);
|
|
2611
|
+
style.fill = titleModel.get('backgroundColor');
|
|
2612
|
+
var rect = new Rect({
|
|
2613
|
+
shape: {
|
|
2614
|
+
x: groupRect.x - padding[3],
|
|
2615
|
+
y: groupRect.y - padding[0],
|
|
2616
|
+
width: groupRect.width + padding[1] + padding[3],
|
|
2617
|
+
height: groupRect.height + padding[0] + padding[2],
|
|
2618
|
+
r: titleModel.get('borderRadius')
|
|
2619
|
+
},
|
|
2620
|
+
style: style,
|
|
2621
|
+
subPixelOptimize: true,
|
|
2622
|
+
silent: true
|
|
2623
|
+
});
|
|
2624
|
+
group.add(rect);
|
|
2625
|
+
};
|
|
2626
|
+
|
|
2627
|
+
TitleView.type = 'title';
|
|
2628
|
+
return TitleView;
|
|
2629
|
+
}(ComponentView);
|
|
2630
|
+
|
|
2631
|
+
function install(registers) {
|
|
2632
|
+
registers.registerComponentModel(TitleModel);
|
|
2633
|
+
registers.registerComponentView(TitleView);
|
|
2634
|
+
}
|
|
2635
|
+
|
|
2636
|
+
/**
|
|
2637
|
+
* @return label string. Not null/undefined
|
|
2638
|
+
*/
|
|
2639
|
+
|
|
2640
|
+
function getDefaultLabel(data, dataIndex) {
|
|
2641
|
+
var labelDims = data.mapDimensionsAll('defaultedLabel');
|
|
2642
|
+
var len = labelDims.length; // Simple optimization (in lots of cases, label dims length is 1)
|
|
2643
|
+
|
|
2644
|
+
if (len === 1) {
|
|
2645
|
+
var rawVal = retrieveRawValue(data, dataIndex, labelDims[0]);
|
|
2646
|
+
return rawVal != null ? rawVal + '' : null;
|
|
2647
|
+
} else if (len) {
|
|
2648
|
+
var vals = [];
|
|
2649
|
+
|
|
2650
|
+
for (var i = 0; i < labelDims.length; i++) {
|
|
2651
|
+
vals.push(retrieveRawValue(data, dataIndex, labelDims[i]));
|
|
2652
|
+
}
|
|
2653
|
+
|
|
2654
|
+
return vals.join(' ');
|
|
2655
|
+
}
|
|
2656
|
+
}
|
|
2657
|
+
function getDefaultInterpolatedLabel(data, interpolatedValue) {
|
|
2658
|
+
var labelDims = data.mapDimensionsAll('defaultedLabel');
|
|
2659
|
+
|
|
2660
|
+
if (!isArray(interpolatedValue)) {
|
|
2661
|
+
return interpolatedValue + '';
|
|
2662
|
+
}
|
|
2663
|
+
|
|
2664
|
+
var vals = [];
|
|
2665
|
+
|
|
2666
|
+
for (var i = 0; i < labelDims.length; i++) {
|
|
2667
|
+
var dimIndex = data.getDimensionIndex(labelDims[i]);
|
|
2668
|
+
|
|
2669
|
+
if (dimIndex >= 0) {
|
|
2670
|
+
vals.push(interpolatedValue[dimIndex]);
|
|
2671
|
+
}
|
|
2672
|
+
}
|
|
2673
|
+
|
|
2674
|
+
return vals.join(' ');
|
|
2675
|
+
}
|
|
2676
|
+
|
|
2677
|
+
/*
|
|
2678
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
|
2679
|
+
* or more contributor license agreements. See the NOTICE file
|
|
2680
|
+
* distributed with this work for additional information
|
|
2681
|
+
* regarding copyright ownership. The ASF licenses this file
|
|
2682
|
+
* to you under the Apache License, Version 2.0 (the
|
|
2683
|
+
* "License"); you may not use this file except in compliance
|
|
2684
|
+
* with the License. You may obtain a copy of the License at
|
|
2685
|
+
*
|
|
2686
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2687
|
+
*
|
|
2688
|
+
* Unless required by applicable law or agreed to in writing,
|
|
2689
|
+
* software distributed under the License is distributed on an
|
|
2690
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
2691
|
+
* KIND, either express or implied. See the License for the
|
|
2692
|
+
* specific language governing permissions and limitations
|
|
2693
|
+
* under the License.
|
|
2694
|
+
*/
|
|
2695
|
+
|
|
2696
|
+
|
|
2697
|
+
/**
|
|
2698
|
+
* AUTO-GENERATED FILE. DO NOT MODIFY.
|
|
2699
|
+
*/
|
|
2700
|
+
|
|
2701
|
+
/*
|
|
2702
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
|
2703
|
+
* or more contributor license agreements. See the NOTICE file
|
|
2704
|
+
* distributed with this work for additional information
|
|
2705
|
+
* regarding copyright ownership. The ASF licenses this file
|
|
2706
|
+
* to you under the Apache License, Version 2.0 (the
|
|
2707
|
+
* "License"); you may not use this file except in compliance
|
|
2708
|
+
* with the License. You may obtain a copy of the License at
|
|
2709
|
+
*
|
|
2710
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2711
|
+
*
|
|
2712
|
+
* Unless required by applicable law or agreed to in writing,
|
|
2713
|
+
* software distributed under the License is distributed on an
|
|
2714
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
2715
|
+
* KIND, either express or implied. See the License for the
|
|
2716
|
+
* specific language governing permissions and limitations
|
|
2717
|
+
* under the License.
|
|
2718
|
+
*/
|
|
2719
|
+
function isCoordinateSystemType(coordSys, type) {
|
|
2720
|
+
return coordSys.type === type;
|
|
2721
|
+
}
|
|
2722
|
+
|
|
2723
|
+
function createGridClipPath(cartesian, hasAnimation, seriesModel, done, during) {
|
|
2724
|
+
var rect = cartesian.getArea();
|
|
2725
|
+
var x = rect.x;
|
|
2726
|
+
var y = rect.y;
|
|
2727
|
+
var width = rect.width;
|
|
2728
|
+
var height = rect.height;
|
|
2729
|
+
var lineWidth = seriesModel.get(['lineStyle', 'width']) || 2; // Expand the clip path a bit to avoid the border is clipped and looks thinner
|
|
2730
|
+
|
|
2731
|
+
x -= lineWidth / 2;
|
|
2732
|
+
y -= lineWidth / 2;
|
|
2733
|
+
width += lineWidth;
|
|
2734
|
+
height += lineWidth; // fix: https://github.com/apache/incubator-echarts/issues/11369
|
|
2735
|
+
|
|
2736
|
+
x = Math.floor(x);
|
|
2737
|
+
width = Math.round(width);
|
|
2738
|
+
var clipPath = new Rect({
|
|
2739
|
+
shape: {
|
|
2740
|
+
x: x,
|
|
2741
|
+
y: y,
|
|
2742
|
+
width: width,
|
|
2743
|
+
height: height
|
|
2744
|
+
}
|
|
2745
|
+
});
|
|
2746
|
+
|
|
2747
|
+
if (hasAnimation) {
|
|
2748
|
+
var baseAxis = cartesian.getBaseAxis();
|
|
2749
|
+
var isHorizontal = baseAxis.isHorizontal();
|
|
2750
|
+
var isAxisInversed = baseAxis.inverse;
|
|
2751
|
+
|
|
2752
|
+
if (isHorizontal) {
|
|
2753
|
+
if (isAxisInversed) {
|
|
2754
|
+
clipPath.shape.x += width;
|
|
2755
|
+
}
|
|
2756
|
+
|
|
2757
|
+
clipPath.shape.width = 0;
|
|
2758
|
+
} else {
|
|
2759
|
+
if (!isAxisInversed) {
|
|
2760
|
+
clipPath.shape.y += height;
|
|
2761
|
+
}
|
|
2762
|
+
|
|
2763
|
+
clipPath.shape.height = 0;
|
|
2764
|
+
}
|
|
2765
|
+
|
|
2766
|
+
var duringCb = isFunction(during) ? function (percent) {
|
|
2767
|
+
during(percent, clipPath);
|
|
2768
|
+
} : null;
|
|
2769
|
+
initProps(clipPath, {
|
|
2770
|
+
shape: {
|
|
2771
|
+
width: width,
|
|
2772
|
+
height: height,
|
|
2773
|
+
x: x,
|
|
2774
|
+
y: y
|
|
2775
|
+
}
|
|
2776
|
+
}, seriesModel, null, done, duringCb);
|
|
2777
|
+
}
|
|
2778
|
+
|
|
2779
|
+
return clipPath;
|
|
2780
|
+
}
|
|
2781
|
+
|
|
2782
|
+
function createPolarClipPath(polar, hasAnimation, seriesModel) {
|
|
2783
|
+
var sectorArea = polar.getArea(); // Avoid float number rounding error for symbol on the edge of axis extent.
|
|
2784
|
+
|
|
2785
|
+
var r0 = round(sectorArea.r0, 1);
|
|
2786
|
+
var r = round(sectorArea.r, 1);
|
|
2787
|
+
var clipPath = new Sector({
|
|
2788
|
+
shape: {
|
|
2789
|
+
cx: round(polar.cx, 1),
|
|
2790
|
+
cy: round(polar.cy, 1),
|
|
2791
|
+
r0: r0,
|
|
2792
|
+
r: r,
|
|
2793
|
+
startAngle: sectorArea.startAngle,
|
|
2794
|
+
endAngle: sectorArea.endAngle,
|
|
2795
|
+
clockwise: sectorArea.clockwise
|
|
2796
|
+
}
|
|
2797
|
+
});
|
|
2798
|
+
|
|
2799
|
+
if (hasAnimation) {
|
|
2800
|
+
var isRadial = polar.getBaseAxis().dim === 'angle';
|
|
2801
|
+
|
|
2802
|
+
if (isRadial) {
|
|
2803
|
+
clipPath.shape.endAngle = sectorArea.startAngle;
|
|
2804
|
+
} else {
|
|
2805
|
+
clipPath.shape.r = r0;
|
|
2806
|
+
}
|
|
2807
|
+
|
|
2808
|
+
initProps(clipPath, {
|
|
2809
|
+
shape: {
|
|
2810
|
+
endAngle: sectorArea.endAngle,
|
|
2811
|
+
r: r
|
|
2812
|
+
}
|
|
2813
|
+
}, seriesModel);
|
|
2814
|
+
}
|
|
2815
|
+
|
|
2816
|
+
return clipPath;
|
|
2817
|
+
}
|
|
2818
|
+
|
|
2819
|
+
function createClipPath(coordSys, hasAnimation, seriesModel, done, during) {
|
|
2820
|
+
if (!coordSys) {
|
|
2821
|
+
return null;
|
|
2822
|
+
} else if (coordSys.type === 'polar') {
|
|
2823
|
+
return createPolarClipPath(coordSys, hasAnimation, seriesModel);
|
|
2824
|
+
} else if (coordSys.type === 'cartesian2d') {
|
|
2825
|
+
return createGridClipPath(coordSys, hasAnimation, seriesModel, done, during);
|
|
2826
|
+
}
|
|
2827
|
+
|
|
2828
|
+
return null;
|
|
2829
|
+
}
|
|
2830
|
+
|
|
2831
|
+
var samplers = {
|
|
2832
|
+
average: function (frame) {
|
|
2833
|
+
var sum = 0;
|
|
2834
|
+
var count = 0;
|
|
2835
|
+
|
|
2836
|
+
for (var i = 0; i < frame.length; i++) {
|
|
2837
|
+
if (!isNaN(frame[i])) {
|
|
2838
|
+
sum += frame[i];
|
|
2839
|
+
count++;
|
|
2840
|
+
}
|
|
2841
|
+
} // Return NaN if count is 0
|
|
2842
|
+
|
|
2843
|
+
|
|
2844
|
+
return count === 0 ? NaN : sum / count;
|
|
2845
|
+
},
|
|
2846
|
+
sum: function (frame) {
|
|
2847
|
+
var sum = 0;
|
|
2848
|
+
|
|
2849
|
+
for (var i = 0; i < frame.length; i++) {
|
|
2850
|
+
// Ignore NaN
|
|
2851
|
+
sum += frame[i] || 0;
|
|
2852
|
+
}
|
|
2853
|
+
|
|
2854
|
+
return sum;
|
|
2855
|
+
},
|
|
2856
|
+
max: function (frame) {
|
|
2857
|
+
var max = -Infinity;
|
|
2858
|
+
|
|
2859
|
+
for (var i = 0; i < frame.length; i++) {
|
|
2860
|
+
frame[i] > max && (max = frame[i]);
|
|
2861
|
+
} // NaN will cause illegal axis extent.
|
|
2862
|
+
|
|
2863
|
+
|
|
2864
|
+
return isFinite(max) ? max : NaN;
|
|
2865
|
+
},
|
|
2866
|
+
min: function (frame) {
|
|
2867
|
+
var min = Infinity;
|
|
2868
|
+
|
|
2869
|
+
for (var i = 0; i < frame.length; i++) {
|
|
2870
|
+
frame[i] < min && (min = frame[i]);
|
|
2871
|
+
} // NaN will cause illegal axis extent.
|
|
2872
|
+
|
|
2873
|
+
|
|
2874
|
+
return isFinite(min) ? min : NaN;
|
|
2875
|
+
},
|
|
2876
|
+
// TODO
|
|
2877
|
+
// Median
|
|
2878
|
+
nearest: function (frame) {
|
|
2879
|
+
return frame[0];
|
|
2880
|
+
}
|
|
2881
|
+
};
|
|
2882
|
+
|
|
2883
|
+
var indexSampler = function (frame) {
|
|
2884
|
+
return Math.round(frame.length / 2);
|
|
2885
|
+
};
|
|
2886
|
+
|
|
2887
|
+
function dataSample(seriesType) {
|
|
2888
|
+
return {
|
|
2889
|
+
seriesType: seriesType,
|
|
2890
|
+
// FIXME:TS never used, so comment it
|
|
2891
|
+
// modifyOutputEnd: true,
|
|
2892
|
+
reset: function (seriesModel, ecModel, api) {
|
|
2893
|
+
var data = seriesModel.getData();
|
|
2894
|
+
var sampling = seriesModel.get('sampling');
|
|
2895
|
+
var coordSys = seriesModel.coordinateSystem;
|
|
2896
|
+
var count = data.count(); // Only cartesian2d support down sampling. Disable it when there is few data.
|
|
2897
|
+
|
|
2898
|
+
if (count > 10 && coordSys.type === 'cartesian2d' && sampling) {
|
|
2899
|
+
var baseAxis = coordSys.getBaseAxis();
|
|
2900
|
+
var valueAxis = coordSys.getOtherAxis(baseAxis);
|
|
2901
|
+
var extent = baseAxis.getExtent();
|
|
2902
|
+
var dpr = api.getDevicePixelRatio(); // Coordinste system has been resized
|
|
2903
|
+
|
|
2904
|
+
var size = Math.abs(extent[1] - extent[0]) * (dpr || 1);
|
|
2905
|
+
var rate = Math.round(count / size);
|
|
2906
|
+
|
|
2907
|
+
if (isFinite(rate) && rate > 1) {
|
|
2908
|
+
if (sampling === 'lttb') {
|
|
2909
|
+
seriesModel.setData(data.lttbDownSample(data.mapDimension(valueAxis.dim), 1 / rate));
|
|
2910
|
+
}
|
|
2911
|
+
|
|
2912
|
+
var sampler = void 0;
|
|
2913
|
+
|
|
2914
|
+
if (isString(sampling)) {
|
|
2915
|
+
sampler = samplers[sampling];
|
|
2916
|
+
} else if (isFunction(sampling)) {
|
|
2917
|
+
sampler = sampling;
|
|
2918
|
+
}
|
|
2919
|
+
|
|
2920
|
+
if (sampler) {
|
|
2921
|
+
// Only support sample the first dim mapped from value axis.
|
|
2922
|
+
seriesModel.setData(data.downSample(data.mapDimension(valueAxis.dim), 1 / rate, sampler, indexSampler));
|
|
2923
|
+
}
|
|
2924
|
+
}
|
|
2925
|
+
}
|
|
2926
|
+
}
|
|
2927
|
+
};
|
|
2928
|
+
}
|
|
2929
|
+
|
|
2930
|
+
var ValidColorNames;
|
|
2931
|
+
(function (ValidColorNames) {
|
|
2932
|
+
ValidColorNames[ValidColorNames["aliceblue"] = 0] = "aliceblue";
|
|
2933
|
+
ValidColorNames[ValidColorNames["antiquewhite"] = 1] = "antiquewhite";
|
|
2934
|
+
ValidColorNames[ValidColorNames["aqua"] = 2] = "aqua";
|
|
2935
|
+
ValidColorNames[ValidColorNames["aquamarine"] = 3] = "aquamarine";
|
|
2936
|
+
ValidColorNames[ValidColorNames["azure"] = 4] = "azure";
|
|
2937
|
+
ValidColorNames[ValidColorNames["beige"] = 5] = "beige";
|
|
2938
|
+
ValidColorNames[ValidColorNames["bisque"] = 6] = "bisque";
|
|
2939
|
+
ValidColorNames[ValidColorNames["black"] = 7] = "black";
|
|
2940
|
+
ValidColorNames[ValidColorNames["blanchedalmond"] = 8] = "blanchedalmond";
|
|
2941
|
+
ValidColorNames[ValidColorNames["blue"] = 9] = "blue";
|
|
2942
|
+
ValidColorNames[ValidColorNames["blueviolet"] = 10] = "blueviolet";
|
|
2943
|
+
ValidColorNames[ValidColorNames["brown"] = 11] = "brown";
|
|
2944
|
+
ValidColorNames[ValidColorNames["burlywood"] = 12] = "burlywood";
|
|
2945
|
+
ValidColorNames[ValidColorNames["cadetblue"] = 13] = "cadetblue";
|
|
2946
|
+
ValidColorNames[ValidColorNames["chartreuse"] = 14] = "chartreuse";
|
|
2947
|
+
ValidColorNames[ValidColorNames["chocolate"] = 15] = "chocolate";
|
|
2948
|
+
ValidColorNames[ValidColorNames["coral"] = 16] = "coral";
|
|
2949
|
+
ValidColorNames[ValidColorNames["cornflowerblue"] = 17] = "cornflowerblue";
|
|
2950
|
+
ValidColorNames[ValidColorNames["cornsilk"] = 18] = "cornsilk";
|
|
2951
|
+
ValidColorNames[ValidColorNames["crimson"] = 19] = "crimson";
|
|
2952
|
+
ValidColorNames[ValidColorNames["cyan"] = 20] = "cyan";
|
|
2953
|
+
ValidColorNames[ValidColorNames["darkblue"] = 21] = "darkblue";
|
|
2954
|
+
ValidColorNames[ValidColorNames["darkcyan"] = 22] = "darkcyan";
|
|
2955
|
+
ValidColorNames[ValidColorNames["darkgoldenrod"] = 23] = "darkgoldenrod";
|
|
2956
|
+
ValidColorNames[ValidColorNames["darkgray"] = 24] = "darkgray";
|
|
2957
|
+
ValidColorNames[ValidColorNames["darkgreen"] = 25] = "darkgreen";
|
|
2958
|
+
ValidColorNames[ValidColorNames["darkkhaki"] = 26] = "darkkhaki";
|
|
2959
|
+
ValidColorNames[ValidColorNames["darkmagenta"] = 27] = "darkmagenta";
|
|
2960
|
+
ValidColorNames[ValidColorNames["darkolivegreen"] = 28] = "darkolivegreen";
|
|
2961
|
+
ValidColorNames[ValidColorNames["darkorange"] = 29] = "darkorange";
|
|
2962
|
+
ValidColorNames[ValidColorNames["darkorchid"] = 30] = "darkorchid";
|
|
2963
|
+
ValidColorNames[ValidColorNames["darkred"] = 31] = "darkred";
|
|
2964
|
+
ValidColorNames[ValidColorNames["darksalmon"] = 32] = "darksalmon";
|
|
2965
|
+
ValidColorNames[ValidColorNames["darkseagreen"] = 33] = "darkseagreen";
|
|
2966
|
+
ValidColorNames[ValidColorNames["darkslateblue"] = 34] = "darkslateblue";
|
|
2967
|
+
ValidColorNames[ValidColorNames["darkslategray"] = 35] = "darkslategray";
|
|
2968
|
+
ValidColorNames[ValidColorNames["darkturquoise"] = 36] = "darkturquoise";
|
|
2969
|
+
ValidColorNames[ValidColorNames["darkviolet"] = 37] = "darkviolet";
|
|
2970
|
+
ValidColorNames[ValidColorNames["deeppink"] = 38] = "deeppink";
|
|
2971
|
+
ValidColorNames[ValidColorNames["deepskyblue"] = 39] = "deepskyblue";
|
|
2972
|
+
ValidColorNames[ValidColorNames["dimgray"] = 40] = "dimgray";
|
|
2973
|
+
ValidColorNames[ValidColorNames["dodgerblue"] = 41] = "dodgerblue";
|
|
2974
|
+
ValidColorNames[ValidColorNames["firebrick"] = 42] = "firebrick";
|
|
2975
|
+
ValidColorNames[ValidColorNames["floralwhite"] = 43] = "floralwhite";
|
|
2976
|
+
ValidColorNames[ValidColorNames["forestgreen"] = 44] = "forestgreen";
|
|
2977
|
+
ValidColorNames[ValidColorNames["fuchsia"] = 45] = "fuchsia";
|
|
2978
|
+
ValidColorNames[ValidColorNames["gainsboro"] = 46] = "gainsboro";
|
|
2979
|
+
ValidColorNames[ValidColorNames["ghostwhite"] = 47] = "ghostwhite";
|
|
2980
|
+
ValidColorNames[ValidColorNames["gold"] = 48] = "gold";
|
|
2981
|
+
ValidColorNames[ValidColorNames["goldenrod"] = 49] = "goldenrod";
|
|
2982
|
+
ValidColorNames[ValidColorNames["gray"] = 50] = "gray";
|
|
2983
|
+
ValidColorNames[ValidColorNames["green"] = 51] = "green";
|
|
2984
|
+
ValidColorNames[ValidColorNames["greenyellow"] = 52] = "greenyellow";
|
|
2985
|
+
ValidColorNames[ValidColorNames["honeydew"] = 53] = "honeydew";
|
|
2986
|
+
ValidColorNames[ValidColorNames["hotpink"] = 54] = "hotpink";
|
|
2987
|
+
ValidColorNames[ValidColorNames["indianred"] = 55] = "indianred";
|
|
2988
|
+
ValidColorNames[ValidColorNames["indigo"] = 56] = "indigo";
|
|
2989
|
+
ValidColorNames[ValidColorNames["ivory"] = 57] = "ivory";
|
|
2990
|
+
ValidColorNames[ValidColorNames["khaki"] = 58] = "khaki";
|
|
2991
|
+
ValidColorNames[ValidColorNames["lavender"] = 59] = "lavender";
|
|
2992
|
+
ValidColorNames[ValidColorNames["lavenderblush"] = 60] = "lavenderblush";
|
|
2993
|
+
ValidColorNames[ValidColorNames["lawngreen"] = 61] = "lawngreen";
|
|
2994
|
+
ValidColorNames[ValidColorNames["lemonchiffon"] = 62] = "lemonchiffon";
|
|
2995
|
+
ValidColorNames[ValidColorNames["lightblue"] = 63] = "lightblue";
|
|
2996
|
+
ValidColorNames[ValidColorNames["lightcoral"] = 64] = "lightcoral";
|
|
2997
|
+
ValidColorNames[ValidColorNames["lightcyan"] = 65] = "lightcyan";
|
|
2998
|
+
ValidColorNames[ValidColorNames["lightgoldenrodyellow"] = 66] = "lightgoldenrodyellow";
|
|
2999
|
+
ValidColorNames[ValidColorNames["lightgrey"] = 67] = "lightgrey";
|
|
3000
|
+
ValidColorNames[ValidColorNames["lightgreen"] = 68] = "lightgreen";
|
|
3001
|
+
ValidColorNames[ValidColorNames["lightpink"] = 69] = "lightpink";
|
|
3002
|
+
ValidColorNames[ValidColorNames["lightsalmon"] = 70] = "lightsalmon";
|
|
3003
|
+
ValidColorNames[ValidColorNames["lightseagreen"] = 71] = "lightseagreen";
|
|
3004
|
+
ValidColorNames[ValidColorNames["lightskyblue"] = 72] = "lightskyblue";
|
|
3005
|
+
ValidColorNames[ValidColorNames["lightslategray"] = 73] = "lightslategray";
|
|
3006
|
+
ValidColorNames[ValidColorNames["lightsteelblue"] = 74] = "lightsteelblue";
|
|
3007
|
+
ValidColorNames[ValidColorNames["lightyellow"] = 75] = "lightyellow";
|
|
3008
|
+
ValidColorNames[ValidColorNames["lime"] = 76] = "lime";
|
|
3009
|
+
ValidColorNames[ValidColorNames["limegreen"] = 77] = "limegreen";
|
|
3010
|
+
ValidColorNames[ValidColorNames["linen"] = 78] = "linen";
|
|
3011
|
+
ValidColorNames[ValidColorNames["magenta"] = 79] = "magenta";
|
|
3012
|
+
ValidColorNames[ValidColorNames["maroon"] = 80] = "maroon";
|
|
3013
|
+
ValidColorNames[ValidColorNames["mediumaquamarine"] = 81] = "mediumaquamarine";
|
|
3014
|
+
ValidColorNames[ValidColorNames["mediumblue"] = 82] = "mediumblue";
|
|
3015
|
+
ValidColorNames[ValidColorNames["mediumorchid"] = 83] = "mediumorchid";
|
|
3016
|
+
ValidColorNames[ValidColorNames["mediumpurple"] = 84] = "mediumpurple";
|
|
3017
|
+
ValidColorNames[ValidColorNames["mediumseagreen"] = 85] = "mediumseagreen";
|
|
3018
|
+
ValidColorNames[ValidColorNames["mediumslateblue"] = 86] = "mediumslateblue";
|
|
3019
|
+
ValidColorNames[ValidColorNames["mediumspringgreen"] = 87] = "mediumspringgreen";
|
|
3020
|
+
ValidColorNames[ValidColorNames["mediumturquoise"] = 88] = "mediumturquoise";
|
|
3021
|
+
ValidColorNames[ValidColorNames["mediumvioletred"] = 89] = "mediumvioletred";
|
|
3022
|
+
ValidColorNames[ValidColorNames["midnightblue"] = 90] = "midnightblue";
|
|
3023
|
+
ValidColorNames[ValidColorNames["mintcream"] = 91] = "mintcream";
|
|
3024
|
+
ValidColorNames[ValidColorNames["mistyrose"] = 92] = "mistyrose";
|
|
3025
|
+
ValidColorNames[ValidColorNames["moccasin"] = 93] = "moccasin";
|
|
3026
|
+
ValidColorNames[ValidColorNames["navajowhite"] = 94] = "navajowhite";
|
|
3027
|
+
ValidColorNames[ValidColorNames["navy"] = 95] = "navy";
|
|
3028
|
+
ValidColorNames[ValidColorNames["oldlace"] = 96] = "oldlace";
|
|
3029
|
+
ValidColorNames[ValidColorNames["olive"] = 97] = "olive";
|
|
3030
|
+
ValidColorNames[ValidColorNames["olivedrab"] = 98] = "olivedrab";
|
|
3031
|
+
ValidColorNames[ValidColorNames["orange"] = 99] = "orange";
|
|
3032
|
+
ValidColorNames[ValidColorNames["orangered"] = 100] = "orangered";
|
|
3033
|
+
ValidColorNames[ValidColorNames["orchid"] = 101] = "orchid";
|
|
3034
|
+
ValidColorNames[ValidColorNames["palegoldenrod"] = 102] = "palegoldenrod";
|
|
3035
|
+
ValidColorNames[ValidColorNames["palegreen"] = 103] = "palegreen";
|
|
3036
|
+
ValidColorNames[ValidColorNames["paleturquoise"] = 104] = "paleturquoise";
|
|
3037
|
+
ValidColorNames[ValidColorNames["palevioletred"] = 105] = "palevioletred";
|
|
3038
|
+
ValidColorNames[ValidColorNames["papayawhip"] = 106] = "papayawhip";
|
|
3039
|
+
ValidColorNames[ValidColorNames["peachpuff"] = 107] = "peachpuff";
|
|
3040
|
+
ValidColorNames[ValidColorNames["peru"] = 108] = "peru";
|
|
3041
|
+
ValidColorNames[ValidColorNames["pink"] = 109] = "pink";
|
|
3042
|
+
ValidColorNames[ValidColorNames["plum"] = 110] = "plum";
|
|
3043
|
+
ValidColorNames[ValidColorNames["powderblue"] = 111] = "powderblue";
|
|
3044
|
+
ValidColorNames[ValidColorNames["purple"] = 112] = "purple";
|
|
3045
|
+
ValidColorNames[ValidColorNames["red"] = 113] = "red";
|
|
3046
|
+
ValidColorNames[ValidColorNames["rosybrown"] = 114] = "rosybrown";
|
|
3047
|
+
ValidColorNames[ValidColorNames["royalblue"] = 115] = "royalblue";
|
|
3048
|
+
ValidColorNames[ValidColorNames["saddlebrown"] = 116] = "saddlebrown";
|
|
3049
|
+
ValidColorNames[ValidColorNames["salmon"] = 117] = "salmon";
|
|
3050
|
+
ValidColorNames[ValidColorNames["sandybrown"] = 118] = "sandybrown";
|
|
3051
|
+
ValidColorNames[ValidColorNames["seagreen"] = 119] = "seagreen";
|
|
3052
|
+
ValidColorNames[ValidColorNames["seashell"] = 120] = "seashell";
|
|
3053
|
+
ValidColorNames[ValidColorNames["sienna"] = 121] = "sienna";
|
|
3054
|
+
ValidColorNames[ValidColorNames["silver"] = 122] = "silver";
|
|
3055
|
+
ValidColorNames[ValidColorNames["skyblue"] = 123] = "skyblue";
|
|
3056
|
+
ValidColorNames[ValidColorNames["slateblue"] = 124] = "slateblue";
|
|
3057
|
+
ValidColorNames[ValidColorNames["slategray"] = 125] = "slategray";
|
|
3058
|
+
ValidColorNames[ValidColorNames["snow"] = 126] = "snow";
|
|
3059
|
+
ValidColorNames[ValidColorNames["springgreen"] = 127] = "springgreen";
|
|
3060
|
+
ValidColorNames[ValidColorNames["steelblue"] = 128] = "steelblue";
|
|
3061
|
+
ValidColorNames[ValidColorNames["tan"] = 129] = "tan";
|
|
3062
|
+
ValidColorNames[ValidColorNames["teal"] = 130] = "teal";
|
|
3063
|
+
ValidColorNames[ValidColorNames["thistle"] = 131] = "thistle";
|
|
3064
|
+
ValidColorNames[ValidColorNames["tomato"] = 132] = "tomato";
|
|
3065
|
+
ValidColorNames[ValidColorNames["turquoise"] = 133] = "turquoise";
|
|
3066
|
+
ValidColorNames[ValidColorNames["violet"] = 134] = "violet";
|
|
3067
|
+
ValidColorNames[ValidColorNames["wheat"] = 135] = "wheat";
|
|
3068
|
+
ValidColorNames[ValidColorNames["white"] = 136] = "white";
|
|
3069
|
+
ValidColorNames[ValidColorNames["whitesmoke"] = 137] = "whitesmoke";
|
|
3070
|
+
ValidColorNames[ValidColorNames["yellow"] = 138] = "yellow";
|
|
3071
|
+
ValidColorNames[ValidColorNames["yellowgreen"] = 139] = "yellowgreen";
|
|
3072
|
+
})(ValidColorNames || (ValidColorNames = {}));
|
|
3073
|
+
function isValidColor(color) {
|
|
3074
|
+
const hexRegex = new RegExp('^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$');
|
|
3075
|
+
const isValidHex = hexRegex.test(color);
|
|
3076
|
+
const isValidCSSColorName = !!ValidColorNames[color];
|
|
3077
|
+
return isValidHex || isValidCSSColorName;
|
|
3078
|
+
}
|
|
3079
|
+
function getCSSProperty(name, containerStyles, hostElementStyles) {
|
|
3080
|
+
if (!name)
|
|
3081
|
+
return;
|
|
3082
|
+
let fallback;
|
|
3083
|
+
if (name.startsWith('var(') && name.endsWith(')')) {
|
|
3084
|
+
const regExp = /var\((.*)\)/g;
|
|
3085
|
+
const result = regExp.exec(name);
|
|
3086
|
+
const split = result.length >= 2 ? result[1].split(',') : [];
|
|
3087
|
+
name = split[0];
|
|
3088
|
+
fallback = split[1];
|
|
3089
|
+
}
|
|
3090
|
+
let result = containerStyles.getPropertyValue(name).trim();
|
|
3091
|
+
if (!result)
|
|
3092
|
+
result = hostElementStyles.getPropertyValue(name).trim();
|
|
3093
|
+
return result || fallback;
|
|
3094
|
+
}
|
|
3095
|
+
function formatValue(value, format) {
|
|
3096
|
+
const valueAsFloat = parseFloat(value.toString());
|
|
3097
|
+
if (isNaN(valueAsFloat))
|
|
3098
|
+
return;
|
|
3099
|
+
const decimals = isNaN(+format.decimals) ? 0 : +format.decimals;
|
|
3100
|
+
if (format.type === 'currency') {
|
|
3101
|
+
return Intl.NumberFormat('en-US', {
|
|
3102
|
+
style: 'currency',
|
|
3103
|
+
currency: 'USD',
|
|
3104
|
+
maximumFractionDigits: decimals,
|
|
3105
|
+
minimumFractionDigits: decimals,
|
|
3106
|
+
}).format(valueAsFloat);
|
|
3107
|
+
}
|
|
3108
|
+
else {
|
|
3109
|
+
return Intl.NumberFormat('en-US').format(valueAsFloat);
|
|
3110
|
+
}
|
|
3111
|
+
}
|
|
3112
|
+
|
|
3113
|
+
export { getDefaultInterpolatedLabel as a, createGridClipPath as b, createSeriesData as c, createPolarClipPath as d, dataSample as e, getCSSProperty as f, getDefaultLabel as g, isValidColor as h, isCoordinateSystemType as i, formatValue as j, install$1 as k, install as l, createClipPath as m };
|