diff --git a/extension-src/bmap/BMapCoordSys.ts b/extension-src/bmap/BMapCoordSys.ts index 79ec79f0f2..96f24de386 100644 --- a/extension-src/bmap/BMapCoordSys.ts +++ b/extension-src/bmap/BMapCoordSys.ts @@ -36,6 +36,8 @@ function BMapCoordSys(bmap, api) { this._projection = new BMap.MercatorProjection(); } +BMapCoordSys.prototype.type = 'bmap'; + BMapCoordSys.prototype.dimensions = ['lng', 'lat']; BMapCoordSys.prototype.setZoom = function (zoom) { @@ -107,6 +109,15 @@ BMapCoordSys.prototype.prepareCustoms = function () { }; }; +BMapCoordSys.prototype.convertToPixel = function (ecModel, finder, value) { + // here we ignore finder as only one bmap component is allowed + return this.dataToPoint(value); +}; + +BMapCoordSys.prototype.convertFromPixel = function (ecModel, finder, value) { + return this.pointToData(value); +}; + function dataToCoordSize(dataSize, dataItem) { dataItem = dataItem || [0, 0]; return zrUtil.map([0, 1], function (dimIdx) { @@ -229,6 +240,9 @@ BMapCoordSys.create = function (ecModel, api) { seriesModel.coordinateSystem = bmapCoordSys; } }); + + // return created coordinate systems + return bmapCoordSys && [bmapCoordSys]; }; export default BMapCoordSys; diff --git a/src/chart/pie/pieLayout.ts b/src/chart/pie/pieLayout.ts index 0598a779aa..0a6998c70c 100644 --- a/src/chart/pie/pieLayout.ts +++ b/src/chart/pie/pieLayout.ts @@ -53,10 +53,23 @@ export function getBasicPieLayout(seriesModel: PieSeriesModel, api: ExtensionAPI const width = parsePercent(viewRect.width, api.getWidth()); const height = parsePercent(viewRect.height, api.getHeight()); const size = Math.min(width, height); - const cx = parsePercent(center[0], width) + viewRect.x; - const cy = parsePercent(center[1], height) + viewRect.y; const r0 = parsePercent(radius[0], size / 2); const r = parsePercent(radius[1], size / 2); + + let cx: number; + let cy: number; + const coordSys = seriesModel.coordinateSystem; + if (coordSys) { + // percentage is not allowed when coordinate system is specified + const point = coordSys.dataToPoint(center); + cx = point[0] || 0; + cy = point[1] || 0; + } + else { + cx = parsePercent(center[0], width) + viewRect.x; + cy = parsePercent(center[1], height) + viewRect.y; + } + return { cx, cy, diff --git a/test/pie-coordinate-system.html b/test/pie-coordinate-system.html new file mode 100644 index 0000000000..ad0703eddf --- /dev/null +++ b/test/pie-coordinate-system.html @@ -0,0 +1,381 @@ + + + + + + + + + + + + + + + +
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + +