Comparing version 1.7.2 to 1.7.3
@@ -116,2 +116,3 @@ "use strict"; | ||
default_1.prototype._axis = function (isBuild) { | ||
var _this = this; | ||
if (isBuild === void 0) { isBuild = false; } | ||
@@ -122,4 +123,3 @@ if (isBuild) { | ||
.attr("transform", "translate(" + (CONFIG.left + this.labelWidth) + "," + (this.H + CONFIG.top) + ")"); | ||
//@ts-ignore | ||
x.call(d3.axisBottom(this.widthScale).tickSize(1).tickFormat(this.LABELFORMAT)); | ||
x.call(d3.axisBottom(this.widthScale).tickSize(1).tickFormat(function (e) { return _this.LABELFORMAT(e); })); | ||
if (_.has(this.props, 'xLabel')) { | ||
@@ -136,3 +136,3 @@ x.append('text') | ||
//@ts-ignore | ||
y.call(d3.axisLeft(this.heightScale).ticks(4).tickSize(1).tickFormat(this.FORMAT)); | ||
y.call(d3.axisLeft(this.heightScale).ticks(4).tickSize(1).tickFormat(function (e) { return _this.FORMAT(e); })); | ||
if (_.has(this.props, 'yLabel')) { | ||
@@ -139,0 +139,0 @@ y.append('text') |
@@ -211,2 +211,3 @@ "use strict"; | ||
var _this = this; | ||
this.itemHeight = this.HEIGHT / this.DATA.length; | ||
var group = this.SVG.selectAll('g._item') | ||
@@ -213,0 +214,0 @@ .data(this.DATA, function (d) { return d[_this.props.groupLabel]; }); |
@@ -104,2 +104,12 @@ "use strict"; | ||
.attr('y', this.itemHeight / 2 + 6); | ||
var innerRect = group.append('rect') | ||
.attr('class', '_content') | ||
.attr('width', 0) | ||
.attr('height', 12) | ||
.attr('x', 24) | ||
.attr('y', this.itemHeight / 2); | ||
this.attrTransition(innerRect, [ | ||
['width', function (d) { return _this.widthScale(d[_this.props.valueField]); }], | ||
['y', this.itemHeight / 2] | ||
]); | ||
group.on('mouseover', function (d) { | ||
@@ -115,12 +125,2 @@ if (_.has(_this.props, 'tip')) { | ||
}); | ||
var innerRect = group.append('rect') | ||
.attr('class', '_content') | ||
.attr('width', 0) | ||
.attr('height', 12) | ||
.attr('x', 24) | ||
.attr('y', this.itemHeight / 2); | ||
//@ts-ignore | ||
innerRect.transition() | ||
.duration(this.DURATION) | ||
.attr('width', function (d) { return _this.widthScale(d[_this.props.valueField]); }); | ||
if (this.props.onClick) { | ||
@@ -140,16 +140,17 @@ group.classed('_item_hover', true) | ||
var _this = this; | ||
group.transition().duration(this.DURATION) | ||
group.attr('class', function (d, i) { return _this.itemClass(d, i); }) | ||
.transition().duration(this.DURATION) | ||
.attr('transform', function (d, i) { return "translate(0," + _this.itemHeight * i + ")"; }); | ||
group.select('._index') | ||
.text(function (d, i) { return (i + 1) + '.'; }); | ||
.text(function (d, i) { return (i + 1) + '.'; }) | ||
.attr('y', this.itemHeight / 2 + 6); | ||
group.select('._label') | ||
.attr('y', this.itemHeight / 2 - 8); | ||
group.select('._value') | ||
.text(function (d) { return _this.FORMAT(d[_this.props.valueField]); }); | ||
// 改变中条颜色 | ||
group.select('._content') | ||
.classed('_content_1', function (d, i) { return i == 0; }) | ||
.classed('_content_2', function (d, i) { return i == 1; }) | ||
.classed('_content_3', function (d, i) { return i == 2; }) | ||
.transition() | ||
.duration(this.DURATION) | ||
.attr('width', function (d) { return _this.widthScale(d[_this.props.valueField]); }); | ||
.text(function (d) { return _this.FORMAT(d[_this.props.valueField]); }) | ||
.attr('y', this.itemHeight / 2 + 6); | ||
this.attrTransition(group.select('._content'), [ | ||
['width', function (d) { return _this.widthScale(d[_this.props.valueField]); }], | ||
['y', this.itemHeight / 2] | ||
]); | ||
}; | ||
@@ -156,0 +157,0 @@ default_1.prototype.update = function () { |
@@ -160,5 +160,11 @@ "use strict"; | ||
.attr('width', function (d) { return _this.widthScale(d[_this.props.valueField]); }); | ||
group.select('text._index').attr('y', this.itemHeight / 2 - 2); | ||
group.select('rect._bkg').attr('y', this.itemHeight / 2); | ||
group.select('rect._content').attr('y', this.itemHeight / 2 + 2); | ||
group.select('text._label').attr('y', this.itemHeight / 2 - 8); | ||
group.select('text._value').attr('y', this.itemHeight / 2 - 8); | ||
}; | ||
default_1.prototype.update = function () { | ||
var _this = this; | ||
this.itemHeight = this.HEIGHT / this.DATA.length; | ||
var group = this.SVG.selectAll('g._item') | ||
@@ -165,0 +171,0 @@ .data(this.DATA, function (d) { return d[_this.props.labelField]; }); |
@@ -18,2 +18,3 @@ /// <reference types="react" /> | ||
itemClass(d: any, i: any): string; | ||
attrTransition(group: any, effects: [string, any][]): void; | ||
/** | ||
@@ -20,0 +21,0 @@ * build 方法会在图表标签导入时自动调用,必须实现此方法 |
@@ -37,2 +37,9 @@ "use strict"; | ||
}; | ||
default_1.prototype.attrTransition = function (group, effects) { | ||
var t = group.transition() | ||
.duration(this.DURATION); | ||
effects.map(function (effect) { | ||
t.attr(effect[0], effect[1]); | ||
}); | ||
}; | ||
/** | ||
@@ -39,0 +46,0 @@ * resize方法会在宽高发生变化的情况下自动调用 |
{ | ||
"name": "vap", | ||
"version": "1.7.2", | ||
"version": "1.7.3", | ||
"description": "vap", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
352564
9061