From a53bbc304025ee07fbeda3617e902a0b0283cac0 Mon Sep 17 00:00:00 2001 From: pah100 Date: Fri, 30 Jun 2017 20:26:34 +0800 Subject: [PATCH] support no coordinate system. --- src/chart/custom.js | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/chart/custom.js b/src/chart/custom.js index ec7723e1ad..8bcc79e2a3 100644 --- a/src/chart/custom.js +++ b/src/chart/custom.js @@ -42,7 +42,7 @@ define(function (require) { dependencies: ['grid', 'polar', 'geo', 'singleAxis', 'calendar'], defaultOption: { - coordinateSystem: 'cartesian2d', + coordinateSystem: 'cartesian2d', // Can be set as 'none' zlevel: 0, z: 2, legendHoverLink: true @@ -222,18 +222,21 @@ define(function (require) { function makeRenderItem(customSeries, data, ecModel, api) { var renderItem = customSeries.get('renderItem'); var coordSys = customSeries.coordinateSystem; + var prepareResult = {}; - if (__DEV__) { - zrUtil.assert(renderItem, 'series.render is required.'); - zrUtil.assert( - coordSys.prepareCustoms || prepareCustoms[coordSys.type], - 'This coordSys does not support custom series.' - ); - } + if (coordSys) { + if (__DEV__) { + zrUtil.assert(renderItem, 'series.render is required.'); + zrUtil.assert( + coordSys.prepareCustoms || prepareCustoms[coordSys.type], + 'This coordSys does not support custom series.' + ); + } - var prepareResult = coordSys.prepareCustoms - ? coordSys.prepareCustoms() - : prepareCustoms[coordSys.type](coordSys); + prepareResult = coordSys.prepareCustoms + ? coordSys.prepareCustoms() + : prepareCustoms[coordSys.type](coordSys); + } var userAPI = zrUtil.defaults({ getWidth: api.getWidth, @@ -247,7 +250,7 @@ define(function (require) { barLayout: barLayout, currentSeriesIndices: currentSeriesIndices, font: font - }, prepareResult.api); + }, prepareResult.api || {}); var userParams = { context: {},