@antv/g2
Advanced tools
Comparing version 3.0.0-rc5.12 to 3.0.0-rc5.13
{ | ||
"name": "@antv/g2", | ||
"version": "3.0.0-rc5.12", | ||
"version": "3.0.0-rc5.13", | ||
"description": "the Grammar of Graphics in Javascript", | ||
@@ -5,0 +5,0 @@ "main": "build/g2.js", |
@@ -345,7 +345,19 @@ const Util = require('../../util'); | ||
if (geom.getAttr('color')) { // 存在颜色映射 | ||
cfg.color = geom.getAttr('color').mapping(value).join(''); | ||
const colorAttr = geom.getAttr('color'); | ||
const shapeAttr = geom.getAttr('shape'); | ||
if (colorAttr) { // 存在颜色映射 | ||
if (colorAttr.callback && colorAttr.callback.length > 1) { // 多参数映射,阻止程序报错 | ||
const restArgs = Array(colorAttr.callback.length - 1).fill(''); | ||
cfg.color = colorAttr.mapping(value, ...restArgs).join('') || Global.defaultColor; | ||
} else { | ||
cfg.color = colorAttr.mapping(value).join('') || Global.defaultColor; | ||
} | ||
} | ||
if (isByAttr && geom.getAttr('shape')) { // 存在形状映射 | ||
shape = geom.getAttr('shape').mapping(value).join(''); | ||
if (isByAttr && shapeAttr) { // 存在形状映射 | ||
if (shapeAttr.callback && shapeAttr.callback.length > 1) { // 多参数映射,阻止程序报错 | ||
const restArgs = Array(shapeAttr.callback.length - 1).fill(''); | ||
shape = shapeAttr.mapping(value, ...restArgs).join(''); | ||
} else { | ||
shape = shapeAttr.mapping(value).join(''); | ||
} | ||
} | ||
@@ -352,0 +364,0 @@ |
@@ -15,3 +15,3 @@ /** | ||
/** | ||
* Ψһ��ʶ�����ڶ��� | ||
* 用于动画,唯一标识的 id | ||
* @type {[type]} | ||
@@ -22,3 +22,3 @@ */ | ||
/** | ||
* �������ϵ������ | ||
* 坐标轴上的坐标点 | ||
* @type {Array} | ||
@@ -28,3 +28,3 @@ */ | ||
/** | ||
* �������ߵ�ͼ���������ã�������ó�null������ʾ | ||
* 坐标轴线的配置信息,如果设置成null,则不显示轴线 | ||
* @type {Object} | ||
@@ -34,3 +34,3 @@ */ | ||
/** | ||
* �̶��ߵ���ʽ���ã�������ó�null������ʾ | ||
* 坐标轴刻度线的配置,如果设置成null,则不显示刻度线 | ||
* @type {Object} | ||
@@ -40,3 +40,3 @@ */ | ||
/** | ||
* �ο̶��߸��������δ���ø����ԣ�����ʾ | ||
* 次刻度线个数配置 | ||
* @type {Number} | ||
@@ -46,3 +46,3 @@ */ | ||
/** | ||
* �ο̶�����ʽ���� | ||
* 次刻度线样式配置 | ||
* @type {Object} | ||
@@ -52,3 +52,3 @@ */ | ||
/** | ||
* ������դ������ʽ���ã��������Ϊ null������ʾ | ||
* 网格线配置,如果值为 null,则不显示 | ||
* @type {Object} | ||
@@ -58,19 +58,19 @@ */ | ||
/** | ||
* �������ϵ��ı�������� | ||
* 坐标轴文本配置 | ||
* @type {Object} | ||
*/ | ||
label: { | ||
textStyle: {}, // �ı���ʽ���� | ||
textStyle: {}, // 坐标轴文本样式 | ||
autoRotate: true, | ||
formatter: null// ��ʽ���������ı���ʾ | ||
formatter: null // 坐标轴文本格式化回调函数 | ||
}, | ||
/** | ||
* �����������ʽ���� | ||
* 坐标轴标题配置 | ||
* @type {Object} | ||
*/ | ||
title: { | ||
autoRotate: true, // �Զ���ת | ||
textStyle: {} // �����ı���ʽ���� | ||
autoRotate: true, // 文本是否自动旋转 | ||
textStyle: {} // 坐标轴标题样式 | ||
}, | ||
autoPaint: true // @type {Boolean} �Ƿ��Զ����� | ||
autoPaint: true | ||
}; | ||
@@ -80,16 +80,15 @@ } | ||
_beforeRenderUI() { | ||
// ���Ĭ����ʽ | ||
const title = this.get('title'); | ||
const label = this.get('label'); | ||
const grid = this.get('grid'); | ||
const textStyle = { | ||
fontSize: 12, | ||
fill: '#ccc', | ||
textBaseline: 'middle', | ||
fontFamily: Global.fontFamily | ||
}; | ||
if (title) { | ||
this.setSilent('title', Util.deepMix({ | ||
autoRotate: true, | ||
textStyle, | ||
textStyle: { | ||
fontSize: 12, | ||
fill: '#ccc', | ||
textBaseline: 'middle', | ||
fontFamily: Global.fontFamily, | ||
textAlign: 'center' | ||
}, | ||
offset: 48 | ||
@@ -101,3 +100,8 @@ }, title)); | ||
autoRotate: true, | ||
textStyle, | ||
textStyle: { | ||
fontSize: 12, | ||
fill: '#ccc', | ||
textBaseline: 'middle', | ||
fontFamily: Global.fontFamily | ||
}, | ||
offset: 10 | ||
@@ -207,3 +211,3 @@ }, label)); | ||
if (subTickCount) { // ��������ôμ��ֵ㣬��Ӵμ�tick | ||
if (subTickCount) { // 如果有设置次级分点,添加次级tick | ||
const subTickLineCfg = self.get('subTickLine'); | ||
@@ -249,3 +253,3 @@ Util.each(ticks, function(tick, index) { | ||
tickShape.name = 'axis-ticks'; | ||
tickShape._id = this.get('_id') + '-ticks'; // ÿ�� label �� _id Ψһ��ʶ | ||
tickShape._id = this.get('_id') + '-ticks'; | ||
tickShape.set('coord', this.get('coord')); | ||
@@ -300,8 +304,8 @@ } | ||
let align; | ||
if (ratio >= 1) { // ����������� | ||
if (ratio >= 1) { // 上面或者下面 | ||
align = 'center'; | ||
} else { | ||
if (vector[0] > 0) { // �Ҳ� | ||
if (vector[0] > 0) { // 右侧 | ||
align = 'start'; | ||
} else { // ��� | ||
} else { // 左侧 | ||
align = 'end'; | ||
@@ -334,3 +338,3 @@ } | ||
/** | ||
* ��ת�ı� | ||
* 旋转文本 | ||
* @abstract | ||
@@ -342,3 +346,3 @@ * @return {[type]} [description] | ||
/** | ||
* ��Ⱦ��������� | ||
* 渲染标题 | ||
* @abstract | ||
@@ -350,3 +354,3 @@ * @return {[type]} [description] | ||
/** | ||
* ��ȡ�������ߵ� path | ||
* 获取坐标轴线的 path | ||
* @abstract | ||
@@ -358,3 +362,3 @@ * @return {[type]} [description] | ||
/** | ||
* ��ȡtick�ڻ����ϵ�λ�� | ||
* 获取 tick 在画布上的位置 | ||
* @abstract | ||
@@ -366,3 +370,3 @@ * @return {[type]} [description] | ||
/** | ||
* ��ȡ��ʾ�������ߵ��յ� | ||
* 获取标示坐标点的线的终点 | ||
* @abstract | ||
@@ -374,3 +378,3 @@ * @return {[type]} [description] | ||
/** | ||
* ��ȡ��������������� | ||
* 获取距离坐标轴的向量 | ||
* @abstract | ||
@@ -398,3 +402,2 @@ * @return {[type]} [description] | ||
}; | ||
label.text = tick.text; | ||
@@ -407,3 +410,3 @@ label.x = point.x; | ||
rst.name = 'axis-label'; | ||
rst._id = this.get('_id') + '-' + tick.tickValue; // ÿ�� label �� _id Ψһ��ʶ | ||
rst._id = this.get('_id') + '-' + tick.tickValue; | ||
rst.set('coord', this.get('coord')); | ||
@@ -410,0 +413,0 @@ } |
@@ -10,3 +10,3 @@ /** | ||
const Default = { | ||
version: '3.0.0-rc5.12', | ||
version: '3.0.0-rc5.13', | ||
trackable: true, | ||
@@ -13,0 +13,0 @@ animate: true, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
18753127
65307