echarts-rails 0.1.6 → 0.1.7
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.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/vendor/assets/javascripts/echarts.common.js +28373 -21589
- data/vendor/assets/javascripts/echarts.js +50061 -38441
- data/vendor/assets/javascripts/echarts.simple.js +19627 -15330
- data/vendor/assets/javascripts/extension/bmap.js +73 -12
- data/vendor/assets/javascripts/extension/bmap.min.js +1 -1
- data/vendor/assets/javascripts/extension/dataTool.js +10 -10
- metadata +3 -3
@@ -52,7 +52,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
52
52
|
/************************************************************************/
|
53
53
|
/******/ ([
|
54
54
|
/* 0 */
|
55
|
-
/***/ function(module, exports, __webpack_require__) {
|
55
|
+
/***/ (function(module, exports, __webpack_require__) {
|
56
56
|
|
57
57
|
var __WEBPACK_AMD_DEFINE_RESULT__;/**
|
58
58
|
* BMap component extension
|
@@ -83,19 +83,20 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
83
83
|
};
|
84
84
|
}.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
85
85
|
|
86
|
-
/***/ },
|
86
|
+
/***/ }),
|
87
87
|
/* 1 */
|
88
|
-
/***/ function(module, exports) {
|
88
|
+
/***/ (function(module, exports) {
|
89
89
|
|
90
90
|
module.exports = __WEBPACK_EXTERNAL_MODULE_1__;
|
91
91
|
|
92
|
-
/***/ },
|
92
|
+
/***/ }),
|
93
93
|
/* 2 */
|
94
|
-
/***/ function(module, exports, __webpack_require__) {
|
94
|
+
/***/ (function(module, exports, __webpack_require__) {
|
95
95
|
|
96
96
|
var __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_RESULT__ = function (require) {
|
97
97
|
|
98
98
|
var echarts = __webpack_require__(1);
|
99
|
+
var zrUtil = echarts.util;
|
99
100
|
|
100
101
|
function BMapCoordSys(bmap, api) {
|
101
102
|
this._bmap = bmap;
|
@@ -103,10 +104,20 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
103
104
|
this._mapOffset = [0, 0];
|
104
105
|
|
105
106
|
this._api = api;
|
107
|
+
|
108
|
+
this._projection = new BMap.MercatorProjection();
|
106
109
|
}
|
107
110
|
|
108
111
|
BMapCoordSys.prototype.dimensions = ['lng', 'lat'];
|
109
112
|
|
113
|
+
BMapCoordSys.prototype.setZoom = function (zoom) {
|
114
|
+
this._zoom = zoom;
|
115
|
+
};
|
116
|
+
|
117
|
+
BMapCoordSys.prototype.setCenter = function (center) {
|
118
|
+
this._center = this._projection.lngLatToPoint(new BMap.Point(center[0], center[1]));
|
119
|
+
};
|
120
|
+
|
110
121
|
BMapCoordSys.prototype.setMapOffset = function (mapOffset) {
|
111
122
|
this._mapOffset = mapOffset;
|
112
123
|
};
|
@@ -117,7 +128,16 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
117
128
|
|
118
129
|
BMapCoordSys.prototype.dataToPoint = function (data) {
|
119
130
|
var point = new BMap.Point(data[0], data[1]);
|
120
|
-
// TODO
|
131
|
+
// TODO mercator projection is toooooooo slow
|
132
|
+
// var mercatorPoint = this._projection.lngLatToPoint(point);
|
133
|
+
|
134
|
+
// var width = this._api.getZr().getWidth();
|
135
|
+
// var height = this._api.getZr().getHeight();
|
136
|
+
// var divider = Math.pow(2, 18 - 10);
|
137
|
+
// return [
|
138
|
+
// Math.round((mercatorPoint.x - this._center.x) / divider + width / 2),
|
139
|
+
// Math.round((this._center.y - mercatorPoint.y) / divider + height / 2)
|
140
|
+
// ];
|
121
141
|
var px = this._bmap.pointToOverlayPixel(point);
|
122
142
|
var mapOffset = this._mapOffset;
|
123
143
|
return [px.x - mapOffset[0], px.y - mapOffset[1]];
|
@@ -141,6 +161,38 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
141
161
|
return echarts.matrix.create();
|
142
162
|
};
|
143
163
|
|
164
|
+
BMapCoordSys.prototype.prepareCustoms = function (data) {
|
165
|
+
var rect = this.getViewRect();
|
166
|
+
return {
|
167
|
+
coordSys: {
|
168
|
+
// The name exposed to user is always 'cartesian2d' but not 'grid'.
|
169
|
+
type: 'bmap',
|
170
|
+
x: rect.x,
|
171
|
+
y: rect.y,
|
172
|
+
width: rect.width,
|
173
|
+
height: rect.height
|
174
|
+
},
|
175
|
+
api: {
|
176
|
+
coord: zrUtil.bind(this.dataToPoint, this),
|
177
|
+
size: zrUtil.bind(dataToCoordSize, this)
|
178
|
+
}
|
179
|
+
};
|
180
|
+
};
|
181
|
+
|
182
|
+
function dataToCoordSize(dataSize, dataItem) {
|
183
|
+
dataItem = dataItem || [0, 0];
|
184
|
+
return zrUtil.map([0, 1], function (dimIdx) {
|
185
|
+
var val = dataItem[dimIdx];
|
186
|
+
var halfSize = dataSize[dimIdx] / 2;
|
187
|
+
var p1 = [];
|
188
|
+
var p2 = [];
|
189
|
+
p1[dimIdx] = val - halfSize;
|
190
|
+
p2[dimIdx] = val + halfSize;
|
191
|
+
p1[1 - dimIdx] = p2[1 - dimIdx] = dataItem[1 - dimIdx];
|
192
|
+
return Math.abs(this.dataToPoint(p1)[dimIdx] - this.dataToPoint(p2)[dimIdx]);
|
193
|
+
}, this);
|
194
|
+
}
|
195
|
+
|
144
196
|
var Overlay;
|
145
197
|
|
146
198
|
// For deciding which dimensions to use when creating list data
|
@@ -176,7 +228,8 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
176
228
|
|
177
229
|
// TODO Dispose
|
178
230
|
ecModel.eachComponent('bmap', function (bmapModel) {
|
179
|
-
var
|
231
|
+
var painter = api.getZr().painter;
|
232
|
+
var viewportRoot = painter.getViewportRoot();
|
180
233
|
if (typeof BMap === 'undefined') {
|
181
234
|
throw new Error('BMap api is not loaded');
|
182
235
|
}
|
@@ -203,6 +256,11 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
203
256
|
|
204
257
|
var overlay = new Overlay(viewportRoot);
|
205
258
|
bmap.addOverlay(overlay);
|
259
|
+
|
260
|
+
// Override
|
261
|
+
painter.getViewportRootOffset = function () {
|
262
|
+
return {offsetLeft: 0, offsetTop: 0};
|
263
|
+
};
|
206
264
|
}
|
207
265
|
var bmap = bmapModel.__bmap;
|
208
266
|
|
@@ -217,6 +275,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
217
275
|
|
218
276
|
bmapCoordSys = new BMapCoordSys(bmap, api);
|
219
277
|
bmapCoordSys.setMapOffset(bmapModel.__mapOffset || [0, 0]);
|
278
|
+
bmapCoordSys.setZoom(zoom);
|
279
|
+
bmapCoordSys.setCenter(center);
|
280
|
+
|
220
281
|
bmapModel.coordinateSystem = bmapCoordSys;
|
221
282
|
});
|
222
283
|
|
@@ -230,9 +291,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
230
291
|
return BMapCoordSys;
|
231
292
|
}.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
232
293
|
|
233
|
-
/***/ },
|
294
|
+
/***/ }),
|
234
295
|
/* 3 */
|
235
|
-
/***/ function(module, exports, __webpack_require__) {
|
296
|
+
/***/ (function(module, exports, __webpack_require__) {
|
236
297
|
|
237
298
|
var __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_RESULT__ = function (require) {
|
238
299
|
|
@@ -271,9 +332,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
271
332
|
});
|
272
333
|
}.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
273
334
|
|
274
|
-
/***/ },
|
335
|
+
/***/ }),
|
275
336
|
/* 4 */
|
276
|
-
/***/ function(module, exports, __webpack_require__) {
|
337
|
+
/***/ (function(module, exports, __webpack_require__) {
|
277
338
|
|
278
339
|
var __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_RESULT__ = function (require) {
|
279
340
|
|
@@ -363,7 +424,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
363
424
|
});
|
364
425
|
}.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
365
426
|
|
366
|
-
/***/ }
|
427
|
+
/***/ })
|
367
428
|
/******/ ])
|
368
429
|
});
|
369
430
|
;
|
@@ -1 +1 @@
|
|
1
|
-
!function(e
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("echarts")):"function"==typeof define&&define.amd?define(["echarts"],e):"object"==typeof exports?exports.bmap=e(require("echarts")):(t.echarts=t.echarts||{},t.echarts.bmap=e(t.echarts))}(this,function(t){return function(t){function e(n){if(o[n])return o[n].exports;var r=o[n]={exports:{},id:n,loaded:!1};return t[n].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var o={};return e.m=t,e.c=o,e.p="",e(0)}([function(t,e,o){var n;n=function(t){return o(1).registerCoordinateSystem("bmap",o(2)),o(3),o(4),o(1).registerAction({type:"bmapRoam",event:"bmapRoam",update:"updateLayout"},function(t,e){e.eachComponent("bmap",function(t){var e=t.getBMap(),o=e.getCenter();t.setCenterAndZoom([o.lng,o.lat],e.getZoom())})}),{version:"1.0.0"}}.call(e,o,e,t),!(void 0!==n&&(t.exports=n))},function(e,o){e.exports=t},function(t,e,o){var n;n=function(t){function e(t,e){this._bmap=t,this.dimensions=["lng","lat"],this._mapOffset=[0,0],this._api=e,this._projection=new BMap.MercatorProjection}function n(t,e){return e=e||[0,0],a.map([0,1],function(o){var n=e[o],r=t[o]/2,i=[],a=[];return i[o]=n-r,a[o]=n+r,i[1-o]=a[1-o]=e[1-o],Math.abs(this.dataToPoint(i)[o]-this.dataToPoint(a)[o])},this)}function r(){function t(t){this._root=t}return t.prototype=new BMap.Overlay,t.prototype.initialize=function(t){return t.getPanes().labelPane.appendChild(this._root),this._root},t.prototype.draw=function(){},t}var i=o(1),a=i.util;e.prototype.dimensions=["lng","lat"],e.prototype.setZoom=function(t){this._zoom=t},e.prototype.setCenter=function(t){this._center=this._projection.lngLatToPoint(new BMap.Point(t[0],t[1]))},e.prototype.setMapOffset=function(t){this._mapOffset=t},e.prototype.getBMap=function(){return this._bmap},e.prototype.dataToPoint=function(t){var e=new BMap.Point(t[0],t[1]),o=this._bmap.pointToOverlayPixel(e),n=this._mapOffset;return[o.x-n[0],o.y-n[1]]},e.prototype.pointToData=function(t){var e=this._mapOffset,t=this._bmap.overlayPixelToPoint({x:t[0]+e[0],y:t[1]+e[1]});return[t.lng,t.lat]},e.prototype.getViewRect=function(){var t=this._api;return new i.graphic.BoundingRect(0,0,t.getWidth(),t.getHeight())},e.prototype.getRoamTransform=function(){return i.matrix.create()},e.prototype.prepareCustoms=function(t){var e=this.getViewRect();return{coordSys:{type:"bmap",x:e.x,y:e.y,width:e.width,height:e.height},api:{coord:a.bind(this.dataToPoint,this),size:a.bind(n,this)}}};var p;return e.dimensions=e.prototype.dimensions,e.create=function(t,o){var n,i=o.getDom();t.eachComponent("bmap",function(t){var a=o.getZr().painter,s=a.getViewportRoot();if("undefined"==typeof BMap)throw new Error("BMap api is not loaded");if(p=p||r(),n)throw new Error("Only one bmap component can exist");if(!t.__bmap){var c=i.querySelector(".ec-extension-bmap");c&&(s.style.left="0px",s.style.top="0px",i.removeChild(c)),c=document.createElement("div"),c.style.cssText="width:100%;height:100%",c.classList.add("ec-extension-bmap"),i.appendChild(c);var m=t.__bmap=new BMap.Map(c),f=new p(s);m.addOverlay(f),a.getViewportRootOffset=function(){return{offsetLeft:0,offsetTop:0}}}var m=t.__bmap,d=t.get("center"),l=t.get("zoom");if(d&&l){var u=new BMap.Point(d[0],d[1]);m.centerAndZoom(u,l)}n=new e(m,o),n.setMapOffset(t.__mapOffset||[0,0]),n.setZoom(l),n.setCenter(d),t.coordinateSystem=n}),t.eachSeries(function(t){"bmap"===t.get("coordinateSystem")&&(t.coordinateSystem=n)})},e}.call(e,o,e,t),!(void 0!==n&&(t.exports=n))},function(t,e,o){var n;n=function(t){function e(t,e){return t&&e&&t[0]===e[0]&&t[1]===e[1]}return o(1).extendComponentModel({type:"bmap",getBMap:function(){return this.__bmap},setCenterAndZoom:function(t,e){this.option.center=t,this.option.zoom=e},centerOrZoomChanged:function(t,o){var n=this.option;return!(e(t,n.center)&&o===n.zoom)},defaultOption:{center:[104.114129,37.550339],zoom:5,mapStyle:{},roam:!1}})}.call(e,o,e,t),!(void 0!==n&&(t.exports=n))},function(t,e,o){var n;n=function(t){return o(1).extendComponentView({type:"bmap",render:function(t,e,o){function n(){r||o.dispatchAction({type:"bmapRoam"})}var r=!0,i=t.getBMap(),a=o.getZr().painter.getViewportRoot(),p=t.coordinateSystem,s=function(e,n){if(!r){var i=a.parentNode.parentNode.parentNode,s=[-parseInt(i.style.left,10)||0,-parseInt(i.style.top,10)||0];a.style.left=s[0]+"px",a.style.top=s[1]+"px",p.setMapOffset(s),t.__mapOffset=s,o.dispatchAction({type:"bmapRoam"})}};i.removeEventListener("moving",this._oldMoveHandler),i.removeEventListener("zoomend",this._oldZoomEndHandler),i.addEventListener("moving",s),i.addEventListener("zoomend",n),this._oldMoveHandler=s,this._oldZoomEndHandler=n;var c=t.get("roam");c&&"scale"!==c?i.enableDragging():i.disableDragging(),c&&"move"!==c?(i.enableScrollWheelZoom(),i.enableDoubleClickZoom(),i.enablePinchToZoom()):(i.disableScrollWheelZoom(),i.disableDoubleClickZoom(),i.disablePinchToZoom());var m=t.__mapStyle,f=t.get("mapStyle")||{},d=JSON.stringify(f);JSON.stringify(m)!==d&&(Object.keys(f).length&&i.setMapStyle(f),t.__mapStyle=JSON.parse(d)),r=!1}})}.call(e,o,e,t),!(void 0!==n&&(t.exports=n))}])});
|
@@ -52,7 +52,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
52
52
|
/************************************************************************/
|
53
53
|
/******/ ([
|
54
54
|
/* 0 */
|
55
|
-
/***/ function(module, exports, __webpack_require__) {
|
55
|
+
/***/ (function(module, exports, __webpack_require__) {
|
56
56
|
|
57
57
|
var __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_RESULT__ = function (require) {
|
58
58
|
var echarts = __webpack_require__(1);
|
@@ -64,18 +64,18 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
64
64
|
return echarts.dataTool;
|
65
65
|
}.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
66
66
|
|
67
|
-
/***/ },
|
67
|
+
/***/ }),
|
68
68
|
/* 1 */
|
69
|
-
/***/ function(module, exports) {
|
69
|
+
/***/ (function(module, exports) {
|
70
70
|
|
71
71
|
module.exports = __WEBPACK_EXTERNAL_MODULE_1__;
|
72
72
|
|
73
|
-
/***/ },
|
73
|
+
/***/ }),
|
74
74
|
/* 2 */,
|
75
75
|
/* 3 */,
|
76
76
|
/* 4 */,
|
77
77
|
/* 5 */
|
78
|
-
/***/ function(module, exports, __webpack_require__) {
|
78
|
+
/***/ (function(module, exports, __webpack_require__) {
|
79
79
|
|
80
80
|
var __WEBPACK_AMD_DEFINE_RESULT__;// GEXF File Parser
|
81
81
|
// http://gexf.net/1.2draft/gexf-12draft-primer.pdf
|
@@ -282,9 +282,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
282
282
|
};
|
283
283
|
}.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
284
284
|
|
285
|
-
/***/ },
|
285
|
+
/***/ }),
|
286
286
|
/* 6 */
|
287
|
-
/***/ function(module, exports, __webpack_require__) {
|
287
|
+
/***/ (function(module, exports, __webpack_require__) {
|
288
288
|
|
289
289
|
var __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_RESULT__ = function (require) {
|
290
290
|
|
@@ -350,9 +350,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
350
350
|
|
351
351
|
}.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
352
352
|
|
353
|
-
/***/ },
|
353
|
+
/***/ }),
|
354
354
|
/* 7 */
|
355
|
-
/***/ function(module, exports, __webpack_require__) {
|
355
|
+
/***/ (function(module, exports, __webpack_require__) {
|
356
356
|
|
357
357
|
var __WEBPACK_AMD_DEFINE_RESULT__;/**
|
358
358
|
* Copyright (c) 2010-2015, Michael Bostock
|
@@ -399,7 +399,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
399
399
|
|
400
400
|
}.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
401
401
|
|
402
|
-
/***/ }
|
402
|
+
/***/ })
|
403
403
|
/******/ ])
|
404
404
|
});
|
405
405
|
;
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: echarts-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Echo Han
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
106
|
version: '0'
|
107
107
|
requirements: []
|
108
108
|
rubyforge_project:
|
109
|
-
rubygems_version: 2.6.
|
109
|
+
rubygems_version: 2.6.12
|
110
110
|
signing_key:
|
111
111
|
specification_version: 4
|
112
112
|
summary: Wrappers of Echarts Javascript Chart Libary for Rails 3.1+
|