@antv/g2
Advanced tools
Comparing version 3.0.0-rc5.10 to 3.0.0-rc5.11
{ | ||
"name": "@antv/g2", | ||
"version": "3.0.0-rc5.10", | ||
"version": "3.0.0-rc5.11", | ||
"description": "the Grammar of Graphics in Javascript", | ||
@@ -5,0 +5,0 @@ "main": "build/g2.js", |
@@ -426,2 +426,8 @@ const Util = require('../../util'); | ||
const options = self.options; | ||
let defaultCfg = Global.legend[position]; | ||
if ((options && options.slidable === false) || (options[field] && options[field].slidable === false)) { | ||
defaultCfg = Util.mix({}, defaultCfg, Global.legend.gradient); | ||
} | ||
const legendCfg = Util.deepMix({ | ||
@@ -431,3 +437,3 @@ title: { | ||
} | ||
}, Global.legend[position], options[field] || options, { | ||
}, defaultCfg, options[field] || options, { | ||
items, | ||
@@ -434,0 +440,0 @@ attr |
@@ -370,3 +370,6 @@ /** | ||
if (labelsGroup) { | ||
const offset = this.get('label').offset || this.get('_labelOffset'); | ||
let offset = this.get('_labelOffset'); | ||
if (!Util.isNil(this.get('label').offset)) { | ||
offset = this.get('label').offset; | ||
} | ||
const vector = this.getSideVector(offset, point, index); | ||
@@ -373,0 +376,0 @@ point = { |
@@ -80,3 +80,3 @@ /** | ||
const vector = [ point.x - center.x, point.y - center.y ]; | ||
if (offset) { | ||
if (!Util.isNil(offset)) { | ||
const vecLen = vec2.length(vector); | ||
@@ -83,0 +83,0 @@ vec2.scale(vector, vector, offset / vecLen); |
@@ -118,2 +118,3 @@ /** | ||
} else { | ||
delete cfg.point; // 临时解决,否则影响动画 | ||
labelShape = this.addShape('text', { | ||
@@ -120,0 +121,0 @@ attrs: cfg |
@@ -25,3 +25,7 @@ /** | ||
layout: 'vertical', | ||
labelOffset: 5 // TODO: 文本同渐变背景的距离 | ||
labelOffset: 15, | ||
lineStyle: { | ||
lineWidth: 1, | ||
stroke: '#fff' | ||
} | ||
}); | ||
@@ -80,5 +84,8 @@ } | ||
fill += 'l (90) '; | ||
Util.each(items, v => { | ||
path.push([ 'M', 0, height - v.scaleValue * height ]); | ||
path.push([ 'L', width, height - v.scaleValue * height ]); | ||
Util.each(items, (v, index) => { | ||
if (index !== 0 && (index !== items.length - 1)) { | ||
path.push([ 'M', 0, height - v.scaleValue * height ]); | ||
path.push([ 'L', width, height - v.scaleValue * height ]); | ||
} | ||
rgbColor = ColorUtil.toRGB(v.attrValue); | ||
@@ -88,5 +95,5 @@ fill += (1 - v.scaleValue) + ':' + rgbColor + ' '; | ||
attrs: Util.mix({}, { | ||
x: width + self.get('labelOffset'), | ||
x: width + self.get('labelOffset') / 2, | ||
y: height - v.scaleValue * height, | ||
text: self._formatItemValue(v.value * 1) + '' | ||
text: self._formatItemValue(v.value) + '' // 以字符串格式展示 | ||
}, self.get('textStyle'), { | ||
@@ -99,5 +106,7 @@ textAlign: 'start' | ||
fill += 'l (0) '; | ||
Util.each(items, v => { | ||
path.push([ 'M', v.scaleValue * width, 0 ]); | ||
path.push([ 'L', v.scaleValue * width, height ]); | ||
Util.each(items, (v, index) => { | ||
if (index !== 0 && (index !== items.length - 1)) { | ||
path.push([ 'M', v.scaleValue * width, 0 ]); | ||
path.push([ 'L', v.scaleValue * width, height ]); | ||
} | ||
rgbColor = ColorUtil.toRGB(v.attrValue); | ||
@@ -109,3 +118,3 @@ fill += v.scaleValue + ':' + rgbColor + ' '; | ||
y: height + self.get('labelOffset'), | ||
text: self._formatItemValue(v.value * 1) + '' | ||
text: self._formatItemValue(v.value) + '' // 以字符串格式展示 | ||
}, self.get('textStyle')) | ||
@@ -127,7 +136,5 @@ }); | ||
bgGroup.addShape('path', { | ||
attrs: { | ||
path, | ||
lineWidth: 1, | ||
stroke: '#fff' | ||
} | ||
attrs: Util.mix({ | ||
path | ||
}, this.get('lineStyle')) | ||
}); | ||
@@ -134,0 +141,0 @@ |
@@ -183,6 +183,6 @@ /** | ||
const minTextAttr = Util.mix({ | ||
text: this._formatItemValue(min.value * 1) + '' | ||
text: this._formatItemValue(min.value) + '' | ||
}, textStyle); | ||
const maxTextAttr = Util.mix({ | ||
text: this._formatItemValue(max.value * 1) + '' | ||
text: this._formatItemValue(max.value) + '' | ||
}, textStyle); | ||
@@ -189,0 +189,0 @@ if (layout === 'vertical') { |
@@ -14,3 +14,3 @@ /** | ||
function getAttrs(cfg) { | ||
const defaultCfg = Global.shape.line; | ||
const defaultCfg = Global.shape.edge; | ||
const shapeCfg = Util.mix({}, defaultCfg, { | ||
@@ -17,0 +17,0 @@ stroke: cfg.color, |
@@ -10,3 +10,3 @@ /** | ||
const Default = { | ||
version: '3.0.0-rc5.10', | ||
version: '3.0.0-rc5.11', | ||
trackable: true, | ||
@@ -13,0 +13,0 @@ animate: true, |
@@ -150,2 +150,10 @@ /** | ||
} | ||
}, | ||
gradient: { | ||
textStyle: { | ||
fill: '#D9D9D9' | ||
}, | ||
lineStyle: { | ||
stroke: '#404040' | ||
} | ||
} | ||
@@ -163,3 +171,3 @@ }, | ||
fill: '#fff', | ||
opacity: 0.15 | ||
opacity: 0.1 | ||
} | ||
@@ -166,0 +174,0 @@ }, // tooltip 辅助背景框样式 |
@@ -366,2 +366,18 @@ /** | ||
} | ||
}, | ||
// 不能滑动的连续图例样式 | ||
gradient: { | ||
textStyle: { | ||
fill: '#8C8C8C', | ||
fontSize: 12, | ||
textAlign: 'center', | ||
textBaseline: 'middle', | ||
lineHeight: 20, | ||
fontFamily: FONT_FAMILY | ||
}, // 图例项文本的样式 | ||
lineStyle: { | ||
lineWidth: 1, | ||
stroke: '#fff' | ||
}, | ||
unCheckColor: '#bfbfbf' | ||
} | ||
@@ -493,2 +509,7 @@ }, | ||
}, | ||
edge: { | ||
stroke: DEFAULT_COLOR, | ||
lineWidth: 1, | ||
fill: null | ||
}, | ||
schema: { | ||
@@ -495,0 +516,0 @@ stroke: DEFAULT_COLOR, |
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
18747647
65229