echarts 3.6.1 → 3.7.2
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/README.md +1 -0
- package/dist/echarts-en.js +77756 -0
- package/dist/echarts-en.min.js +38 -0
- package/dist/echarts.common-en.js +50169 -0
- package/dist/echarts.common-en.min.js +30 -0
- package/dist/echarts.common.js +5799 -3093
- package/dist/echarts.common.min.js +14 -13
- package/dist/echarts.js +7628 -4679
- package/dist/echarts.min.js +22 -22
- package/dist/echarts.simple-en.js +34988 -0
- package/dist/echarts.simple-en.min.js +27 -0
- package/dist/echarts.simple.js +4472 -2493
- package/dist/echarts.simple.min.js +11 -9
- package/dist/extension/bmap.js +50 -11
- package/dist/extension/bmap.min.js +1 -1
- package/dist/extension/dataTool.js +10 -10
- package/extension/bmap/BMapCoordSys.js +40 -1
- package/index.blank.js +4 -0
- package/index.common.js +1 -1
- package/index.js +1 -1
- package/lib/action/createDataSelectAction.js +6 -2
- package/lib/chart/bar/BarView.js +6 -3
- package/lib/chart/bar/BaseBarSeries.js +4 -3
- package/lib/chart/bar/PictorialBarSeries.js +1 -1
- package/lib/chart/bar/PictorialBarView.js +29 -7
- package/lib/chart/bar/helper.js +14 -31
- package/lib/chart/candlestick/candlestickLayout.js +49 -6
- package/lib/chart/chord/chordCircularLayout.js +2 -2
- package/lib/chart/custom.js +135 -21
- package/lib/chart/funnel/FunnelSeries.js +0 -1
- package/lib/chart/funnel/FunnelView.js +15 -22
- package/lib/chart/funnel/funnelLayout.js +1 -1
- package/lib/chart/gauge/GaugeSeries.js +7 -12
- package/lib/chart/gauge/GaugeView.js +32 -53
- package/lib/chart/graph/GraphSeries.js +2 -1
- package/lib/chart/graph/GraphView.js +39 -45
- package/lib/chart/graph/forceHelper.js +5 -0
- package/lib/chart/graph/forceLayout.js +1 -1
- package/lib/chart/heatmap/HeatmapLayer.js +7 -0
- package/lib/chart/heatmap/HeatmapView.js +10 -9
- package/lib/chart/helper/EffectSymbol.js +3 -3
- package/lib/chart/helper/LargeSymbolDraw.js +6 -1
- package/lib/chart/helper/Line.js +40 -22
- package/lib/chart/helper/Symbol.js +20 -7
- package/lib/chart/helper/SymbolDraw.js +2 -1
- package/lib/chart/helper/labelHelper.js +0 -17
- package/lib/chart/helper/whiskerBoxCommon.js +11 -3
- package/lib/chart/line/LineSeries.js +1 -0
- package/lib/chart/line/LineView.js +14 -2
- package/lib/chart/line/poly.js +5 -0
- package/lib/chart/lines/LinesView.js +22 -7
- package/lib/chart/map/MapSeries.js +3 -7
- package/lib/chart/map/MapView.js +29 -18
- package/lib/chart/pie/PieSeries.js +20 -6
- package/lib/chart/pie/PieView.js +20 -23
- package/lib/chart/pie/labelLayout.js +3 -3
- package/lib/chart/radar/RadarView.js +16 -20
- package/lib/chart/sankey/SankeySeries.js +2 -4
- package/lib/chart/sankey/SankeyView.js +13 -29
- package/lib/chart/sankey/sankeyLayout.js +1 -1
- package/lib/chart/scatter/ScatterSeries.js +2 -1
- package/lib/chart/themeRiver/ThemeRiverSeries.js +2 -4
- package/lib/chart/themeRiver/ThemeRiverView.js +2 -5
- package/lib/chart/themeRiver/themeRiverLayout.js +1 -1
- package/lib/chart/treemap/Breadcrumb.js +1 -1
- package/lib/chart/treemap/TreemapSeries.js +28 -8
- package/lib/chart/treemap/TreemapView.js +88 -77
- package/lib/chart/treemap/treemapLayout.js +29 -13
- package/lib/component/axis/AngleAxisView.js +13 -19
- package/lib/component/axis/AxisBuilder.js +260 -186
- package/lib/component/axis/CartesianAxisView.js +15 -3
- package/lib/component/axis/ParallelAxisView.js +1 -1
- package/lib/component/axis/RadiusAxisView.js +1 -1
- package/lib/component/axis/SingleAxisView.js +8 -2
- package/lib/component/axis/cartesianAxisHelper.js +11 -15
- package/lib/component/axisPointer/AxisPointerModel.js +1 -3
- package/lib/component/axisPointer/BaseAxisPointer.js +15 -38
- package/lib/component/axisPointer/axisTrigger.js +36 -20
- package/lib/component/axisPointer/modelHelper.js +3 -4
- package/lib/component/axisPointer/viewHelper.js +4 -6
- package/lib/component/axisPointer.js +1 -14
- package/lib/component/calendar/CalendarView.js +22 -39
- package/lib/component/dataZoom/AxisProxy.js +3 -2
- package/lib/component/dataZoom/DataZoomModel.js +16 -4
- package/lib/component/dataZoom/InsideZoomView.js +5 -3
- package/lib/component/dataZoom/SliderZoomView.js +21 -32
- package/lib/component/dataZoom/roams.js +33 -9
- package/lib/component/dataZoom/typeDefaulter.js +1 -1
- package/lib/component/graphic.js +17 -5
- package/lib/component/helper/BrushTargetManager.js +1 -1
- package/lib/component/helper/MapDraw.js +26 -22
- package/lib/component/helper/RoamController.js +12 -11
- package/lib/component/helper/listComponent.js +27 -24
- package/lib/component/helper/selectableMixin.js +40 -15
- package/lib/component/legend/LegendModel.js +11 -3
- package/lib/component/legend/LegendView.js +151 -70
- package/lib/component/legend/ScrollableLegendModel.js +75 -0
- package/lib/component/legend/ScrollableLegendView.js +367 -0
- package/lib/component/legend/legendAction.js +1 -0
- package/lib/component/legend/scrollableLegendAction.js +24 -0
- package/lib/component/legend.js +8 -3
- package/lib/component/legendScroll.js +11 -0
- package/lib/component/marker/MarkAreaView.js +12 -26
- package/lib/component/marker/MarkLineView.js +5 -5
- package/lib/component/marker/MarkPointView.js +4 -4
- package/lib/component/marker/MarkerModel.js +1 -4
- package/lib/component/marker/markerHelper.js +1 -0
- package/lib/component/radar/RadarView.js +6 -3
- package/lib/component/timeline/SliderTimelineModel.js +4 -6
- package/lib/component/timeline/SliderTimelineView.js +14 -16
- package/lib/component/timeline/TimelineAxis.js +1 -1
- package/lib/component/timeline/TimelineModel.js +1 -3
- package/lib/component/title.js +9 -10
- package/lib/component/toolbox/ToolboxModel.js +2 -0
- package/lib/component/toolbox/ToolboxView.js +15 -27
- package/lib/component/toolbox/feature/Brush.js +3 -8
- package/lib/component/toolbox/feature/DataView.js +5 -5
- package/lib/component/toolbox/feature/DataZoom.js +3 -4
- package/lib/component/toolbox/feature/MagicType.js +3 -6
- package/lib/component/toolbox/feature/Restore.js +2 -1
- package/lib/component/toolbox/feature/SaveAsImage.js +23 -9
- package/lib/component/tooltip/TooltipContent.js +4 -4
- package/lib/component/tooltip/TooltipView.js +29 -6
- package/lib/component/visualMap/ContinuousModel.js +2 -2
- package/lib/component/visualMap/ContinuousView.js +12 -8
- package/lib/component/visualMap/PiecewiseModel.js +1 -2
- package/lib/component/visualMap/PiecewiseView.js +2 -2
- package/lib/component/visualMap/VisualMapModel.js +18 -12
- package/lib/coord/Axis.js +1 -1
- package/lib/coord/axisDefault.js +3 -3
- package/lib/coord/axisHelper.js +18 -1
- package/lib/coord/axisModelCommonMixin.js +12 -2
- package/lib/coord/calendar/Calendar.js +65 -21
- package/lib/coord/calendar/CalendarModel.js +6 -12
- package/lib/coord/cartesian/Cartesian2D.js +0 -14
- package/lib/coord/cartesian/Grid.js +47 -28
- package/lib/coord/geo/Geo.js +2 -18
- package/lib/coord/geo/GeoModel.js +6 -13
- package/lib/coord/geo/fix/diaoyuIsland.js +30 -0
- package/lib/coord/geo/geoCreator.js +6 -1
- package/lib/coord/polar/Polar.js +0 -13
- package/lib/coord/radar/Radar.js +1 -1
- package/lib/coord/radar/RadarModel.js +6 -2
- package/lib/data/DataDiffer.js +14 -7
- package/lib/data/Graph.js +3 -0
- package/lib/data/List.js +1 -1
- package/lib/data/Tree.js +2 -2
- package/lib/data/helper/completeDimensions.js +2 -11
- package/lib/echarts.js +33 -10
- package/lib/lang/cn.js +4 -0
- package/lib/lang/default.js +42 -0
- package/lib/lang/en.js +42 -0
- package/lib/lang.js +42 -0
- package/lib/langEN.js +42 -0
- package/lib/layout/barGrid.js +11 -3
- package/lib/layout/barPolar.js +9 -2
- package/lib/model/Model.js +2 -1
- package/lib/model/Series.js +14 -6
- package/lib/model/mixin/textStyle.js +11 -9
- package/lib/preprocessor/backwardCompat.js +5 -4
- package/lib/preprocessor/helper/compatStyle.js +157 -45
- package/lib/scale/Interval.js +10 -4
- package/lib/scale/Time.js +14 -6
- package/lib/scale/helper.js +15 -2
- package/lib/util/format.js +4 -24
- package/lib/util/graphic.js +412 -21
- package/lib/util/layout.js +28 -16
- package/lib/util/model.js +26 -11
- package/lib/util/number.js +106 -21
- package/lib/visual/VisualMapping.js +4 -4
- package/package.json +3 -3
- package/rollup.config.js +49 -0
- package/src/action/createDataSelectAction.js +6 -2
- package/src/chart/bar/BarView.js +6 -3
- package/src/chart/bar/BaseBarSeries.js +4 -3
- package/src/chart/bar/PictorialBarSeries.js +1 -1
- package/src/chart/bar/PictorialBarView.js +29 -7
- package/src/chart/bar/helper.js +13 -30
- package/src/chart/candlestick/candlestickLayout.js +49 -6
- package/src/chart/chord/chordCircularLayout.js +2 -2
- package/src/chart/custom.js +135 -21
- package/src/chart/funnel/FunnelSeries.js +0 -1
- package/src/chart/funnel/FunnelView.js +15 -22
- package/src/chart/funnel/funnelLayout.js +1 -1
- package/src/chart/gauge/GaugeSeries.js +7 -12
- package/src/chart/gauge/GaugeView.js +32 -53
- package/src/chart/graph/GraphSeries.js +2 -1
- package/src/chart/graph/GraphView.js +39 -45
- package/src/chart/graph/forceHelper.js +5 -0
- package/src/chart/graph/forceLayout.js +1 -1
- package/src/chart/heatmap/HeatmapLayer.js +7 -0
- package/src/chart/heatmap/HeatmapView.js +10 -9
- package/src/chart/helper/EffectSymbol.js +3 -3
- package/src/chart/helper/LargeSymbolDraw.js +6 -1
- package/src/chart/helper/Line.js +40 -22
- package/src/chart/helper/Symbol.js +20 -7
- package/src/chart/helper/SymbolDraw.js +2 -1
- package/src/chart/helper/labelHelper.js +0 -17
- package/src/chart/helper/whiskerBoxCommon.js +11 -4
- package/src/chart/line/LineSeries.js +1 -0
- package/src/chart/line/LineView.js +14 -2
- package/src/chart/line/poly.js +5 -0
- package/src/chart/lines/LinesView.js +22 -7
- package/src/chart/map/MapSeries.js +3 -7
- package/src/chart/map/MapView.js +29 -18
- package/src/chart/pie/PieSeries.js +20 -6
- package/src/chart/pie/PieView.js +20 -23
- package/src/chart/pie/labelLayout.js +3 -3
- package/src/chart/radar/RadarView.js +16 -20
- package/src/chart/sankey/SankeySeries.js +2 -4
- package/src/chart/sankey/SankeyView.js +13 -29
- package/src/chart/sankey/sankeyLayout.js +1 -1
- package/src/chart/scatter/ScatterSeries.js +2 -1
- package/src/chart/themeRiver/ThemeRiverSeries.js +2 -4
- package/src/chart/themeRiver/ThemeRiverView.js +2 -5
- package/src/chart/themeRiver/themeRiverLayout.js +1 -1
- package/src/chart/treemap/Breadcrumb.js +1 -1
- package/src/chart/treemap/TreemapSeries.js +28 -8
- package/src/chart/treemap/TreemapView.js +88 -77
- package/src/chart/treemap/treemapLayout.js +29 -13
- package/src/component/axis/AngleAxisView.js +13 -19
- package/src/component/axis/AxisBuilder.js +260 -186
- package/src/component/axis/CartesianAxisView.js +15 -3
- package/src/component/axis/ParallelAxisView.js +1 -1
- package/src/component/axis/RadiusAxisView.js +1 -1
- package/src/component/axis/SingleAxisView.js +8 -2
- package/src/component/axis/cartesianAxisHelper.js +11 -15
- package/src/component/axisPointer/AxisPointerModel.js +1 -3
- package/src/component/axisPointer/BaseAxisPointer.js +15 -38
- package/src/component/axisPointer/axisTrigger.js +36 -20
- package/src/component/axisPointer/modelHelper.js +3 -4
- package/src/component/axisPointer/viewHelper.js +4 -6
- package/src/component/axisPointer.js +1 -14
- package/src/component/calendar/CalendarView.js +22 -39
- package/src/component/dataZoom/AxisProxy.js +3 -2
- package/src/component/dataZoom/DataZoomModel.js +16 -4
- package/src/component/dataZoom/InsideZoomView.js +5 -3
- package/src/component/dataZoom/SliderZoomView.js +21 -32
- package/src/component/dataZoom/roams.js +33 -9
- package/src/component/dataZoom/typeDefaulter.js +1 -1
- package/src/component/graphic.js +17 -5
- package/src/component/helper/BrushTargetManager.js +1 -1
- package/src/component/helper/MapDraw.js +26 -22
- package/src/component/helper/RoamController.js +12 -11
- package/src/component/helper/listComponent.js +27 -24
- package/src/component/helper/selectableMixin.js +40 -15
- package/src/component/legend/LegendModel.js +11 -3
- package/src/component/legend/LegendView.js +151 -70
- package/src/component/legend/ScrollableLegendModel.js +76 -0
- package/src/component/legend/ScrollableLegendView.js +368 -0
- package/src/component/legend/legendAction.js +1 -0
- package/src/component/legend/scrollableLegendAction.js +25 -0
- package/src/component/legend.js +8 -3
- package/src/component/legendScroll.js +12 -0
- package/src/component/marker/MarkAreaView.js +12 -26
- package/src/component/marker/MarkLineView.js +5 -5
- package/src/component/marker/MarkPointView.js +4 -4
- package/src/component/marker/MarkerModel.js +1 -4
- package/src/component/marker/markerHelper.js +1 -0
- package/src/component/radar/RadarView.js +6 -3
- package/src/component/timeline/SliderTimelineModel.js +4 -6
- package/src/component/timeline/SliderTimelineView.js +14 -16
- package/src/component/timeline/TimelineAxis.js +1 -1
- package/src/component/timeline/TimelineModel.js +1 -3
- package/src/component/title.js +9 -10
- package/src/component/toolbox/ToolboxModel.js +2 -0
- package/src/component/toolbox/ToolboxView.js +15 -27
- package/src/component/toolbox/feature/Brush.js +3 -8
- package/src/component/toolbox/feature/DataView.js +5 -5
- package/src/component/toolbox/feature/DataZoom.js +3 -4
- package/src/component/toolbox/feature/MagicType.js +3 -6
- package/src/component/toolbox/feature/Restore.js +2 -1
- package/src/component/toolbox/feature/SaveAsImage.js +23 -10
- package/src/component/tooltip/TooltipContent.js +4 -4
- package/src/component/tooltip/TooltipView.js +29 -7
- package/src/component/visualMap/ContinuousModel.js +2 -2
- package/src/component/visualMap/ContinuousView.js +12 -8
- package/src/component/visualMap/PiecewiseModel.js +1 -2
- package/src/component/visualMap/PiecewiseView.js +2 -2
- package/src/component/visualMap/VisualMapModel.js +18 -12
- package/src/coord/Axis.js +1 -1
- package/src/coord/axisDefault.js +3 -3
- package/src/coord/axisHelper.js +18 -1
- package/src/coord/axisModelCommonMixin.js +12 -2
- package/src/coord/calendar/Calendar.js +65 -21
- package/src/coord/calendar/CalendarModel.js +6 -12
- package/src/coord/cartesian/Cartesian2D.js +0 -14
- package/src/coord/cartesian/Grid.js +47 -28
- package/src/coord/geo/Geo.js +2 -18
- package/src/coord/geo/GeoModel.js +6 -13
- package/src/coord/geo/fix/diaoyuIsland.js +30 -0
- package/src/coord/geo/geoCreator.js +6 -1
- package/src/coord/polar/Polar.js +0 -13
- package/src/coord/radar/Radar.js +1 -1
- package/src/coord/radar/RadarModel.js +6 -2
- package/src/data/DataDiffer.js +14 -7
- package/src/data/Graph.js +3 -0
- package/src/data/List.js +1 -1
- package/src/data/Tree.js +2 -2
- package/src/data/helper/completeDimensions.js +2 -11
- package/src/echarts.js +33 -10
- package/src/lang.js +43 -0
- package/src/langEN.js +43 -0
- package/src/layout/barGrid.js +11 -3
- package/src/layout/barPolar.js +9 -2
- package/src/model/Model.js +2 -1
- package/src/model/Series.js +14 -6
- package/src/model/mixin/textStyle.js +11 -9
- package/src/preprocessor/backwardCompat.js +5 -4
- package/src/preprocessor/helper/compatStyle.js +157 -45
- package/src/scale/Interval.js +10 -4
- package/src/scale/Time.js +14 -6
- package/src/scale/helper.js +15 -2
- package/src/util/format.js +4 -24
- package/src/util/graphic.js +412 -21
- package/src/util/layout.js +28 -16
- package/src/util/model.js +26 -11
- package/src/util/number.js +106 -21
- package/src/visual/VisualMapping.js +4 -4
- package/webpack.config.js +21 -7
- package/.npmignore +0 -10
package/lib/util/model.js
CHANGED
|
@@ -29,9 +29,7 @@
|
|
|
29
29
|
* normal: {
|
|
30
30
|
* show: false,
|
|
31
31
|
* position: 'outside',
|
|
32
|
-
*
|
|
33
|
-
* fontSize: 18
|
|
34
|
-
* }
|
|
32
|
+
* fontSize: 18
|
|
35
33
|
* },
|
|
36
34
|
* emphasis: {
|
|
37
35
|
* show: true
|
|
@@ -46,16 +44,32 @@
|
|
|
46
44
|
var normalOpt = opt.normal = opt.normal || {};
|
|
47
45
|
|
|
48
46
|
// Default emphasis option from normal
|
|
49
|
-
|
|
50
|
-
var
|
|
51
|
-
if (
|
|
52
|
-
|
|
47
|
+
for (var i = 0, len = subOpts.length; i < len; i++) {
|
|
48
|
+
var subOptName = subOpts[i];
|
|
49
|
+
if (!emphasisOpt.hasOwnProperty(subOptName)
|
|
50
|
+
&& normalOpt.hasOwnProperty(subOptName)
|
|
51
|
+
) {
|
|
52
|
+
emphasisOpt[subOptName] = normalOpt[subOptName];
|
|
53
53
|
}
|
|
54
|
-
}
|
|
54
|
+
}
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
-
modelUtil.
|
|
58
|
+
modelUtil.TEXT_STYLE_OPTIONS = [
|
|
59
|
+
'fontStyle', 'fontWeight', 'fontSize', 'fontFamily',
|
|
60
|
+
'rich', 'tag', 'color', 'textBorderColor', 'textBorderWidth',
|
|
61
|
+
'width', 'height', 'lineHeight', 'align', 'verticalAlign', 'baseline',
|
|
62
|
+
'shadowColor', 'shadowBlur', 'shadowOffsetX', 'shadowOffsetY',
|
|
63
|
+
'textShadowColor', 'textShadowBlur', 'textShadowOffsetX', 'textShadowOffsetY',
|
|
64
|
+
'backgroundColor', 'borderColor', 'borderWidth', 'borderRadius', 'padding'
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
// modelUtil.LABEL_OPTIONS = modelUtil.TEXT_STYLE_OPTIONS.concat([
|
|
68
|
+
// 'position', 'offset', 'rotate', 'origin', 'show', 'distance', 'formatter',
|
|
69
|
+
// 'fontStyle', 'fontWeight', 'fontSize', 'fontFamily',
|
|
70
|
+
// // FIXME: deprecated, check and remove it.
|
|
71
|
+
// 'textStyle'
|
|
72
|
+
// ]);
|
|
59
73
|
|
|
60
74
|
/**
|
|
61
75
|
* data could be [12, 2323, {value: 223}, [1221, 23], {value: [2, 23]}]
|
|
@@ -173,9 +187,10 @@
|
|
|
173
187
|
* @param {string} [status='normal'] 'normal' or 'emphasis'
|
|
174
188
|
* @param {string} [dataType]
|
|
175
189
|
* @param {number} [dimIndex]
|
|
190
|
+
* @param {string} [labelProp='label']
|
|
176
191
|
* @return {string}
|
|
177
192
|
*/
|
|
178
|
-
getFormattedLabel: function (dataIndex, status, dataType, dimIndex) {
|
|
193
|
+
getFormattedLabel: function (dataIndex, status, dataType, dimIndex, labelProp) {
|
|
179
194
|
status = status || 'normal';
|
|
180
195
|
var data = this.getData(dataType);
|
|
181
196
|
var itemModel = data.getItemModel(dataIndex);
|
|
@@ -185,7 +200,7 @@
|
|
|
185
200
|
params.value = params.value[dimIndex];
|
|
186
201
|
}
|
|
187
202
|
|
|
188
|
-
var formatter = itemModel.get(['label', status, 'formatter']);
|
|
203
|
+
var formatter = itemModel.get([labelProp || 'label', status, 'formatter']);
|
|
189
204
|
|
|
190
205
|
if (typeof formatter === 'function') {
|
|
191
206
|
params.status = status;
|
package/lib/util/number.js
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
var zrUtil = require('zrender/lib/core/util');
|
|
9
|
+
|
|
8
10
|
var number = {};
|
|
9
11
|
|
|
10
12
|
var RADIAN_EPSILON = 1e-4;
|
|
@@ -185,6 +187,68 @@
|
|
|
185
187
|
return !isFinite(precision) ? 20 : precision;
|
|
186
188
|
};
|
|
187
189
|
|
|
190
|
+
/**
|
|
191
|
+
* Get a data of given precision, assuring the sum of percentages
|
|
192
|
+
* in valueList is 1.
|
|
193
|
+
* The largest remainer method is used.
|
|
194
|
+
* https://en.wikipedia.org/wiki/Largest_remainder_method
|
|
195
|
+
*
|
|
196
|
+
* @param {Array.<number>} valueList a list of all data
|
|
197
|
+
* @param {number} idx index of the data to be processed in valueList
|
|
198
|
+
* @param {number} precision integer number showing digits of precision
|
|
199
|
+
* @return {number} percent ranging from 0 to 100
|
|
200
|
+
*/
|
|
201
|
+
number.getPercentWithPrecision = function (valueList, idx, precision) {
|
|
202
|
+
if (!valueList[idx]) {
|
|
203
|
+
return 0;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
var sum = zrUtil.reduce(valueList, function (acc, val) {
|
|
207
|
+
return acc + (isNaN(val) ? 0 : val);
|
|
208
|
+
}, 0);
|
|
209
|
+
if (sum === 0) {
|
|
210
|
+
return 0;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
var digits = Math.pow(10, precision);
|
|
214
|
+
var votesPerQuota = zrUtil.map(valueList, function (val) {
|
|
215
|
+
return (isNaN(val) ? 0 : val) / sum * digits * 100;
|
|
216
|
+
});
|
|
217
|
+
var targetSeats = digits * 100;
|
|
218
|
+
|
|
219
|
+
var seats = zrUtil.map(votesPerQuota, function (votes) {
|
|
220
|
+
// Assign automatic seats.
|
|
221
|
+
return Math.floor(votes);
|
|
222
|
+
});
|
|
223
|
+
var currentSum = zrUtil.reduce(seats, function (acc, val) {
|
|
224
|
+
return acc + val;
|
|
225
|
+
}, 0);
|
|
226
|
+
|
|
227
|
+
var remainder = zrUtil.map(votesPerQuota, function (votes, idx) {
|
|
228
|
+
return votes - seats[idx];
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
// Has remainding votes.
|
|
232
|
+
while (currentSum < targetSeats) {
|
|
233
|
+
// Find next largest remainder.
|
|
234
|
+
var max = Number.NEGATIVE_INFINITY;
|
|
235
|
+
var maxId = null;
|
|
236
|
+
for (var i = 0, len = remainder.length; i < len; ++i) {
|
|
237
|
+
if (remainder[i] > max) {
|
|
238
|
+
max = remainder[i];
|
|
239
|
+
maxId = i;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// Add a vote to max remainder.
|
|
244
|
+
++seats[maxId];
|
|
245
|
+
remainder[maxId] = 0;
|
|
246
|
+
++currentSum;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
return seats[idx] / digits;
|
|
250
|
+
};
|
|
251
|
+
|
|
188
252
|
// Number.MAX_SAFE_INTEGER, ie do not support.
|
|
189
253
|
number.MAX_SAFE_INTEGER = 9007199254740991;
|
|
190
254
|
|
|
@@ -209,11 +273,14 @@
|
|
|
209
273
|
var TIME_REG = /^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d\d)(?::(\d\d)(?:[.,](\d+))?)?)?(Z|[\+\-]\d\d:?\d\d)?)?)?)?)?$/; // jshint ignore:line
|
|
210
274
|
|
|
211
275
|
/**
|
|
276
|
+
* Consider DST, it is incorrect to provide a method `getTimezoneOffset`
|
|
277
|
+
* without time specified. So this method is removed.
|
|
278
|
+
*
|
|
212
279
|
* @return {number} in minutes
|
|
213
280
|
*/
|
|
214
|
-
number.getTimezoneOffset = function () {
|
|
215
|
-
|
|
216
|
-
};
|
|
281
|
+
// number.getTimezoneOffset = function () {
|
|
282
|
+
// return (new Date()).getTimezoneOffset();
|
|
283
|
+
// };
|
|
217
284
|
|
|
218
285
|
/**
|
|
219
286
|
* @param {string|Date|number} value These values can be accepted:
|
|
@@ -247,24 +314,42 @@
|
|
|
247
314
|
return new Date(NaN);
|
|
248
315
|
}
|
|
249
316
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
317
|
+
// Use local time when no timezone offset specifed.
|
|
318
|
+
if (!match[8]) {
|
|
319
|
+
// match[n] can only be string or undefined.
|
|
320
|
+
// But take care of '12' + 1 => '121'.
|
|
321
|
+
return new Date(
|
|
322
|
+
+match[1],
|
|
323
|
+
+(match[2] || 1) - 1,
|
|
324
|
+
+match[3] || 1,
|
|
325
|
+
+match[4] || 0,
|
|
326
|
+
+(match[5] || 0),
|
|
327
|
+
+match[6] || 0,
|
|
328
|
+
+match[7] || 0
|
|
329
|
+
);
|
|
330
|
+
}
|
|
331
|
+
// Timezoneoffset of Javascript Date has considered DST (Daylight Saving Time,
|
|
332
|
+
// https://tc39.github.io/ecma262/#sec-daylight-saving-time-adjustment).
|
|
333
|
+
// For example, system timezone is set as "Time Zone: America/Toronto",
|
|
334
|
+
// then these code will get different result:
|
|
335
|
+
// `new Date(1478411999999).getTimezoneOffset(); // get 240`
|
|
336
|
+
// `new Date(1478412000000).getTimezoneOffset(); // get 300`
|
|
337
|
+
// So we should not use `new Date`, but use `Date.UTC`.
|
|
338
|
+
else {
|
|
339
|
+
var hour = +match[4] || 0;
|
|
340
|
+
if (match[8].toUpperCase() !== 'Z') {
|
|
341
|
+
hour -= match[8].slice(0, 3);
|
|
342
|
+
}
|
|
343
|
+
return new Date(Date.UTC(
|
|
344
|
+
+match[1],
|
|
345
|
+
+(match[2] || 1) - 1,
|
|
346
|
+
+match[3] || 1,
|
|
347
|
+
hour,
|
|
348
|
+
+(match[5] || 0),
|
|
349
|
+
+match[6] || 0,
|
|
350
|
+
+match[7] || 0
|
|
351
|
+
));
|
|
352
|
+
}
|
|
268
353
|
}
|
|
269
354
|
else if (value == null) {
|
|
270
355
|
return new Date(NaN);
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
// which will be much faster and useful in pixel manipulation
|
|
143
143
|
var returnRGBArray = !!out;
|
|
144
144
|
!isNormalized && (value = this._normalizeData(value));
|
|
145
|
-
out = zrColor.
|
|
145
|
+
out = zrColor.fastLerp(value, thisOption.parsedVisual, out);
|
|
146
146
|
return returnRGBArray ? out : zrColor.stringify(out, 'rgba');
|
|
147
147
|
},
|
|
148
148
|
this
|
|
@@ -152,7 +152,7 @@
|
|
|
152
152
|
_doMap: {
|
|
153
153
|
linear: function (normalized) {
|
|
154
154
|
return zrColor.stringify(
|
|
155
|
-
zrColor.
|
|
155
|
+
zrColor.fastLerp(normalized, this.option.parsedVisual),
|
|
156
156
|
'rgba'
|
|
157
157
|
);
|
|
158
158
|
},
|
|
@@ -161,7 +161,7 @@
|
|
|
161
161
|
var result = getSpecifiedVisual.call(this, value);
|
|
162
162
|
if (result == null) {
|
|
163
163
|
result = zrColor.stringify(
|
|
164
|
-
zrColor.
|
|
164
|
+
zrColor.fastLerp(normalized, this.option.parsedVisual),
|
|
165
165
|
'rgba'
|
|
166
166
|
);
|
|
167
167
|
}
|
|
@@ -471,7 +471,7 @@
|
|
|
471
471
|
/**
|
|
472
472
|
* @public
|
|
473
473
|
* @param {Object} obj
|
|
474
|
-
* @return {
|
|
474
|
+
* @return {Object} new object containers visual values.
|
|
475
475
|
* If no visuals, return null.
|
|
476
476
|
*/
|
|
477
477
|
VisualMapping.retrieveVisuals = function (obj) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "echarts",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.2",
|
|
4
4
|
"description": "A powerful charting and visualization library for browser",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"visualization",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"prepublish": "node build/amd2common.js"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"zrender": "^3.
|
|
38
|
+
"zrender": "^3.6.2"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"coordtransform": "^2.0.2",
|
|
@@ -45,6 +45,6 @@
|
|
|
45
45
|
"fs-extra": "^0.26.5",
|
|
46
46
|
"glob": "^7.0.0",
|
|
47
47
|
"webpack": "^1.12.13",
|
|
48
|
-
"zrender": "^3.
|
|
48
|
+
"zrender": "^3.6.2"
|
|
49
49
|
}
|
|
50
50
|
}
|
package/rollup.config.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import resolve from 'rollup-plugin-node-resolve';
|
|
2
|
+
import commonjs from 'rollup-plugin-commonjs';
|
|
3
|
+
import uglify from 'rollup-plugin-uglify';
|
|
4
|
+
|
|
5
|
+
function plugins(production) {
|
|
6
|
+
let plugins = [
|
|
7
|
+
resolve(),
|
|
8
|
+
commonjs()
|
|
9
|
+
];
|
|
10
|
+
if (production) {
|
|
11
|
+
plugins.push(uglify({
|
|
12
|
+
compress: {
|
|
13
|
+
global_defs: {
|
|
14
|
+
__DEV__: true
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
19
|
+
return plugins;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function createBuild(type, production) {
|
|
23
|
+
if (type) {
|
|
24
|
+
type = '.' + type;
|
|
25
|
+
}
|
|
26
|
+
var postfix = '';
|
|
27
|
+
if (production) {
|
|
28
|
+
postfix = '.min';
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
entry: `./index${type}.js`,
|
|
32
|
+
format: 'umd',
|
|
33
|
+
moduleName: 'echarts',
|
|
34
|
+
plugins: plugins(production),
|
|
35
|
+
dest: `dist/echarts${type}${postfix}.js`
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default [
|
|
40
|
+
createBuild('blank', false),
|
|
41
|
+
createBuild('simple', false),
|
|
42
|
+
createBuild('common', false),
|
|
43
|
+
createBuild('', false),
|
|
44
|
+
|
|
45
|
+
createBuild('blank', true),
|
|
46
|
+
createBuild('simple', true),
|
|
47
|
+
createBuild('common', true),
|
|
48
|
+
createBuild('', true)
|
|
49
|
+
];
|
|
@@ -15,13 +15,17 @@ define(function (require) {
|
|
|
15
15
|
{mainType: 'series', subType: seriesType, query: payload},
|
|
16
16
|
function (seriesModel) {
|
|
17
17
|
if (seriesModel[actionInfo.method]) {
|
|
18
|
-
seriesModel[actionInfo.method](
|
|
18
|
+
seriesModel[actionInfo.method](
|
|
19
|
+
payload.name,
|
|
20
|
+
payload.dataIndex
|
|
21
|
+
);
|
|
19
22
|
}
|
|
20
23
|
var data = seriesModel.getData();
|
|
21
24
|
// Create selected map
|
|
22
25
|
data.each(function (idx) {
|
|
23
26
|
var name = data.getName(idx);
|
|
24
|
-
selected[name] = seriesModel.isSelected(name)
|
|
27
|
+
selected[name] = seriesModel.isSelected(name)
|
|
28
|
+
|| false;
|
|
25
29
|
});
|
|
26
30
|
}
|
|
27
31
|
);
|
package/src/chart/bar/BarView.js
CHANGED
|
@@ -181,7 +181,7 @@ define(function (require) {
|
|
|
181
181
|
|
|
182
182
|
function removeRect(dataIndex, animationModel, el) {
|
|
183
183
|
// Not show text when animating
|
|
184
|
-
el.style.text =
|
|
184
|
+
el.style.text = null;
|
|
185
185
|
graphic.updateProps(el, {
|
|
186
186
|
shape: {
|
|
187
187
|
width: 0
|
|
@@ -193,7 +193,7 @@ define(function (require) {
|
|
|
193
193
|
|
|
194
194
|
function removeSector(dataIndex, animationModel, el) {
|
|
195
195
|
// Not show text when animating
|
|
196
|
-
el.style.text =
|
|
196
|
+
el.style.text = null;
|
|
197
197
|
graphic.updateProps(el, {
|
|
198
198
|
shape: {
|
|
199
199
|
r: el.shape.r0
|
|
@@ -240,7 +240,7 @@ define(function (require) {
|
|
|
240
240
|
var itemStyleModel = itemModel.getModel('itemStyle.normal');
|
|
241
241
|
var hoverStyle = itemModel.getModel('itemStyle.emphasis').getBarItemStyle();
|
|
242
242
|
|
|
243
|
-
if (!isPolar
|
|
243
|
+
if (!isPolar) {
|
|
244
244
|
el.setShape('r', itemStyleModel.get('barBorderRadius') || 0);
|
|
245
245
|
}
|
|
246
246
|
|
|
@@ -252,6 +252,9 @@ define(function (require) {
|
|
|
252
252
|
itemStyleModel.getBarItemStyle()
|
|
253
253
|
));
|
|
254
254
|
|
|
255
|
+
var cursorStyle = itemModel.getShallow('cursor');
|
|
256
|
+
cursorStyle && el.attr('cursor', cursorStyle);
|
|
257
|
+
|
|
255
258
|
var labelPositionOutside = isHorizontal
|
|
256
259
|
? (layout.height > 0 ? 'bottom' : 'top')
|
|
257
260
|
: (layout.width > 0 ? 'left' : 'right');
|
|
@@ -43,6 +43,7 @@ define(function(require) {
|
|
|
43
43
|
barMinHeight: 0,
|
|
44
44
|
// 最小角度为0,仅对极坐标系下的柱状图有效
|
|
45
45
|
barMinAngle: 0,
|
|
46
|
+
// cursor: null,
|
|
46
47
|
|
|
47
48
|
// barMaxWidth: null,
|
|
48
49
|
// 默认自适应
|
|
@@ -57,10 +58,10 @@ define(function(require) {
|
|
|
57
58
|
// }
|
|
58
59
|
// },
|
|
59
60
|
itemStyle: {
|
|
60
|
-
normal: {
|
|
61
|
+
// normal: {
|
|
61
62
|
// color: '各异'
|
|
62
|
-
},
|
|
63
|
-
emphasis: {}
|
|
63
|
+
// },
|
|
64
|
+
// emphasis: {}
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
67
|
});
|
|
@@ -22,7 +22,7 @@ define(function(require) {
|
|
|
22
22
|
symbolRepeatDirection: 'end', // 'end' means from 'start' to 'end'.
|
|
23
23
|
|
|
24
24
|
symbolClip: false,
|
|
25
|
-
symbolBoundingData: null,
|
|
25
|
+
symbolBoundingData: null, // Can be 60 or -40 or [-40, 60]
|
|
26
26
|
symbolPatternSize: 400, // 400 * 400 px
|
|
27
27
|
|
|
28
28
|
barGap: '-100%', // In most case, overlap is needed.
|
|
@@ -183,12 +183,28 @@ define(function (require) {
|
|
|
183
183
|
var symbolBoundingData = itemModel.get('symbolBoundingData');
|
|
184
184
|
var valueAxis = opt.coordSys.getOtherAxis(opt.coordSys.getBaseAxis());
|
|
185
185
|
var zeroPx = valueAxis.toGlobalCoord(valueAxis.dataToCoord(0));
|
|
186
|
+
var pxSignIdx = 1 - +(layout[valueDim.wh] <= 0);
|
|
187
|
+
var boundingLength;
|
|
186
188
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
189
|
+
if (zrUtil.isArray(symbolBoundingData)) {
|
|
190
|
+
var symbolBoundingExtent = [
|
|
191
|
+
convertToCoordOnAxis(valueAxis, symbolBoundingData[0]) - zeroPx,
|
|
192
|
+
convertToCoordOnAxis(valueAxis, symbolBoundingData[1]) - zeroPx
|
|
193
|
+
];
|
|
194
|
+
symbolBoundingExtent[1] < symbolBoundingExtent[0] && (symbolBoundingExtent.reverse());
|
|
195
|
+
boundingLength = symbolBoundingExtent[pxSignIdx];
|
|
196
|
+
}
|
|
197
|
+
else if (symbolBoundingData != null) {
|
|
198
|
+
boundingLength = convertToCoordOnAxis(valueAxis, symbolBoundingData) - zeroPx;
|
|
199
|
+
}
|
|
200
|
+
else if (symbolRepeat) {
|
|
201
|
+
boundingLength = opt.coordSysExtent[valueDim.index][pxSignIdx] - zeroPx;
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
boundingLength = layout[valueDim.wh];
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
output.boundingLength = boundingLength;
|
|
192
208
|
|
|
193
209
|
if (symbolRepeat) {
|
|
194
210
|
output.repeatCutLength = layout[valueDim.wh];
|
|
@@ -197,6 +213,10 @@ define(function (require) {
|
|
|
197
213
|
output.pxSign = boundingLength > 0 ? 1 : boundingLength < 0 ? -1 : 0;
|
|
198
214
|
}
|
|
199
215
|
|
|
216
|
+
function convertToCoordOnAxis(axis, value) {
|
|
217
|
+
return axis.toGlobalCoord(axis.dataToCoord(axis.scale.parse(value)));
|
|
218
|
+
}
|
|
219
|
+
|
|
200
220
|
// Support ['100%', '100%']
|
|
201
221
|
function prepareSymbolSize(
|
|
202
222
|
data, dataIndex, layout, symbolRepeat, symbolClip, boundingLength,
|
|
@@ -405,7 +425,7 @@ define(function (require) {
|
|
|
405
425
|
path.__pictorialRepeatTimes = repeatTimes;
|
|
406
426
|
bundle.add(path);
|
|
407
427
|
|
|
408
|
-
var target = makeTarget(index
|
|
428
|
+
var target = makeTarget(index);
|
|
409
429
|
|
|
410
430
|
updateAttr(
|
|
411
431
|
path,
|
|
@@ -654,7 +674,7 @@ define(function (require) {
|
|
|
654
674
|
function removeBar(data, dataIndex, animationModel, bar) {
|
|
655
675
|
// Not show text when animating
|
|
656
676
|
var labelRect = bar.__pictorialBarRect;
|
|
657
|
-
labelRect && (labelRect.style.text =
|
|
677
|
+
labelRect && (labelRect.style.text = null);
|
|
658
678
|
|
|
659
679
|
var pathes = [];
|
|
660
680
|
eachPath(bar, function (path) {
|
|
@@ -713,6 +733,7 @@ define(function (require) {
|
|
|
713
733
|
// Because symbol provide setColor individually to set fill and stroke
|
|
714
734
|
var normalStyle = itemModel.getModel('itemStyle.normal').getItemStyle(['color']);
|
|
715
735
|
var hoverStyle = itemModel.getModel('itemStyle.emphasis').getItemStyle();
|
|
736
|
+
var cursorStyle = itemModel.getShallow('cursor');
|
|
716
737
|
|
|
717
738
|
eachPath(bar, function (path) {
|
|
718
739
|
// PENDING setColor should be before setStyle!!!
|
|
@@ -726,6 +747,7 @@ define(function (require) {
|
|
|
726
747
|
));
|
|
727
748
|
graphic.setHoverStyle(path, hoverStyle);
|
|
728
749
|
|
|
750
|
+
cursorStyle && (path.cursor = cursorStyle);
|
|
729
751
|
path.z2 = symbolMeta.z2;
|
|
730
752
|
});
|
|
731
753
|
|
package/src/chart/bar/helper.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
define(function (require) {
|
|
2
2
|
|
|
3
|
-
var zrUtil = require('zrender/core/util');
|
|
4
3
|
var graphic = require('../../util/graphic');
|
|
5
4
|
|
|
6
5
|
var helper = {};
|
|
@@ -11,38 +10,22 @@ define(function (require) {
|
|
|
11
10
|
var labelModel = itemModel.getModel('label.normal');
|
|
12
11
|
var hoverLabelModel = itemModel.getModel('label.emphasis');
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
else {
|
|
25
|
-
normalStyle.text = '';
|
|
26
|
-
}
|
|
13
|
+
graphic.setLabelStyle(
|
|
14
|
+
normalStyle, hoverStyle, labelModel, hoverLabelModel,
|
|
15
|
+
{
|
|
16
|
+
labelFetcher: seriesModel,
|
|
17
|
+
labelDataIndex: dataIndex,
|
|
18
|
+
defaultText: seriesModel.getRawValue(dataIndex),
|
|
19
|
+
isRectText: true,
|
|
20
|
+
autoColor: color
|
|
21
|
+
}
|
|
22
|
+
);
|
|
27
23
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
hoverStyle, hoverLabelModel, color,
|
|
31
|
-
zrUtil.retrieve(
|
|
32
|
-
seriesModel.getFormattedLabel(dataIndex, 'emphasis'),
|
|
33
|
-
seriesModel.getRawValue(dataIndex)
|
|
34
|
-
),
|
|
35
|
-
labelPositionOutside
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
hoverStyle.text = '';
|
|
40
|
-
}
|
|
24
|
+
fixPosition(normalStyle);
|
|
25
|
+
fixPosition(hoverStyle);
|
|
41
26
|
};
|
|
42
27
|
|
|
43
|
-
function
|
|
44
|
-
graphic.setText(style, model, color);
|
|
45
|
-
style.text = labelText;
|
|
28
|
+
function fixPosition(style, labelPositionOutside) {
|
|
46
29
|
if (style.textPosition === 'outside') {
|
|
47
30
|
style.textPosition = labelPositionOutside;
|
|
48
31
|
}
|
|
@@ -3,6 +3,7 @@ define(function (require) {
|
|
|
3
3
|
var zrUtil = require('zrender/core/util');
|
|
4
4
|
var retrieve = require('zrender/core/util').retrieve;
|
|
5
5
|
var parsePercent = require('../../util/number').parsePercent;
|
|
6
|
+
var graphic = require('../../util/graphic');
|
|
6
7
|
|
|
7
8
|
return function (ecModel) {
|
|
8
9
|
|
|
@@ -33,6 +34,8 @@ define(function (require) {
|
|
|
33
34
|
return;
|
|
34
35
|
}
|
|
35
36
|
|
|
37
|
+
var dataIndex = 0;
|
|
38
|
+
|
|
36
39
|
data.each([cDim].concat(vDims), function () {
|
|
37
40
|
var args = arguments;
|
|
38
41
|
var axisDimVal = args[0];
|
|
@@ -52,17 +55,44 @@ define(function (require) {
|
|
|
52
55
|
var highestPoint = getPoint(highestVal);
|
|
53
56
|
|
|
54
57
|
var whiskerEnds = [
|
|
55
|
-
[
|
|
56
|
-
|
|
58
|
+
[
|
|
59
|
+
subPixelOptimizePoint(highestPoint),
|
|
60
|
+
subPixelOptimizePoint(ocHighPoint)
|
|
61
|
+
],
|
|
62
|
+
[
|
|
63
|
+
subPixelOptimizePoint(lowestPoint),
|
|
64
|
+
subPixelOptimizePoint(ocLowPoint)
|
|
65
|
+
]
|
|
57
66
|
];
|
|
58
67
|
|
|
59
68
|
var bodyEnds = [];
|
|
60
69
|
addBodyEnd(ocHighPoint, 0);
|
|
61
70
|
addBodyEnd(ocLowPoint, 1);
|
|
62
71
|
|
|
72
|
+
var sign;
|
|
73
|
+
if (openVal > closeVal) {
|
|
74
|
+
sign = -1;
|
|
75
|
+
}
|
|
76
|
+
else if (openVal < closeVal) {
|
|
77
|
+
sign = 1;
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
// If close === open, compare with close of last record
|
|
81
|
+
if (dataIndex > 0) {
|
|
82
|
+
sign = data.getItemModel(dataIndex - 1).get()[2]
|
|
83
|
+
<= closeVal
|
|
84
|
+
? 1
|
|
85
|
+
: -1;
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
// No record of previous, set to be positive
|
|
89
|
+
sign = 1;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
63
93
|
data.setItemLayout(idx, {
|
|
64
94
|
chartLayout: chartLayout,
|
|
65
|
-
sign:
|
|
95
|
+
sign: sign,
|
|
66
96
|
initBaseline: openVal > closeVal
|
|
67
97
|
? ocHighPoint[constDim] : ocLowPoint[constDim], // open point.
|
|
68
98
|
bodyEnds: bodyEnds,
|
|
@@ -70,6 +100,8 @@ define(function (require) {
|
|
|
70
100
|
brushRect: makeBrushRect()
|
|
71
101
|
});
|
|
72
102
|
|
|
103
|
+
++dataIndex;
|
|
104
|
+
|
|
73
105
|
function getPoint(val) {
|
|
74
106
|
var p = [];
|
|
75
107
|
p[variableDim] = axisDimVal;
|
|
@@ -82,8 +114,14 @@ define(function (require) {
|
|
|
82
114
|
function addBodyEnd(point, start) {
|
|
83
115
|
var point1 = point.slice();
|
|
84
116
|
var point2 = point.slice();
|
|
85
|
-
|
|
86
|
-
|
|
117
|
+
|
|
118
|
+
point1[variableDim] = graphic.subPixelOptimize(
|
|
119
|
+
point1[variableDim] + candleWidth / 2, 1, false
|
|
120
|
+
);
|
|
121
|
+
point2[variableDim] = graphic.subPixelOptimize(
|
|
122
|
+
point2[variableDim] - candleWidth / 2, 1, true
|
|
123
|
+
);
|
|
124
|
+
|
|
87
125
|
start
|
|
88
126
|
? bodyEnds.push(point1, point2)
|
|
89
127
|
: bodyEnds.push(point2, point1);
|
|
@@ -104,6 +142,11 @@ define(function (require) {
|
|
|
104
142
|
};
|
|
105
143
|
}
|
|
106
144
|
|
|
145
|
+
function subPixelOptimizePoint(point) {
|
|
146
|
+
point[variableDim] = graphic.subPixelOptimize(point[variableDim], 1);
|
|
147
|
+
return point;
|
|
148
|
+
}
|
|
149
|
+
|
|
107
150
|
}, true);
|
|
108
151
|
});
|
|
109
152
|
};
|
|
@@ -132,6 +175,6 @@ define(function (require) {
|
|
|
132
175
|
? parsePercent(barWidth, bandWidth)
|
|
133
176
|
// Put max outer to ensure bar visible in spite of overlap.
|
|
134
177
|
: Math.max(Math.min(bandWidth / 2, barMaxWidth), barMinWidth);
|
|
135
|
-
|
|
178
|
+
}
|
|
136
179
|
|
|
137
180
|
});
|