Переглянути джерело

改用原来的颜色体系。

skyffire 1 рік тому
батько
коміт
da3c9db971
1 змінених файлів з 13 додано та 10 видалено
  1. 13 10
      src/index.js

+ 13 - 10
src/index.js

@@ -626,13 +626,15 @@ export default class StockHeatmap extends React.Component {
         const bid1 = marketDepth.buys[0];
         const ts = d.ts;
         // draw buys
+        let color = d3.color('#1a506d').rgb();
         if (marketDepth.buys && marketDepth.buys.length > 0) {
           marketDepth.buys.map(buy => {
-            let rate = buy.qty / maxBidAskVolume;
-            let colorIndex = Math.min(parseInt(rate / 0.25), panel.orderbookColors.length - 1);
-            let color = d3.color(panel.orderbookColors[colorIndex]).rgb()
-
-            color.opacity = 0.5 + 0.5 * (rate % 0.25) / 0.25;
+            // let rate = buy.qty / maxBidAskVolume;
+            // let colorIndex = Math.min(parseInt(rate / 0.25), panel.orderbookColors.length - 1);
+            // let color = d3.color(panel.orderbookColors[colorIndex]).rgb()
+            //
+            // color.opacity = 0.5 + 0.5 * (rate % 0.25) / 0.25;
+            color.opacity = buy.qty / maxBidAskVolume;
             this.drawingContext.fillStyle = color.toString();
             this.drawingContext.fillRect(
               this.xScale(ts),
@@ -645,11 +647,12 @@ export default class StockHeatmap extends React.Component {
         // draw sells
         if (marketDepth.sells && marketDepth.sells.length > 0) {
           marketDepth.sells.map(sell => {
-            let rate = sell.qty / maxBidAskVolume;
-            let colorIndex = Math.min(parseInt(rate / 0.25), panel.orderbookColors.length - 1);
-            let color = d3.color(panel.orderbookColors[colorIndex]).rgb()
-
-            color.opacity = 0.5 + 0.5 * (rate % 0.25) / 0.25;
+            // let rate = sell.qty / maxBidAskVolume;
+            // let colorIndex = Math.min(parseInt(rate / 0.25), panel.orderbookColors.length - 1);
+            // let color = d3.color(panel.orderbookColors[colorIndex]).rgb()
+            //
+            // color.opacity = 0.5 + 0.5 * (rate % 0.25) / 0.25;
+            color.opacity = sell.qty / maxBidAskVolume;
             this.drawingContext.fillStyle = color.toString();
             this.drawingContext.fillRect(
               this.xScale(ts),