|
@@ -248,8 +248,6 @@ export default class StockHeatmap extends React.Component {
|
|
|
yDomainValues = null;
|
|
yDomainValues = null;
|
|
|
/** @type {d3Timer.Timer} */
|
|
/** @type {d3Timer.Timer} */
|
|
|
bidAskAnimTimer = null;
|
|
bidAskAnimTimer = null;
|
|
|
- /** @type {{[key:number]:number}} */
|
|
|
|
|
- bidAskBarAnimConfig = {};
|
|
|
|
|
// ------------------ D3 Variables ---------------------
|
|
// ------------------ D3 Variables ---------------------
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -562,19 +560,18 @@ export default class StockHeatmap extends React.Component {
|
|
|
this.drawingContext.fillStyle = color;
|
|
this.drawingContext.fillStyle = color;
|
|
|
const l = this.defaults.bidAskWidth * (+v.qty / maxBidAskVol);
|
|
const l = this.defaults.bidAskWidth * (+v.qty / maxBidAskVol);
|
|
|
// save v bars length
|
|
// save v bars length
|
|
|
- this.bidAskBarAnimConfig[v.rate] = d3.interpolateNumber(this.bidAskBarAnimConfig[v.rate] || 0, l)(t);
|
|
|
|
|
- this.drawingContext.fillRect(0, this.yScale(v.rate), this.bidAskBarAnimConfig[v.rate], h);
|
|
|
|
|
- let tw = this.drawingContext.measureText(v.qty).width;
|
|
|
|
|
|
|
+ this.drawingContext.fillRect(0, this.yScale(v.rate), l, h);
|
|
|
|
|
+ let textWidth = this.drawingContext.measureText(v.qty).width;
|
|
|
|
|
|
|
|
- if (this.defaults.bidAskWidth - this.bidAskBarAnimConfig[v.rate] - tw >= tw) {
|
|
|
|
|
|
|
+ if (this.defaults.bidAskWidth - l - textWidth >= textWidth) {
|
|
|
// text outside bar
|
|
// text outside bar
|
|
|
this.drawingContext.textAlign = 'start';
|
|
this.drawingContext.textAlign = 'start';
|
|
|
this.drawingContext.fillStyle = this.defaults.textOnBackground;
|
|
this.drawingContext.fillStyle = this.defaults.textOnBackground;
|
|
|
- this.drawingContext.fillText(v.qty, this.bidAskBarAnimConfig[v.rate] + 1, this.yScale(v.rate) + h / 2 + 1);
|
|
|
|
|
|
|
+ this.drawingContext.fillText(v.qty, l + 1, this.yScale(v.rate) + h / 2 + 1);
|
|
|
} else {
|
|
} else {
|
|
|
this.drawingContext.textAlign = 'end';
|
|
this.drawingContext.textAlign = 'end';
|
|
|
this.drawingContext.fillStyle = textColor;
|
|
this.drawingContext.fillStyle = textColor;
|
|
|
- this.drawingContext.fillText(v.qty, this.bidAskBarAnimConfig[v.rate] - tw, this.yScale(v.rate) + h / 2 + 1);
|
|
|
|
|
|
|
+ this.drawingContext.fillText(v.qty, l - textWidth, this.yScale(v.rate) + h / 2 + 1);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|