提交 cdd0c0d2 编写于 作者: L lang

Enable define to remove the error checking code in production build

上级 cc58593a
......@@ -90,12 +90,15 @@ define(function (require) {
var yAxis = cartesian.getAxis('y');
var group = this.group;
if (!(xAxis.type === 'category' && yAxis.type === 'category')) {
throw new Error('Heatmap on cartesian must have two category axes');
}
if (!(xAxis.onBand && yAxis.onBand)) {
throw new Error('Heatmap on cartesian must have two axes with boundaryGap true');
if (typeof __DEV__ !== 'undefined') {
if (!(xAxis.type === 'category' && yAxis.type === 'category')) {
throw new Error('Heatmap on cartesian must have two category axes');
}
if (!(xAxis.onBand && yAxis.onBand)) {
throw new Error('Heatmap on cartesian must have two axes with boundaryGap true');
}
}
var width = xAxis.getBandWidth();
var height = yAxis.getBandWidth();
......
......@@ -399,12 +399,17 @@ define(function(require, factory) {
return;
}
var xAxisIndex = seriesModel.get('xAxisIndex');
// TODO Validate
var yAxisIndex = seriesModel.get('yAxisIndex');
var xAxisModel = ecModel.getComponent('xAxis', xAxisIndex);
if (typeof __DEV__ !== 'undefined') {
var yAxisModel = ecModel.getComponent('yAxis', yAxisIndex);
if (xAxisModel.get('gridIndex') !== yAxisModel.get('gridIndex')) {
throw new Error('xAxis and yAxis must use the same grid');
}
}
var grid = grids[xAxisModel.get('gridIndex')];
seriesModel.coordinateSystem = grid.getCartesian(
xAxisIndex, seriesModel.get('yAxisIndex')
);
seriesModel.coordinateSystem = grid.getCartesian(xAxisIndex, yAxisIndex);
});
return grids;
......
......@@ -41,8 +41,7 @@
trigger: 'axis',
axisPointer: {
type: 'cross'
},
zlevel: 1
}
},
xAxis: {
type: 'value',
......@@ -70,8 +69,7 @@
series: [{
name: 'scatter',
type: 'scatter',
symbolSize: function (val, param) {
return json[0].marker.size[param.dataIndex] / json[0].marker.sizeref;
symbolSize: function (val, param) {json[0].marker.size[param.dataIndex] / json[0].marker.sizeref;
},
itemStyle: {
normal: {
......
var PROD = process.argv.indexOf('-p') >= 0;
var webpack = require('webpack');
module.exports = {
plugins: [
new webpack.DefinePlugin({
'typeof __DEV__': JSON.stringify(PROD ? 'undefined' : 'boolean')
})
],
entry: {
'echarts': __dirname + '/index.js',
'echarts.simple': __dirname + '/index.simple.js',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册