echarts 4.5.0 → 4.9.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/.DS_Store +0 -0
- package/.gitattributes +3 -0
- package/.github/pull_request_template.md +66 -0
- package/.github/workflows/nodejs.yml +15 -3
- package/.huskyrc +5 -0
- package/CONTRIBUTING.md +16 -160
- package/NOTICE +1 -1
- package/README.md +3 -3
- package/asset/.DS_Store +0 -0
- package/build/.DS_Store +0 -0
- package/dist/echarts-en.common.js +3072 -1261
- package/dist/echarts-en.common.min.js +1 -1
- package/dist/echarts-en.js +4339 -1685
- package/dist/echarts-en.js.map +1 -1
- package/dist/echarts-en.min.js +1 -1
- package/dist/echarts-en.simple.js +2496 -1011
- package/dist/echarts-en.simple.min.js +1 -1
- package/dist/echarts.common.js +3046 -1261
- package/dist/echarts.common.min.js +1 -1
- package/dist/echarts.js +4313 -1685
- package/dist/echarts.js.map +1 -1
- package/dist/echarts.min.js +1 -1
- package/dist/echarts.simple.js +2470 -1011
- package/dist/echarts.simple.min.js +1 -1
- package/dist/extension/bmap.js +33 -11
- package/dist/extension/bmap.js.map +1 -1
- package/dist/extension/bmap.min.js +1 -1
- package/dist/extension/dataTool.js.map +1 -1
- package/extension/.DS_Store +0 -0
- package/extension/bmap/BMapCoordSys.js +14 -4
- package/extension/bmap/BMapModel.js +4 -0
- package/extension/bmap/BMapView.js +18 -10
- package/extension-src/bmap/BMapCoordSys.js +14 -4
- package/extension-src/bmap/BMapModel.js +6 -1
- package/extension-src/bmap/BMapView.js +16 -9
- package/lib/chart/bar/BarSeries.js +14 -1
- package/lib/chart/bar/BarView.js +196 -18
- package/lib/chart/bar/BaseBarSeries.js +3 -1
- package/lib/chart/bar/PictorialBarSeries.js +1 -1
- package/lib/chart/candlestick/candlestickVisual.js +1 -1
- package/lib/chart/effectScatter/EffectScatterSeries.js +3 -1
- package/lib/chart/funnel/FunnelSeries.js +14 -5
- package/lib/chart/funnel/funnelLayout.js +162 -46
- package/lib/chart/gauge/GaugeSeries.js +0 -2
- package/lib/chart/graph/GraphSeries.js +23 -7
- package/lib/chart/graph/GraphView.js +30 -12
- package/lib/chart/graph/circularLayoutHelper.js +8 -2
- package/lib/chart/graph/forceLayout.js +6 -1
- package/lib/chart/graph/simpleLayout.js +1 -1
- package/lib/chart/graph/simpleLayoutHelper.js +10 -4
- package/lib/chart/heatmap/HeatmapView.js +4 -4
- package/lib/chart/helper/EffectLine.js +23 -1
- package/lib/chart/helper/EffectSymbol.js +2 -1
- package/lib/chart/helper/Line.js +129 -42
- package/lib/chart/helper/LineDraw.js +5 -1
- package/lib/chart/helper/Symbol.js +2 -3
- package/lib/chart/helper/createClipPathFromCoordSys.js +4 -1
- package/lib/chart/helper/createListFromArray.js +14 -8
- package/lib/chart/helper/createRenderPlanner.js +6 -3
- package/lib/chart/helper/multipleGraphEdgeHelper.js +258 -0
- package/lib/chart/helper/whiskerBoxCommon.js +22 -16
- package/lib/chart/line/LineSeries.js +3 -1
- package/lib/chart/line/LineView.js +41 -2
- package/lib/chart/lines/LinesSeries.js +0 -2
- package/lib/chart/map/MapSeries.js +14 -5
- package/lib/chart/pie/PieSeries.js +27 -6
- package/lib/chart/pie/PieView.js +22 -15
- package/lib/chart/pie/labelLayout.js +102 -19
- package/lib/chart/pie/pieLayout.js +19 -7
- package/lib/chart/radar/RadarSeries.js +27 -6
- package/lib/chart/radar/RadarView.js +3 -1
- package/lib/chart/sankey/SankeySeries.js +13 -1
- package/lib/chart/sankey/SankeyView.js +70 -32
- package/lib/chart/sankey/sankeyLayout.js +22 -3
- package/lib/chart/scatter/ScatterSeries.js +3 -1
- package/lib/chart/sunburst/SunburstPiece.js +5 -1
- package/lib/chart/sunburst/SunburstSeries.js +29 -12
- package/lib/chart/sunburst/SunburstView.js +5 -1
- package/lib/chart/themeRiver/ThemeRiverSeries.js +24 -33
- package/lib/chart/tree/TreeSeries.js +20 -3
- package/lib/chart/tree/TreeView.js +149 -23
- package/lib/chart/treemap/TreemapSeries.js +25 -4
- package/lib/chart/treemap/TreemapView.js +80 -38
- package/lib/chart/treemap/treemapLayout.js +1 -1
- package/lib/chart/treemap/treemapVisual.js +9 -15
- package/lib/component/axis/AngleAxisView.js +64 -7
- package/lib/component/axis/AxisBuilder.js +62 -24
- package/lib/component/axis/CartesianAxisView.js +52 -85
- package/lib/component/axis/RadiusAxisView.js +36 -4
- package/lib/component/axis/SingleAxisView.js +21 -6
- package/lib/component/axis/axisSplitHelper.js +132 -0
- package/lib/component/axisPointer/axisTrigger.js +1 -1
- package/lib/component/brush/BrushView.js +11 -1
- package/lib/component/brush/visualEncoding.js +13 -2
- package/lib/component/dataZoom/SliderZoomView.js +4 -10
- package/lib/component/helper/BrushController.js +33 -43
- package/lib/component/helper/MapDraw.js +30 -4
- package/lib/component/legend/LegendModel.js +3 -3
- package/lib/component/legend/LegendView.js +17 -13
- package/lib/component/legend/ScrollableLegendView.js +18 -18
- package/lib/component/marker/MarkAreaView.js +53 -15
- package/lib/component/marker/MarkLineModel.js +2 -1
- package/lib/component/marker/MarkLineView.js +3 -0
- package/lib/component/marker/MarkPointView.js +8 -1
- package/lib/component/marker/MarkerModel.js +3 -2
- package/lib/component/marker/markerHelper.js +7 -4
- package/lib/component/timeline/SliderTimelineView.js +7 -1
- package/lib/component/title.js +6 -2
- package/lib/component/toolbox/ToolboxView.js +5 -1
- package/lib/component/toolbox/feature/DataView.js +23 -8
- package/lib/component/toolbox/feature/DataZoom.js +6 -6
- package/lib/component/toolbox/feature/MagicType.js +20 -14
- package/lib/component/toolbox/feature/SaveAsImage.js +4 -2
- package/lib/component/tooltip/TooltipContent.js +101 -30
- package/lib/component/tooltip/TooltipRichContent.js +56 -8
- package/lib/component/tooltip/TooltipView.js +11 -12
- package/lib/component/visualMap/PiecewiseModel.js +3 -6
- package/lib/component/visualMap/VisualMapModel.js +1 -1
- package/lib/coord/Axis.js +30 -2
- package/lib/coord/View.js +9 -0
- package/lib/coord/axisDefault.js +22 -3
- package/lib/coord/axisHelper.js +24 -18
- package/lib/coord/calendar/Calendar.js +8 -4
- package/lib/coord/geo/GeoModel.js +2 -1
- package/lib/coord/geo/geoJSONLoader.js +3 -2
- package/lib/coord/geo/geoSourceManager.js +3 -2
- package/lib/coord/geo/parseGeoJson.js +3 -2
- package/lib/coord/radar/Radar.js +5 -5
- package/lib/data/DataDimensionInfo.js +157 -0
- package/lib/data/Graph.js +1 -6
- package/lib/data/List.js +26 -20
- package/lib/data/Tree.js +5 -42
- package/lib/data/helper/completeDimensions.js +43 -32
- package/lib/data/helper/createDimensions.js +2 -0
- package/lib/data/helper/sourceHelper.js +214 -114
- package/lib/echarts.js +57 -34
- package/lib/langEN.js +26 -0
- package/lib/layout/barGrid.js +19 -13
- package/lib/layout/barPolar.js +1 -6
- package/lib/loading/default.js +43 -27
- package/lib/model/Series.js +4 -4
- package/lib/model/referHelper.js +40 -12
- package/lib/processor/dataSample.js +1 -1
- package/lib/scale/Interval.js +87 -2
- package/lib/scale/Log.js +9 -2
- package/lib/scale/helper.js +1 -43
- package/lib/stream/Scheduler.js +10 -2
- package/lib/theme/dark.js +3 -0
- package/lib/util/format.js +19 -2
- package/lib/util/graphic.js +14 -12
- package/lib/visual/LegendVisualProvider.js +75 -0
- package/lib/visual/VisualMapping.js +1 -1
- package/lib/visual/dataColor.js +2 -12
- package/lib/visual/seriesColor.js +15 -7
- package/lib/visual/symbol.js +12 -2
- package/map/.DS_Store +0 -0
- package/map/js/.DS_Store +0 -0
- package/map/js/china.js +1 -1
- package/map/js/province/.DS_Store +0 -0
- package/map/js/province/chongqing.js +1 -1
- package/map/js/province/gansu.js +2 -2
- package/map/js/province/tianjin.js +1 -28
- package/map/json/.DS_Store +0 -0
- package/map/json/china.json +1 -1
- package/map/json/province/chongqing.json +1 -1
- package/map/json/province/tianjin.json +1 -1
- package/package.json +12 -6
- package/src/.DS_Store +0 -0
- package/src/chart/.DS_Store +0 -0
- package/src/chart/bar/BarSeries.js +15 -1
- package/src/chart/bar/BarView.js +198 -17
- package/src/chart/bar/BaseBarSeries.js +1 -1
- package/src/chart/bar/PictorialBarSeries.js +2 -2
- package/src/chart/candlestick/candlestickVisual.js +1 -1
- package/src/chart/effectScatter/EffectScatterSeries.js +1 -1
- package/src/chart/funnel/FunnelSeries.js +11 -4
- package/src/chart/funnel/funnelLayout.js +179 -53
- package/src/chart/gauge/GaugeSeries.js +0 -1
- package/src/chart/graph/GraphSeries.js +19 -7
- package/src/chart/graph/GraphView.js +28 -10
- package/src/chart/graph/circularLayoutHelper.js +8 -2
- package/src/chart/graph/forceLayout.js +7 -1
- package/src/chart/graph/simpleLayout.js +1 -1
- package/src/chart/graph/simpleLayoutHelper.js +12 -5
- package/src/chart/heatmap/HeatmapView.js +4 -4
- package/src/chart/helper/EffectLine.js +23 -1
- package/src/chart/helper/EffectSymbol.js +2 -1
- package/src/chart/helper/Line.js +122 -37
- package/src/chart/helper/LineDraw.js +5 -1
- package/src/chart/helper/Symbol.js +4 -4
- package/src/chart/helper/createClipPathFromCoordSys.js +4 -0
- package/src/chart/helper/createGraphFromNodeEdge.js +2 -1
- package/src/chart/helper/createListFromArray.js +13 -8
- package/src/chart/helper/createRenderPlanner.js +5 -2
- package/src/chart/helper/multipleGraphEdgeHelper.js +229 -0
- package/src/chart/helper/whiskerBoxCommon.js +21 -16
- package/src/chart/line/LineSeries.js +1 -1
- package/src/chart/line/LineView.js +45 -1
- package/src/chart/lines/LinesSeries.js +1 -3
- package/src/chart/map/MapSeries.js +11 -5
- package/src/chart/pie/PieSeries.js +26 -5
- package/src/chart/pie/PieView.js +20 -15
- package/src/chart/pie/labelLayout.js +114 -22
- package/src/chart/pie/pieLayout.js +20 -7
- package/src/chart/radar/RadarSeries.js +31 -6
- package/src/chart/radar/RadarView.js +4 -2
- package/src/chart/sankey/SankeySeries.js +12 -1
- package/src/chart/sankey/SankeyView.js +75 -30
- package/src/chart/sankey/sankeyLayout.js +25 -5
- package/src/chart/scatter/ScatterSeries.js +1 -1
- package/src/chart/sunburst/SunburstPiece.js +7 -1
- package/src/chart/sunburst/SunburstSeries.js +28 -15
- package/src/chart/sunburst/SunburstView.js +2 -1
- package/src/chart/themeRiver/ThemeRiverSeries.js +25 -30
- package/src/chart/tree/TreeSeries.js +19 -6
- package/src/chart/tree/TreeView.js +156 -23
- package/src/chart/treemap/TreemapSeries.js +23 -5
- package/src/chart/treemap/TreemapView.js +77 -41
- package/src/chart/treemap/treemapLayout.js +2 -2
- package/src/chart/treemap/treemapVisual.js +8 -25
- package/src/component/axis/AngleAxisView.js +75 -7
- package/src/component/axis/AxisBuilder.js +77 -32
- package/src/component/axis/CartesianAxisView.js +47 -83
- package/src/component/axis/RadiusAxisView.js +37 -4
- package/src/component/axis/SingleAxisView.js +21 -4
- package/src/component/axis/axisSplitHelper.js +114 -0
- package/src/component/axisPointer/axisTrigger.js +1 -1
- package/src/component/brush/BrushView.js +8 -1
- package/src/component/brush/visualEncoding.js +6 -3
- package/src/component/dataZoom/SliderZoomView.js +4 -9
- package/src/component/helper/BrushController.js +40 -47
- package/src/component/helper/MapDraw.js +27 -4
- package/src/component/legend/LegendModel.js +3 -3
- package/src/component/legend/LegendView.js +18 -12
- package/src/component/legend/ScrollableLegendView.js +18 -16
- package/src/component/marker/MarkAreaView.js +53 -15
- package/src/component/marker/MarkLineModel.js +2 -1
- package/src/component/marker/MarkLineView.js +3 -1
- package/src/component/marker/MarkPointView.js +7 -1
- package/src/component/marker/MarkerModel.js +3 -2
- package/src/component/marker/markerHelper.js +8 -5
- package/src/component/timeline/SliderTimelineView.js +9 -6
- package/src/component/title.js +4 -3
- package/src/component/toolbox/.DS_Store +0 -0
- package/src/component/toolbox/ToolboxView.js +5 -0
- package/src/component/toolbox/feature/DataView.js +20 -8
- package/src/component/toolbox/feature/DataZoom.js +6 -6
- package/src/component/toolbox/feature/MagicType.js +19 -13
- package/src/component/toolbox/feature/SaveAsImage.js +4 -2
- package/src/component/tooltip/TooltipContent.js +94 -28
- package/src/component/tooltip/TooltipRichContent.js +52 -9
- package/src/component/tooltip/TooltipView.js +14 -12
- package/src/component/visualMap/PiecewiseModel.js +5 -9
- package/src/component/visualMap/VisualMapModel.js +1 -1
- package/src/coord/Axis.js +29 -2
- package/src/coord/View.js +10 -1
- package/src/coord/axisDefault.js +26 -2
- package/src/coord/axisHelper.js +30 -21
- package/src/coord/calendar/Calendar.js +12 -5
- package/src/coord/geo/GeoModel.js +3 -6
- package/src/coord/geo/geoJSONLoader.js +3 -2
- package/src/coord/geo/geoSourceManager.js +3 -2
- package/src/coord/geo/parseGeoJson.js +3 -2
- package/src/coord/radar/Radar.js +6 -8
- package/src/data/DataDimensionInfo.js +135 -0
- package/src/data/Graph.js +0 -5
- package/src/data/List.js +30 -17
- package/src/data/Tree.js +6 -39
- package/src/data/helper/completeDimensions.js +49 -30
- package/src/data/helper/createDimensions.js +2 -0
- package/src/data/helper/sourceHelper.js +216 -124
- package/src/echarts.js +60 -36
- package/src/langEN.js +26 -0
- package/src/layout/barGrid.js +22 -10
- package/src/layout/barPolar.js +4 -6
- package/src/loading/default.js +46 -34
- package/src/model/.DS_Store +0 -0
- package/src/model/Series.js +4 -4
- package/src/model/referHelper.js +34 -11
- package/src/preprocessor/.DS_Store +0 -0
- package/src/processor/dataSample.js +1 -1
- package/src/scale/Interval.js +84 -4
- package/src/scale/Log.js +9 -2
- package/src/scale/helper.js +1 -39
- package/src/stream/Scheduler.js +9 -1
- package/src/theme/dark.js +3 -0
- package/src/util/.DS_Store +0 -0
- package/src/util/format.js +17 -1
- package/src/util/graphic.js +13 -11
- package/src/visual/LegendVisualProvider.js +55 -0
- package/src/visual/VisualMapping.js +1 -1
- package/src/visual/dataColor.js +0 -13
- package/src/visual/seriesColor.js +13 -7
- package/src/visual/symbol.js +11 -2
- package/theme/.DS_Store +0 -0
- package/theme/azul.js +163 -0
- package/theme/bee-inspired.js +178 -0
- package/theme/blue.js +178 -0
- package/theme/caravan.js +178 -0
- package/theme/carp.js +163 -0
- package/theme/cool.js +180 -0
- package/theme/dark-blue.js +168 -0
- package/theme/dark-bold.js +168 -0
- package/theme/dark-digerati.js +168 -0
- package/theme/dark-fresh-cut.js +168 -0
- package/theme/dark-mushroom.js +168 -0
- package/theme/dark.js +69 -62
- package/theme/eduardo.js +178 -0
- package/theme/forest.js +163 -0
- package/theme/fresh-cut.js +163 -0
- package/theme/fruit.js +178 -0
- package/theme/gray.js +220 -0
- package/theme/green.js +222 -0
- package/theme/helianthus.js +263 -0
- package/theme/infographic.js +72 -57
- package/theme/inspired.js +163 -0
- package/theme/jazz.js +163 -0
- package/theme/london.js +163 -0
- package/theme/macarons.js +80 -57
- package/theme/macarons2.js +251 -0
- package/theme/mint.js +155 -0
- package/theme/red-velvet.js +163 -0
- package/theme/red.js +225 -0
- package/theme/roma.js +55 -22
- package/theme/royal.js +163 -0
- package/theme/sakura.js +140 -0
- package/theme/shine.js +52 -45
- package/theme/tech-blue.js +180 -0
- package/theme/vintage.js +37 -23
package/lib/echarts.js
CHANGED
|
@@ -101,9 +101,9 @@ var each = zrUtil.each;
|
|
|
101
101
|
var isFunction = zrUtil.isFunction;
|
|
102
102
|
var isObject = zrUtil.isObject;
|
|
103
103
|
var parseClassType = ComponentModel.parseClassType;
|
|
104
|
-
var version = '4.
|
|
104
|
+
var version = '4.9.0';
|
|
105
105
|
var dependencies = {
|
|
106
|
-
zrender: '4.
|
|
106
|
+
zrender: '4.3.2'
|
|
107
107
|
};
|
|
108
108
|
var TEST_FRAME_REMAIN_TIME = 1;
|
|
109
109
|
var PRIORITY_PROCESSOR_FILTER = 1000;
|
|
@@ -498,7 +498,7 @@ echartsProto.getRenderedCanvas = function (opts) {
|
|
|
498
498
|
*/
|
|
499
499
|
|
|
500
500
|
|
|
501
|
-
echartsProto.
|
|
501
|
+
echartsProto.getSvgDataURL = function () {
|
|
502
502
|
if (!env.svgSupported) {
|
|
503
503
|
return;
|
|
504
504
|
}
|
|
@@ -509,7 +509,7 @@ echartsProto.getSvgDataUrl = function () {
|
|
|
509
509
|
zrUtil.each(list, function (el) {
|
|
510
510
|
el.stopAnimation(true);
|
|
511
511
|
});
|
|
512
|
-
return zr.painter.
|
|
512
|
+
return zr.painter.toDataURL();
|
|
513
513
|
};
|
|
514
514
|
/**
|
|
515
515
|
* @return {string}
|
|
@@ -544,7 +544,7 @@ echartsProto.getDataURL = function (opts) {
|
|
|
544
544
|
}
|
|
545
545
|
});
|
|
546
546
|
});
|
|
547
|
-
var url = this._zr.painter.getType() === 'svg' ? this.
|
|
547
|
+
var url = this._zr.painter.getType() === 'svg' ? this.getSvgDataURL() : this.getRenderedCanvas(opts).toDataURL('image/' + (opts && opts.type || 'png'));
|
|
548
548
|
each(excludesComponentViews, function (view) {
|
|
549
549
|
view.group.ignore = false;
|
|
550
550
|
});
|
|
@@ -569,6 +569,7 @@ echartsProto.getConnectedDataURL = function (opts) {
|
|
|
569
569
|
return;
|
|
570
570
|
}
|
|
571
571
|
|
|
572
|
+
var isSvg = opts.type === 'svg';
|
|
572
573
|
var groupId = this.group;
|
|
573
574
|
var mathMin = Math.min;
|
|
574
575
|
var mathMax = Math.max;
|
|
@@ -583,7 +584,7 @@ echartsProto.getConnectedDataURL = function (opts) {
|
|
|
583
584
|
var dpr = opts && opts.pixelRatio || 1;
|
|
584
585
|
zrUtil.each(instances, function (chart, id) {
|
|
585
586
|
if (chart.group === groupId) {
|
|
586
|
-
var canvas = chart.getRenderedCanvas(zrUtil.clone(opts));
|
|
587
|
+
var canvas = isSvg ? chart.getZr().painter.getSvgDom().innerHTML : chart.getRenderedCanvas(zrUtil.clone(opts));
|
|
587
588
|
var boundingRect = chart.getDom().getBoundingClientRect();
|
|
588
589
|
left = mathMin(boundingRect.left, left);
|
|
589
590
|
top = mathMin(boundingRect.top, top);
|
|
@@ -603,36 +604,58 @@ echartsProto.getConnectedDataURL = function (opts) {
|
|
|
603
604
|
var width = right - left;
|
|
604
605
|
var height = bottom - top;
|
|
605
606
|
var targetCanvas = zrUtil.createCanvas();
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
x: 0,
|
|
614
|
-
y: 0,
|
|
615
|
-
width: width,
|
|
616
|
-
height: height
|
|
617
|
-
},
|
|
618
|
-
style: {
|
|
619
|
-
fill: opts.connectedBackgroundColor
|
|
620
|
-
}
|
|
621
|
-
}));
|
|
622
|
-
}
|
|
607
|
+
var zr = zrender.init(targetCanvas, {
|
|
608
|
+
renderer: isSvg ? 'svg' : 'canvas'
|
|
609
|
+
});
|
|
610
|
+
zr.resize({
|
|
611
|
+
width: width,
|
|
612
|
+
height: height
|
|
613
|
+
});
|
|
623
614
|
|
|
624
|
-
|
|
625
|
-
var
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
}
|
|
615
|
+
if (isSvg) {
|
|
616
|
+
var content = '';
|
|
617
|
+
each(canvasList, function (item) {
|
|
618
|
+
var x = item.left - left;
|
|
619
|
+
var y = item.top - top;
|
|
620
|
+
content += '<g transform="translate(' + x + ',' + y + ')">' + item.dom + '</g>';
|
|
631
621
|
});
|
|
632
|
-
zr.
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
622
|
+
zr.painter.getSvgRoot().innerHTML = content;
|
|
623
|
+
|
|
624
|
+
if (opts.connectedBackgroundColor) {
|
|
625
|
+
zr.painter.setBackgroundColor(opts.connectedBackgroundColor);
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
zr.refreshImmediately();
|
|
629
|
+
return zr.painter.toDataURL();
|
|
630
|
+
} else {
|
|
631
|
+
// Background between the charts
|
|
632
|
+
if (opts.connectedBackgroundColor) {
|
|
633
|
+
zr.add(new graphic.Rect({
|
|
634
|
+
shape: {
|
|
635
|
+
x: 0,
|
|
636
|
+
y: 0,
|
|
637
|
+
width: width,
|
|
638
|
+
height: height
|
|
639
|
+
},
|
|
640
|
+
style: {
|
|
641
|
+
fill: opts.connectedBackgroundColor
|
|
642
|
+
}
|
|
643
|
+
}));
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
each(canvasList, function (item) {
|
|
647
|
+
var img = new graphic.Image({
|
|
648
|
+
style: {
|
|
649
|
+
x: item.left * dpr - left,
|
|
650
|
+
y: item.top * dpr - top,
|
|
651
|
+
image: item.dom
|
|
652
|
+
}
|
|
653
|
+
});
|
|
654
|
+
zr.add(img);
|
|
655
|
+
});
|
|
656
|
+
zr.refreshImmediately();
|
|
657
|
+
return targetCanvas.toDataURL('image/' + (opts && opts.type || 'png'));
|
|
658
|
+
}
|
|
636
659
|
} else {
|
|
637
660
|
return this.getDataURL(opts);
|
|
638
661
|
}
|
package/lib/langEN.js
CHANGED
|
@@ -84,6 +84,32 @@ var _default = {
|
|
|
84
84
|
lang: ['Right Click to Save Image']
|
|
85
85
|
}
|
|
86
86
|
},
|
|
87
|
+
series: {
|
|
88
|
+
typeNames: {
|
|
89
|
+
pie: 'Pie chart',
|
|
90
|
+
bar: 'Bar chart',
|
|
91
|
+
line: 'Line chart',
|
|
92
|
+
scatter: 'Scatter plot',
|
|
93
|
+
effectScatter: 'Ripple scatter plot',
|
|
94
|
+
radar: 'Radar chart',
|
|
95
|
+
tree: 'Tree',
|
|
96
|
+
treemap: 'Treemap',
|
|
97
|
+
boxplot: 'Boxplot',
|
|
98
|
+
candlestick: 'Candlestick',
|
|
99
|
+
k: 'K line chart',
|
|
100
|
+
heatmap: 'Heat map',
|
|
101
|
+
map: 'Map',
|
|
102
|
+
parallel: 'Parallel coordinate map',
|
|
103
|
+
lines: 'Line graph',
|
|
104
|
+
graph: 'Relationship graph',
|
|
105
|
+
sankey: 'Sankey diagram',
|
|
106
|
+
funnel: 'Funnel chart',
|
|
107
|
+
gauge: 'Guage',
|
|
108
|
+
pictorialBar: 'Pictorial bar',
|
|
109
|
+
themeRiver: 'Theme River Map',
|
|
110
|
+
sunburst: 'Sunburst'
|
|
111
|
+
}
|
|
112
|
+
},
|
|
87
113
|
aria: {
|
|
88
114
|
general: {
|
|
89
115
|
withTitle: 'This is a chart about "{title}"',
|
package/lib/layout/barGrid.js
CHANGED
|
@@ -263,7 +263,6 @@ function doCalBarWidthAndOffset(seriesInfoList) {
|
|
|
263
263
|
// will be shared by series. Consider that they have default values,
|
|
264
264
|
// only the attributes set on the last series will work.
|
|
265
265
|
// Do not change this fact unless there will be a break change.
|
|
266
|
-
// TODO
|
|
267
266
|
|
|
268
267
|
var barWidth = seriesInfo.barWidth;
|
|
269
268
|
|
|
@@ -317,7 +316,7 @@ function doCalBarWidthAndOffset(seriesInfoList) {
|
|
|
317
316
|
|
|
318
317
|
if (finalWidth !== autoWidth) {
|
|
319
318
|
column.width = finalWidth;
|
|
320
|
-
remainedWidth -= finalWidth;
|
|
319
|
+
remainedWidth -= finalWidth + barGapPercent * finalWidth;
|
|
321
320
|
autoWidthCount--;
|
|
322
321
|
}
|
|
323
322
|
} else {
|
|
@@ -336,7 +335,7 @@ function doCalBarWidthAndOffset(seriesInfoList) {
|
|
|
336
335
|
}
|
|
337
336
|
|
|
338
337
|
column.width = finalWidth;
|
|
339
|
-
remainedWidth -= finalWidth;
|
|
338
|
+
remainedWidth -= finalWidth + barGapPercent * finalWidth;
|
|
340
339
|
autoWidthCount--;
|
|
341
340
|
}
|
|
342
341
|
}); // Recalculate width again
|
|
@@ -428,12 +427,7 @@ function layout(seriesType, ecModel) {
|
|
|
428
427
|
|
|
429
428
|
for (var idx = 0, len = data.count(); idx < len; idx++) {
|
|
430
429
|
var value = data.get(valueDim, idx);
|
|
431
|
-
var baseValue = data.get(baseDim, idx);
|
|
432
|
-
|
|
433
|
-
if (isNaN(value) || isNaN(baseValue)) {
|
|
434
|
-
continue;
|
|
435
|
-
}
|
|
436
|
-
|
|
430
|
+
var baseValue = data.get(baseDim, idx);
|
|
437
431
|
var sign = value >= 0 ? 'p' : 'n';
|
|
438
432
|
var baseCoord = valueAxisStart; // Because of the barMinHeight, we can not use the value in
|
|
439
433
|
// stackResultDimension directly.
|
|
@@ -467,9 +461,12 @@ function layout(seriesType, ecModel) {
|
|
|
467
461
|
|
|
468
462
|
if (Math.abs(width) < barMinHeight) {
|
|
469
463
|
width = (width < 0 ? -1 : 1) * barMinHeight;
|
|
470
|
-
}
|
|
464
|
+
} // Ignore stack from NaN value
|
|
465
|
+
|
|
471
466
|
|
|
472
|
-
|
|
467
|
+
if (!isNaN(width)) {
|
|
468
|
+
stacked && (lastStackCoords[stackId][baseValue][sign] += width);
|
|
469
|
+
}
|
|
473
470
|
} else {
|
|
474
471
|
var coord = cartesian.dataToPoint([baseValue, value]);
|
|
475
472
|
x = coord[0] + columnOffset;
|
|
@@ -480,9 +477,12 @@ function layout(seriesType, ecModel) {
|
|
|
480
477
|
if (Math.abs(height) < barMinHeight) {
|
|
481
478
|
// Include zero to has a positive bar
|
|
482
479
|
height = (height <= 0 ? -1 : 1) * barMinHeight;
|
|
483
|
-
}
|
|
480
|
+
} // Ignore stack from NaN value
|
|
484
481
|
|
|
485
|
-
|
|
482
|
+
|
|
483
|
+
if (!isNaN(height)) {
|
|
484
|
+
stacked && (lastStackCoords[stackId][baseValue][sign] += height);
|
|
485
|
+
}
|
|
486
486
|
}
|
|
487
487
|
|
|
488
488
|
data.setItemLayout(idx, {
|
|
@@ -506,6 +506,7 @@ var largeLayout = {
|
|
|
506
506
|
|
|
507
507
|
var data = seriesModel.getData();
|
|
508
508
|
var cartesian = seriesModel.coordinateSystem;
|
|
509
|
+
var coordLayout = cartesian.grid.getRect();
|
|
509
510
|
var baseAxis = cartesian.getBaseAxis();
|
|
510
511
|
var valueAxis = cartesian.getOtherAxis(baseAxis);
|
|
511
512
|
var valueDim = data.mapDimension(valueAxis.dim);
|
|
@@ -526,6 +527,7 @@ var largeLayout = {
|
|
|
526
527
|
function progress(params, data) {
|
|
527
528
|
var count = params.count;
|
|
528
529
|
var largePoints = new LargeArr(count * 2);
|
|
530
|
+
var largeBackgroundPoints = new LargeArr(count * 2);
|
|
529
531
|
var largeDataIndices = new LargeArr(count);
|
|
530
532
|
var dataIndex;
|
|
531
533
|
var coord = [];
|
|
@@ -538,7 +540,9 @@ var largeLayout = {
|
|
|
538
540
|
valuePair[1 - valueDimIdx] = data.get(baseDim, dataIndex);
|
|
539
541
|
coord = cartesian.dataToPoint(valuePair, null, coord); // Data index might not be in order, depends on `progressiveChunkMode`.
|
|
540
542
|
|
|
543
|
+
largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coordLayout.x + coordLayout.width : coord[0];
|
|
541
544
|
largePoints[pointsOffset++] = coord[0];
|
|
545
|
+
largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coord[1] : coordLayout.y + coordLayout.height;
|
|
542
546
|
largePoints[pointsOffset++] = coord[1];
|
|
543
547
|
largeDataIndices[idxOffset++] = dataIndex;
|
|
544
548
|
}
|
|
@@ -546,8 +550,10 @@ var largeLayout = {
|
|
|
546
550
|
data.setLayout({
|
|
547
551
|
largePoints: largePoints,
|
|
548
552
|
largeDataIndices: largeDataIndices,
|
|
553
|
+
largeBackgroundPoints: largeBackgroundPoints,
|
|
549
554
|
barWidth: barWidth,
|
|
550
555
|
valueAxisStart: getValueAxisStart(baseAxis, valueAxis, false),
|
|
556
|
+
backgroundStart: valueAxisHorizontal ? coordLayout.x : coordLayout.y,
|
|
551
557
|
valueAxisHorizontal: valueAxisHorizontal
|
|
552
558
|
});
|
|
553
559
|
}
|
package/lib/layout/barPolar.js
CHANGED
|
@@ -91,16 +91,11 @@ function barLayoutPolar(seriesType, ecModel, api) {
|
|
|
91
91
|
/*, baseDim*/
|
|
92
92
|
);
|
|
93
93
|
var clampLayout = baseAxis.dim !== 'radius' || !seriesModel.get('roundCap', true);
|
|
94
|
-
var valueAxisStart = valueAxis.
|
|
94
|
+
var valueAxisStart = valueAxis.dim === 'radius' ? valueAxis.dataToRadius(0) : valueAxis.dataToAngle(0);
|
|
95
95
|
|
|
96
96
|
for (var idx = 0, len = data.count(); idx < len; idx++) {
|
|
97
97
|
var value = data.get(valueDim, idx);
|
|
98
98
|
var baseValue = data.get(baseDim, idx);
|
|
99
|
-
|
|
100
|
-
if (isNaN(value)) {
|
|
101
|
-
continue;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
99
|
var sign = value >= 0 ? 'p' : 'n';
|
|
105
100
|
var baseCoord = valueAxisStart; // Because of the barMinHeight, we can not use the value in
|
|
106
101
|
// stackResultDimension directly.
|
package/lib/loading/default.js
CHANGED
|
@@ -22,6 +22,8 @@ var zrUtil = require("zrender/lib/core/util");
|
|
|
22
22
|
|
|
23
23
|
var graphic = require("../util/graphic");
|
|
24
24
|
|
|
25
|
+
var textContain = require("zrender/lib/contain/text");
|
|
26
|
+
|
|
25
27
|
/*
|
|
26
28
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
27
29
|
* or more contributor license agreements. See the NOTICE file
|
|
@@ -54,11 +56,16 @@ function _default(api, opts) {
|
|
|
54
56
|
opts = opts || {};
|
|
55
57
|
zrUtil.defaults(opts, {
|
|
56
58
|
text: 'loading',
|
|
57
|
-
color: '#c23531',
|
|
58
59
|
textColor: '#000',
|
|
60
|
+
fontSize: '12px',
|
|
59
61
|
maskColor: 'rgba(255, 255, 255, 0.8)',
|
|
62
|
+
showSpinner: true,
|
|
63
|
+
color: '#c23531',
|
|
64
|
+
spinnerRadius: 10,
|
|
65
|
+
lineWidth: 5,
|
|
60
66
|
zlevel: 0
|
|
61
67
|
});
|
|
68
|
+
var group = new graphic.Group();
|
|
62
69
|
var mask = new graphic.Rect({
|
|
63
70
|
style: {
|
|
64
71
|
fill: opts.maskColor
|
|
@@ -66,24 +73,13 @@ function _default(api, opts) {
|
|
|
66
73
|
zlevel: opts.zlevel,
|
|
67
74
|
z: 10000
|
|
68
75
|
});
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
startAngle: -PI / 2,
|
|
72
|
-
endAngle: -PI / 2 + 0.1,
|
|
73
|
-
r: 10
|
|
74
|
-
},
|
|
75
|
-
style: {
|
|
76
|
-
stroke: opts.color,
|
|
77
|
-
lineCap: 'round',
|
|
78
|
-
lineWidth: 5
|
|
79
|
-
},
|
|
80
|
-
zlevel: opts.zlevel,
|
|
81
|
-
z: 10001
|
|
82
|
-
});
|
|
76
|
+
group.add(mask);
|
|
77
|
+
var font = opts.fontSize + ' sans-serif';
|
|
83
78
|
var labelRect = new graphic.Rect({
|
|
84
79
|
style: {
|
|
85
80
|
fill: 'none',
|
|
86
81
|
text: opts.text,
|
|
82
|
+
font: font,
|
|
87
83
|
textPosition: 'right',
|
|
88
84
|
textDistance: 10,
|
|
89
85
|
textFill: opts.textColor
|
|
@@ -91,25 +87,45 @@ function _default(api, opts) {
|
|
|
91
87
|
zlevel: opts.zlevel,
|
|
92
88
|
z: 10001
|
|
93
89
|
});
|
|
94
|
-
arc.animateShape(true).when(1000, {
|
|
95
|
-
endAngle: PI * 3 / 2
|
|
96
|
-
}).start('circularInOut');
|
|
97
|
-
arc.animateShape(true).when(1000, {
|
|
98
|
-
startAngle: PI * 3 / 2
|
|
99
|
-
}).delay(300).start('circularInOut');
|
|
100
|
-
var group = new graphic.Group();
|
|
101
|
-
group.add(arc);
|
|
102
90
|
group.add(labelRect);
|
|
103
|
-
|
|
91
|
+
|
|
92
|
+
if (opts.showSpinner) {
|
|
93
|
+
var arc = new graphic.Arc({
|
|
94
|
+
shape: {
|
|
95
|
+
startAngle: -PI / 2,
|
|
96
|
+
endAngle: -PI / 2 + 0.1,
|
|
97
|
+
r: opts.spinnerRadius
|
|
98
|
+
},
|
|
99
|
+
style: {
|
|
100
|
+
stroke: opts.color,
|
|
101
|
+
lineCap: 'round',
|
|
102
|
+
lineWidth: opts.lineWidth
|
|
103
|
+
},
|
|
104
|
+
zlevel: opts.zlevel,
|
|
105
|
+
z: 10001
|
|
106
|
+
});
|
|
107
|
+
arc.animateShape(true).when(1000, {
|
|
108
|
+
endAngle: PI * 3 / 2
|
|
109
|
+
}).start('circularInOut');
|
|
110
|
+
arc.animateShape(true).when(1000, {
|
|
111
|
+
startAngle: PI * 3 / 2
|
|
112
|
+
}).delay(300).start('circularInOut');
|
|
113
|
+
group.add(arc);
|
|
114
|
+
} // Inject resize
|
|
115
|
+
|
|
104
116
|
|
|
105
117
|
group.resize = function () {
|
|
106
|
-
var
|
|
118
|
+
var textWidth = textContain.getWidth(opts.text, font);
|
|
119
|
+
var r = opts.showSpinner ? opts.spinnerRadius : 0; // cx = (containerWidth - arcDiameter - textDistance - textWidth) / 2
|
|
120
|
+
// textDistance needs to be calculated when both animation and text exist
|
|
121
|
+
|
|
122
|
+
var cx = (api.getWidth() - r * 2 - (opts.showSpinner && textWidth ? 10 : 0) - textWidth) / 2 // only show the text
|
|
123
|
+
- (opts.showSpinner ? 0 : textWidth / 2);
|
|
107
124
|
var cy = api.getHeight() / 2;
|
|
108
|
-
arc.setShape({
|
|
125
|
+
opts.showSpinner && arc.setShape({
|
|
109
126
|
cx: cx,
|
|
110
127
|
cy: cy
|
|
111
128
|
});
|
|
112
|
-
var r = arc.shape.r;
|
|
113
129
|
labelRect.setShape({
|
|
114
130
|
x: cx - r,
|
|
115
131
|
y: cy - r,
|
package/lib/model/Series.js
CHANGED
|
@@ -95,11 +95,11 @@ var SeriesModel = ComponentModel.extend({
|
|
|
95
95
|
defaultOption: null,
|
|
96
96
|
|
|
97
97
|
/**
|
|
98
|
-
*
|
|
99
|
-
* @type {
|
|
98
|
+
* legend visual provider to the legend component
|
|
99
|
+
* @type {Object}
|
|
100
100
|
*/
|
|
101
101
|
// PENDING
|
|
102
|
-
|
|
102
|
+
legendVisualProvider: null,
|
|
103
103
|
|
|
104
104
|
/**
|
|
105
105
|
* Access path of color for visual
|
|
@@ -569,7 +569,7 @@ function dataTaskReset(context) {
|
|
|
569
569
|
|
|
570
570
|
function dataTaskProgress(param, context) {
|
|
571
571
|
// Avoid repead cloneShallow when data just created in reset.
|
|
572
|
-
if (param.end > context.outputData.count()) {
|
|
572
|
+
if (context.outputData && param.end > context.outputData.count()) {
|
|
573
573
|
context.model.getRawData().cloneShallow(context.outputData);
|
|
574
574
|
}
|
|
575
575
|
} // TODO refactor
|
package/lib/model/referHelper.js
CHANGED
|
@@ -56,7 +56,8 @@ var each = _util.each;
|
|
|
56
56
|
// check: "modelHelper" of tooltip and "BrushTargetManager".
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
|
-
* @
|
|
59
|
+
* @class
|
|
60
|
+
* For example:
|
|
60
61
|
* {
|
|
61
62
|
* coordSysName: 'cartesian2d',
|
|
62
63
|
* coordSysDims: ['x', 'y', ...],
|
|
@@ -68,19 +69,46 @@ var each = _util.each;
|
|
|
68
69
|
* x: xAxisModel,
|
|
69
70
|
* y: undefined
|
|
70
71
|
* }),
|
|
71
|
-
* //
|
|
72
|
+
* // The index of the first category axis in `coordSysDims`.
|
|
73
|
+
* // `null/undefined` means no category axis exists.
|
|
72
74
|
* firstCategoryDimIndex: 1,
|
|
73
75
|
* // To replace user specified encode.
|
|
74
76
|
* }
|
|
75
77
|
*/
|
|
76
|
-
function
|
|
78
|
+
function CoordSysInfo(coordSysName) {
|
|
79
|
+
/**
|
|
80
|
+
* @type {string}
|
|
81
|
+
*/
|
|
82
|
+
this.coordSysName = coordSysName;
|
|
83
|
+
/**
|
|
84
|
+
* @type {Array.<string>}
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
this.coordSysDims = [];
|
|
88
|
+
/**
|
|
89
|
+
* @type {module:zrender/core/util#HashMap}
|
|
90
|
+
*/
|
|
91
|
+
|
|
92
|
+
this.axisMap = createHashMap();
|
|
93
|
+
/**
|
|
94
|
+
* @type {module:zrender/core/util#HashMap}
|
|
95
|
+
*/
|
|
96
|
+
|
|
97
|
+
this.categoryAxisMap = createHashMap();
|
|
98
|
+
/**
|
|
99
|
+
* @type {number}
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
this.firstCategoryDimIndex = null;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* @return {module:model/referHelper#CoordSysInfo}
|
|
106
|
+
*/
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
function getCoordSysInfoBySeries(seriesModel) {
|
|
77
110
|
var coordSysName = seriesModel.get('coordinateSystem');
|
|
78
|
-
var result =
|
|
79
|
-
coordSysName: coordSysName,
|
|
80
|
-
coordSysDims: [],
|
|
81
|
-
axisMap: createHashMap(),
|
|
82
|
-
categoryAxisMap: createHashMap()
|
|
83
|
-
};
|
|
111
|
+
var result = new CoordSysInfo(coordSysName);
|
|
84
112
|
var fetch = fetchers[coordSysName];
|
|
85
113
|
|
|
86
114
|
if (fetch) {
|
|
@@ -104,7 +132,7 @@ var fetchers = {
|
|
|
104
132
|
|
|
105
133
|
if (isCategory(yAxisModel)) {
|
|
106
134
|
categoryAxisMap.set('y', yAxisModel);
|
|
107
|
-
result.firstCategoryDimIndex = 1;
|
|
135
|
+
result.firstCategoryDimIndex == null & (result.firstCategoryDimIndex = 1);
|
|
108
136
|
}
|
|
109
137
|
},
|
|
110
138
|
singleAxis: function (seriesModel, result, axisMap, categoryAxisMap) {
|
|
@@ -132,7 +160,7 @@ var fetchers = {
|
|
|
132
160
|
|
|
133
161
|
if (isCategory(angleAxisModel)) {
|
|
134
162
|
categoryAxisMap.set('angle', angleAxisModel);
|
|
135
|
-
result.firstCategoryDimIndex = 1;
|
|
163
|
+
result.firstCategoryDimIndex == null && (result.firstCategoryDimIndex = 1);
|
|
136
164
|
}
|
|
137
165
|
},
|
|
138
166
|
geo: function (seriesModel, result, axisMap, categoryAxisMap) {
|
|
@@ -159,4 +187,4 @@ function isCategory(axisModel) {
|
|
|
159
187
|
return axisModel.get('type') === 'category';
|
|
160
188
|
}
|
|
161
189
|
|
|
162
|
-
exports.
|
|
190
|
+
exports.getCoordSysInfoBySeries = getCoordSysInfoBySeries;
|
|
@@ -106,7 +106,7 @@ function _default(seriesType) {
|
|
|
106
106
|
var valueAxis = coordSys.getOtherAxis(baseAxis);
|
|
107
107
|
var extent = baseAxis.getExtent(); // Coordinste system has been resized
|
|
108
108
|
|
|
109
|
-
var size = extent[1] - extent[0];
|
|
109
|
+
var size = Math.abs(extent[1] - extent[0]);
|
|
110
110
|
var rate = Math.round(data.count() / size);
|
|
111
111
|
|
|
112
112
|
if (rate > 1) {
|
package/lib/scale/Interval.js
CHANGED
|
@@ -97,10 +97,95 @@ var IntervalScale = Scale.extend({
|
|
|
97
97
|
},
|
|
98
98
|
|
|
99
99
|
/**
|
|
100
|
+
* @param {boolean} [expandToNicedExtent=false] If expand the ticks to niced extent.
|
|
100
101
|
* @return {Array.<number>}
|
|
101
102
|
*/
|
|
102
|
-
getTicks: function () {
|
|
103
|
-
|
|
103
|
+
getTicks: function (expandToNicedExtent) {
|
|
104
|
+
var interval = this._interval;
|
|
105
|
+
var extent = this._extent;
|
|
106
|
+
var niceTickExtent = this._niceExtent;
|
|
107
|
+
var intervalPrecision = this._intervalPrecision;
|
|
108
|
+
var ticks = []; // If interval is 0, return [];
|
|
109
|
+
|
|
110
|
+
if (!interval) {
|
|
111
|
+
return ticks;
|
|
112
|
+
} // Consider this case: using dataZoom toolbox, zoom and zoom.
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
var safeLimit = 10000;
|
|
116
|
+
|
|
117
|
+
if (extent[0] < niceTickExtent[0]) {
|
|
118
|
+
if (expandToNicedExtent) {
|
|
119
|
+
ticks.push(roundNumber(niceTickExtent[0] - interval, intervalPrecision));
|
|
120
|
+
} else {
|
|
121
|
+
ticks.push(extent[0]);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
var tick = niceTickExtent[0];
|
|
126
|
+
|
|
127
|
+
while (tick <= niceTickExtent[1]) {
|
|
128
|
+
ticks.push(tick); // Avoid rounding error
|
|
129
|
+
|
|
130
|
+
tick = roundNumber(tick + interval, intervalPrecision);
|
|
131
|
+
|
|
132
|
+
if (tick === ticks[ticks.length - 1]) {
|
|
133
|
+
// Consider out of safe float point, e.g.,
|
|
134
|
+
// -3711126.9907707 + 2e-10 === -3711126.9907707
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (ticks.length > safeLimit) {
|
|
139
|
+
return [];
|
|
140
|
+
}
|
|
141
|
+
} // Consider this case: the last item of ticks is smaller
|
|
142
|
+
// than niceTickExtent[1] and niceTickExtent[1] === extent[1].
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
var lastNiceTick = ticks.length ? ticks[ticks.length - 1] : niceTickExtent[1];
|
|
146
|
+
|
|
147
|
+
if (extent[1] > lastNiceTick) {
|
|
148
|
+
if (expandToNicedExtent) {
|
|
149
|
+
ticks.push(roundNumber(lastNiceTick + interval, intervalPrecision));
|
|
150
|
+
} else {
|
|
151
|
+
ticks.push(extent[1]);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return ticks;
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* @param {number} [splitNumber=5]
|
|
160
|
+
* @return {Array.<Array.<number>>}
|
|
161
|
+
*/
|
|
162
|
+
getMinorTicks: function (splitNumber) {
|
|
163
|
+
var ticks = this.getTicks(true);
|
|
164
|
+
var minorTicks = [];
|
|
165
|
+
var extent = this.getExtent();
|
|
166
|
+
|
|
167
|
+
for (var i = 1; i < ticks.length; i++) {
|
|
168
|
+
var nextTick = ticks[i];
|
|
169
|
+
var prevTick = ticks[i - 1];
|
|
170
|
+
var count = 0;
|
|
171
|
+
var minorTicksGroup = [];
|
|
172
|
+
var interval = nextTick - prevTick;
|
|
173
|
+
var minorInterval = interval / splitNumber;
|
|
174
|
+
|
|
175
|
+
while (count < splitNumber - 1) {
|
|
176
|
+
var minorTick = numberUtil.round(prevTick + (count + 1) * minorInterval); // For the first and last interval. The count may be less than splitNumber.
|
|
177
|
+
|
|
178
|
+
if (minorTick > extent[0] && minorTick < extent[1]) {
|
|
179
|
+
minorTicksGroup.push(minorTick);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
count++;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
minorTicks.push(minorTicksGroup);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return minorTicks;
|
|
104
189
|
},
|
|
105
190
|
|
|
106
191
|
/**
|
package/lib/scale/Log.js
CHANGED
|
@@ -67,13 +67,14 @@ var LogScale = Scale.extend({
|
|
|
67
67
|
},
|
|
68
68
|
|
|
69
69
|
/**
|
|
70
|
+
* @param {boolean} [expandToNicedExtent=false] If expand the ticks to niced extent.
|
|
70
71
|
* @return {Array.<number>}
|
|
71
72
|
*/
|
|
72
|
-
getTicks: function () {
|
|
73
|
+
getTicks: function (expandToNicedExtent) {
|
|
73
74
|
var originalScale = this._originalScale;
|
|
74
75
|
var extent = this._extent;
|
|
75
76
|
var originalExtent = originalScale.getExtent();
|
|
76
|
-
return zrUtil.map(intervalScaleProto.getTicks.call(this), function (val) {
|
|
77
|
+
return zrUtil.map(intervalScaleProto.getTicks.call(this, expandToNicedExtent), function (val) {
|
|
77
78
|
var powVal = numberUtil.round(mathPow(this.base, val)); // Fix #4158
|
|
78
79
|
|
|
79
80
|
powVal = val === extent[0] && originalScale.__fixMin ? fixRoundingError(powVal, originalExtent[0]) : powVal;
|
|
@@ -82,6 +83,12 @@ var LogScale = Scale.extend({
|
|
|
82
83
|
}, this);
|
|
83
84
|
},
|
|
84
85
|
|
|
86
|
+
/**
|
|
87
|
+
* @param {number} splitNumber
|
|
88
|
+
* @return {Array.<Array.<number>>}
|
|
89
|
+
*/
|
|
90
|
+
getMinorTicks: intervalScaleProto.getMinorTicks,
|
|
91
|
+
|
|
85
92
|
/**
|
|
86
93
|
* @param {number} val
|
|
87
94
|
* @return {string}
|