|
|
@@ -40,7 +40,7 @@ export default class StockHeatmap extends React.Component {
|
|
|
|
|
|
data = [];
|
|
|
windowedData = [];
|
|
|
- windowLength = 40;
|
|
|
+ windowLength = 20;
|
|
|
windowPosition = 0;
|
|
|
|
|
|
mouse = {
|
|
|
@@ -255,7 +255,6 @@ export default class StockHeatmap extends React.Component {
|
|
|
* This function changes the d3 scales based on windowed data
|
|
|
*/
|
|
|
updateHeatmapDimensions = () => {
|
|
|
- // console.log('heatmap dimension updated, update scale domains');
|
|
|
const { width, height } = this.props;
|
|
|
if (width > 0 && height > 0 && this.windowedData.length > 0) {
|
|
|
// setup x-scale
|
|
|
@@ -280,7 +279,6 @@ export default class StockHeatmap extends React.Component {
|
|
|
*/
|
|
|
updateHeatmap = () => {
|
|
|
if (this.drawingContext !== null) {
|
|
|
- // console.log('heatmap update req');
|
|
|
// 1. update scale and dimensions
|
|
|
this.updateHeatmapDimensions();
|
|
|
|
|
|
@@ -438,12 +436,15 @@ export default class StockHeatmap extends React.Component {
|
|
|
// const maxTickInterval = this.defaults.hmWidth() / assumedTextWidth;
|
|
|
const bandInterval = Math.max(1, parseInt(this.windowedData.length / (this.defaults.hmWidth() / 102)));
|
|
|
// console.log('bandInterval=', bandInterval);
|
|
|
+ let panel = this;
|
|
|
this.windowedData.map((d, i) => {
|
|
|
if (i !=0 && i % bandInterval === 0) {
|
|
|
let x = this.xScale(d.ts);
|
|
|
- this.drawingContext.moveTo(x, 0);
|
|
|
- this.drawingContext.lineTo(x, this.defaults.axisTickSize);
|
|
|
- this.drawingContext.fillText(d.ts, x, this.defaults.axisTickSize + this.defaults.xAxisTextPadding);
|
|
|
+ if (x + d.ts.length * 5 < panel.defaults.hmWidth()) {
|
|
|
+ this.drawingContext.moveTo(x, 0);
|
|
|
+ this.drawingContext.lineTo(x, this.defaults.axisTickSize);
|
|
|
+ this.drawingContext.fillText(d.ts, x, this.defaults.axisTickSize + this.defaults.xAxisTextPadding);
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
this.drawingContext.textAlign = 'left';
|