|
|
@@ -148,6 +148,8 @@ export default class StockHeatmap extends React.Component {
|
|
|
// const moveDataPointDirection = dragLength >= 0 ? 'right' : 'left';
|
|
|
// console.log('drag x=', dragLength, moveDataPointsCount, this.windowPosition);
|
|
|
this.moveDataWindow(this.windowPosition + moveDataPointsCount * (dragLength >= 0 ? -1 : 1));
|
|
|
+
|
|
|
+ this.autoScroll = false
|
|
|
} else {
|
|
|
// const canvas = this.canvasRef.current;
|
|
|
// if (!canvas) return;
|
|
|
@@ -620,7 +622,6 @@ export default class StockHeatmap extends React.Component {
|
|
|
* @param {any} data
|
|
|
*/
|
|
|
addData = (data) => {
|
|
|
-
|
|
|
if (typeof (data) === 'object') {
|
|
|
this.data.push(data);
|
|
|
this.updateWindowedData();
|
|
|
@@ -632,7 +633,9 @@ export default class StockHeatmap extends React.Component {
|
|
|
*/
|
|
|
updateWindowedData = () => {
|
|
|
// console.log('window data updated');
|
|
|
- this.moveDataWindow(this.data.length - this.windowLength - 1);
|
|
|
+ if (this.autoScroll) {
|
|
|
+ this.moveDataWindow(this.data.length - this.windowLength - 1);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -643,6 +646,13 @@ export default class StockHeatmap extends React.Component {
|
|
|
if (position !== this.windowPosition && position > -1 && position < this.data.length - this.windowLength) {
|
|
|
// move position only if within valid range
|
|
|
this.windowedData = this.data.slice(position, position + this.windowLength + 1);
|
|
|
+
|
|
|
+ // 延迟日志
|
|
|
+ if (this.windowedData.length > 1) {
|
|
|
+ let last = this.windowedData[this.windowedData.length - 1]
|
|
|
+ console.log(new Date().getTime() - last.time, last)
|
|
|
+ }
|
|
|
+
|
|
|
this.windowPosition = position;
|
|
|
if (this.windowPosition === this.data.length - this.windowLength - 1) {
|
|
|
// enable auto scroll
|