@antv/g2
Advanced tools
Comparing version 3.0.5-beta.5 to 3.0.5-beta.6
@@ -404,3 +404,3 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
var field = yScale.field; | ||
if (!(colDefs[field] && colDefs[field].min) && yScale.min > 0) { | ||
if (!(colDefs[field] && colDefs[field].min) && yScale.min > 0 && yScale.type !== 'time') { | ||
yScale.change({ | ||
@@ -407,0 +407,0 @@ min: 0 |
@@ -155,5 +155,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
} | ||
var coord = self.get('coord'); | ||
var width = coord.x.end; | ||
var height = coord.y.start; | ||
var _self$get = self.get('coord'), | ||
width = _self$get.width, | ||
height = _self$get.height; | ||
var heatmapCanvas = document.createElement('canvas'); | ||
@@ -190,7 +192,12 @@ heatmapCanvas.width = width; | ||
// canvas size | ||
var coord = self.get('coord'); | ||
var width = coord.width; | ||
var height = coord.height; | ||
var _self$get2 = self.get('coord'), | ||
start = _self$get2.start, | ||
end = _self$get2.end, | ||
width = _self$get2.width, | ||
height = _self$get2.height; | ||
// value, range, etc | ||
var valueField = self.getAttr('color').field; | ||
@@ -221,3 +228,3 @@ var size = self.get(HEATMAP_SIZE); | ||
// step2. convert pixels | ||
var colored = ctx.getImageData(coord.start.x, coord.end.y, width + coord.start.x, height + coord.end.y); | ||
var colored = ctx.getImageData(start.x, end.y, width, height); | ||
self._clearShadowCanvasCtx(); | ||
@@ -227,6 +234,6 @@ self._colorize(colored); | ||
var imageShape = self._getImageShape(); | ||
imageShape.attr('x', coord.start.x); | ||
imageShape.attr('y', coord.end.y); | ||
imageShape.attr('width', width + coord.start.x); | ||
imageShape.attr('height', height + coord.end.y); | ||
imageShape.attr('x', start.x); | ||
imageShape.attr('y', end.y); | ||
imageShape.attr('width', width); | ||
imageShape.attr('height', height); | ||
imageShape.attr('img', ctx.canvas); | ||
@@ -233,0 +240,0 @@ }; |
@@ -124,2 +124,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
PieLabels.prototype.getDefaultOffset = function getDefaultOffset() { | ||
var labelCfg = this.get('label'); | ||
var offset = labelCfg.offset || 0; | ||
return offset; | ||
}; | ||
/** | ||
@@ -139,2 +145,3 @@ * @protected | ||
} | ||
return items; | ||
@@ -155,3 +162,2 @@ }; | ||
var coord = self.get('coord'); | ||
// console.log(coord); | ||
var radius = coord.getRadius(); | ||
@@ -277,2 +283,3 @@ var lineHeight = self.get('label').labelHeight; | ||
var center = coord.getCenter(); | ||
var align = void 0; | ||
@@ -307,2 +314,3 @@ if (point.angle <= Math.PI / 2 && point.x >= center.x) { | ||
}; | ||
self.transLabelPoint(startPoint); // 转换到画布坐标,如果坐标系发生改变 | ||
var endPoint = { | ||
@@ -312,2 +320,3 @@ x: Util.isArray(point.x) ? point.x[1] : point.x, | ||
}; | ||
self.transLabelPoint(endPoint); // 转换到画布坐标,如果坐标系发生改变 | ||
var angle = void 0; | ||
@@ -314,0 +323,0 @@ var startAngle = PathUtil.getPointAngle(coord, startPoint); |
@@ -18,2 +18,17 @@ /** | ||
function getOriginAttrs(selectedCfg, shape) { | ||
var originAttrs = {}; | ||
Util.each(selectedCfg, function (v, k) { | ||
if (k === 'transform') { | ||
k = 'matrix'; | ||
} | ||
var originValue = shape.__attrs[k]; | ||
if (Util.isArray(originValue)) { | ||
originValue = Util.cloneDeep(originValue); // 缓存原来的属性,由于 __attrs.matrix 是数组,所以此处需要深度复制 | ||
} | ||
originAttrs[k] = originValue; | ||
}); | ||
return originAttrs; | ||
} | ||
var SelectMixin = { | ||
@@ -88,3 +103,7 @@ _isAllowSelect: function _isAllowSelect() { | ||
// 缓存原有属性 | ||
shape.set('_originAttrs', Util.cloneDeep(shape.__attrs)); | ||
if (shape.get('animating')) { | ||
// 停止动画 | ||
shape.stopAnimate(); | ||
} | ||
shape.set('_originAttrs', getOriginAttrs(selectedStyle, shape)); | ||
} | ||
@@ -100,2 +119,3 @@ | ||
var originAttrs = shape.get('_originAttrs'); | ||
shape.set('_originAttrs', null); | ||
if (animate) { | ||
@@ -102,0 +122,0 @@ shape.animate(originAttrs, 300); |
@@ -49,3 +49,2 @@ /** | ||
path.push(['Z']); | ||
// console.log(Util.map(path, points => points.join('')).join('')); | ||
return path; | ||
@@ -52,0 +51,0 @@ } |
@@ -169,3 +169,2 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
var origin = cfg.origin._origin; | ||
console.log(cfg); | ||
shapeContainer.addShape('text', { | ||
@@ -178,3 +177,4 @@ attrs: Util.mix({}, { | ||
fill: cfg.shape === 'hollow' ? cfg.color : '#666', | ||
textAlign: 'center' | ||
textAlign: 'center', | ||
textBaseline: 'middle' | ||
}, cfg.style ? cfg.style.textStyle : {}) | ||
@@ -181,0 +181,0 @@ }); |
@@ -178,2 +178,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
}); | ||
// 如果 ticks 为空,直接输入最小值、最大值 | ||
if (!ticks.length) { | ||
ticks.push(self.min); | ||
ticks.push(self.max); | ||
} | ||
self.ticks = ticks; | ||
@@ -180,0 +185,0 @@ } |
{ | ||
"name": "@antv/g2", | ||
"version": "3.0.5-beta.5", | ||
"version": "3.0.5-beta.6", | ||
"description": "the Grammar of Graphics in Javascript", | ||
@@ -87,3 +87,3 @@ "main": "build/g2.js", | ||
"dependencies": { | ||
"@antv/g": "~2.0.5", | ||
"@antv/g": "~2.0.7-beta.1", | ||
"fecha": "~2.3.2", | ||
@@ -90,0 +90,0 @@ "gl-matrix": "~2.4.0", |
@@ -373,3 +373,3 @@ /** | ||
const field = yScale.field; | ||
if (!(colDefs[field] && colDefs[field].min) && yScale.min > 0) { | ||
if (!(colDefs[field] && colDefs[field].min) && yScale.min > 0 && yScale.type !== 'time') { | ||
yScale.change({ | ||
@@ -376,0 +376,0 @@ min: 0 |
@@ -144,5 +144,3 @@ /** | ||
} | ||
const coord = self.get('coord'); | ||
const width = coord.x.end; | ||
const height = coord.y.start; | ||
const { width, height } = self.get('coord'); | ||
const heatmapCanvas = document.createElement('canvas'); | ||
@@ -179,5 +177,3 @@ heatmapCanvas.width = width; | ||
// canvas size | ||
const coord = self.get('coord'); | ||
const width = coord.width; | ||
const height = coord.height; | ||
const { start, end, width, height } = self.get('coord'); | ||
@@ -210,3 +206,3 @@ // value, range, etc | ||
// step2. convert pixels | ||
const colored = ctx.getImageData(coord.start.x, coord.end.y, width + coord.start.x, height + coord.end.y); | ||
const colored = ctx.getImageData(start.x, end.y, width, height); | ||
self._clearShadowCanvasCtx(); | ||
@@ -216,6 +212,6 @@ self._colorize(colored); | ||
const imageShape = self._getImageShape(); | ||
imageShape.attr('x', coord.start.x); | ||
imageShape.attr('y', coord.end.y); | ||
imageShape.attr('width', width + coord.start.x); | ||
imageShape.attr('height', height + coord.end.y); | ||
imageShape.attr('x', start.x); | ||
imageShape.attr('y', end.y); | ||
imageShape.attr('width', width); | ||
imageShape.attr('height', height); | ||
imageShape.attr('img', ctx.canvas); | ||
@@ -222,0 +218,0 @@ } |
@@ -107,2 +107,8 @@ const Util = require('../../util'); | ||
getDefaultOffset() { | ||
const labelCfg = this.get('label'); | ||
const offset = labelCfg.offset || 0; | ||
return offset; | ||
} | ||
/** | ||
@@ -120,2 +126,3 @@ * @protected | ||
} | ||
return items; | ||
@@ -134,3 +141,2 @@ } | ||
const coord = self.get('coord'); | ||
// console.log(coord); | ||
const radius = coord.getRadius(); | ||
@@ -247,2 +253,3 @@ const lineHeight = self.get('label').labelHeight; | ||
const center = coord.getCenter(); | ||
let align; | ||
@@ -277,2 +284,3 @@ if (point.angle <= Math.PI / 2 && point.x >= center.x) { | ||
}; | ||
self.transLabelPoint(startPoint); // 转换到画布坐标,如果坐标系发生改变 | ||
const endPoint = { | ||
@@ -282,2 +290,3 @@ x: Util.isArray(point.x) ? point.x[1] : point.x, | ||
}; | ||
self.transLabelPoint(endPoint); // 转换到画布坐标,如果坐标系发生改变 | ||
let angle; | ||
@@ -284,0 +293,0 @@ const startAngle = PathUtil.getPointAngle(coord, startPoint); |
@@ -18,2 +18,17 @@ /** | ||
function getOriginAttrs(selectedCfg, shape) { | ||
const originAttrs = {}; | ||
Util.each(selectedCfg, function(v, k) { | ||
if (k === 'transform') { | ||
k = 'matrix'; | ||
} | ||
let originValue = shape.__attrs[k]; | ||
if (Util.isArray(originValue)) { | ||
originValue = Util.cloneDeep(originValue);// 缓存原来的属性,由于 __attrs.matrix 是数组,所以此处需要深度复制 | ||
} | ||
originAttrs[k] = originValue; | ||
}); | ||
return originAttrs; | ||
} | ||
const SelectMixin = { | ||
@@ -83,3 +98,6 @@ _isAllowSelect() { | ||
if (!shape.get('_originAttrs')) { // 缓存原有属性 | ||
shape.set('_originAttrs', Util.cloneDeep(shape.__attrs)); | ||
if (shape.get('animating')) { // 停止动画 | ||
shape.stopAnimate(); | ||
} | ||
shape.set('_originAttrs', getOriginAttrs(selectedStyle, shape)); | ||
} | ||
@@ -95,2 +113,3 @@ | ||
const originAttrs = shape.get('_originAttrs'); | ||
shape.set('_originAttrs', null); | ||
if (animate) { | ||
@@ -97,0 +116,0 @@ shape.animate(originAttrs, 300); |
@@ -49,3 +49,2 @@ /** | ||
path.push([ 'Z' ]); | ||
// console.log(Util.map(path, points => points.join('')).join('')); | ||
return path; | ||
@@ -52,0 +51,0 @@ } |
@@ -152,3 +152,2 @@ /** | ||
const origin = cfg.origin._origin; | ||
console.log(cfg); | ||
shapeContainer.addShape('text', { | ||
@@ -161,3 +160,4 @@ attrs: Util.mix({}, { | ||
fill: cfg.shape === 'hollow' ? cfg.color : '#666', | ||
textAlign: 'center' | ||
textAlign: 'center', | ||
textBaseline: 'middle' | ||
}, cfg.style ? cfg.style.textStyle : {}) | ||
@@ -164,0 +164,0 @@ }); |
@@ -158,2 +158,7 @@ /** | ||
}); | ||
// 如果 ticks 为空,直接输入最小值、最大值 | ||
if (!ticks.length) { | ||
ticks.push(self.min); | ||
ticks.push(self.max); | ||
} | ||
self.ticks = ticks; | ||
@@ -160,0 +165,0 @@ } |
Sorry, the diff of this file is not supported yet
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
5620234
90995
+ Added@antv/g@2.0.7-beta.6(transitive)
- Removed@antv/g@2.0.6(transitive)
Updated@antv/g@~2.0.7-beta.1