skyffire преди 1 година
родител
ревизия
7859addca7
променени са 4 файла, в които са добавени 60 реда и са изтрити 82 реда
  1. 1 29
      example/public/index.html
  2. 53 51
      example/src/App.js
  3. 6 0
      example/src/index.css
  4. 0 2
      src/index.js

+ 1 - 29
example/public/index.html

@@ -7,24 +7,7 @@
       name="viewport"
       content="width=device-width, initial-scale=1, shrink-to-fit=no"
     />
-<!--    <meta name="theme-color" content="#000000" />-->
-
-    <!--
-      manifest.json provides metadata used when your web app is added to the
-      homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-    -->
-<!--    <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />-->
-
-    <!--
-      Notice the use of %PUBLIC_URL% in the tags above.
-      It will be replaced with the URL of the `public` folder during the build.
-      Only files inside the `public` folder can be referenced from the HTML.
-
-      Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
-      work correctly both with client-side routing and a non-root public URL.
-      Learn how to configure a non-root public URL by running `npm run build`.
-    -->
-    <title>overview市场流动性热图软件 v1.0.0</title>
+    <title>overview市场流动性热图软件 V1.0</title>
   </head>
 
   <body>
@@ -33,16 +16,5 @@
     </noscript>
 
     <div id="root"></div>
-
-    <!--
-      This HTML file is a template.
-      If you open it directly in the browser, you will see an empty page.
-
-      You can add webfonts, meta tags, or analytics to this file.
-      The build step will place the bundled scripts into the <body> tag.
-
-      To begin the development, run `npm start` or `yarn start`.
-      To create a production bundle, use `npm run build` or `yarn build`.
-    -->
   </body>
 </html>

+ 53 - 51
example/src/App.js

@@ -135,59 +135,61 @@ export default () => {
 
   return (
     <div className="wapper">
-      {isActivation && <React.Fragment>
-
-        {loading &&
-          <div className="loadingIndicator">
-            <div className="loadingSpinner">
-              <div className="loader">等待数据推送...</div>
-            </div>
-            <div ref={progressRef}> 等待数据推送 0%</div>
-          </div>
-        }
-
-        <StockHeatmap ref={heatmapRef} width={windowDim[0]} height={windowDim[1]} autoScroll={autoScroll}
-                      toggleAutoScroll={toggleAutoScroll} />
-
-        <div className="btnContainer">
-          <button onClick={() => {
-            if (heatmapRef.current !== null) heatmapRef.current.setZoomLevel(60)
-          }}>1分钟视域
-          </button>
-          <button onClick={() => {
-            if (heatmapRef.current !== null) heatmapRef.current.setZoomLevel(60 * 5)
-          }}>5分钟视域
-          </button>
-          <button onClick={() => {
-            if (heatmapRef.current !== null) heatmapRef.current.setZoomLevel(60 * 10)
-          }}>10分钟视域
-          </button>
-          <button onClick={() => {
-            if (heatmapRef.current !== null) heatmapRef.current.setZoomLevel(60 * 15)
-          }}>15分钟视域
-          </button>
-          <button onClick={() => {
-            if (heatmapRef.current !== null) heatmapRef.current.setZoomLevel(60 * 30)
-          }}>30分钟视域
-          </button>
-          <button onClick={() => {
-            if (heatmapRef.current !== null) heatmapRef.current.setZoomLevel(60 * 60)
-          }}>60分钟视域
-          </button>
-          {!autoScroll &&
-            <div className="playBtn" onClick={() => {
-              setAutoScroll(true)
-            }}> 继续
+      <div className={isActivation ? "visibilityVisible" : "visibilityHidden"}>
+        <React.Fragment>
+
+          {loading &&
+            <div className="loadingIndicator">
+              <div className="loadingSpinner">
+                <div className="loader">等待数据推送...</div>
+              </div>
+              <div ref={progressRef}> 等待数据推送 0%</div>
             </div>
           }
-          {/* <button onClick={() => { */}
-          {/*   const HHmmss = window.prompt('Enter HH:mm:ss', '00:00:00'); */}
-          {/*   let split = HHmmss.split(':'); */}
-          {/*   let position = (+split[0]-9)*3600 + (+split[1]*60) + (+split[2]); */}
-          {/*   if (heatmapRef.current !== null) heatmapRef.current.moveDataWindow(position); */}
-          {/*  }}>Set Position</button> */}
-        </div>
-      </React.Fragment>}
+
+          <StockHeatmap ref={heatmapRef} width={windowDim[0]} height={windowDim[1]} autoScroll={autoScroll}
+                        toggleAutoScroll={toggleAutoScroll} />
+
+          <div className="btnContainer">
+            <button onClick={() => {
+              if (heatmapRef.current !== null) heatmapRef.current.setZoomLevel(60)
+            }}>1分钟视域
+            </button>
+            <button onClick={() => {
+              if (heatmapRef.current !== null) heatmapRef.current.setZoomLevel(60 * 5)
+            }}>5分钟视域
+            </button>
+            <button onClick={() => {
+              if (heatmapRef.current !== null) heatmapRef.current.setZoomLevel(60 * 10)
+            }}>10分钟视域
+            </button>
+            <button onClick={() => {
+              if (heatmapRef.current !== null) heatmapRef.current.setZoomLevel(60 * 15)
+            }}>15分钟视域
+            </button>
+            <button onClick={() => {
+              if (heatmapRef.current !== null) heatmapRef.current.setZoomLevel(60 * 30)
+            }}>30分钟视域
+            </button>
+            <button onClick={() => {
+              if (heatmapRef.current !== null) heatmapRef.current.setZoomLevel(60 * 60)
+            }}>60分钟视域
+            </button>
+            {!autoScroll &&
+              <div className="playBtn" onClick={() => {
+                setAutoScroll(true)
+              }}> 继续
+              </div>
+            }
+            {/* <button onClick={() => { */}
+            {/*   const HHmmss = window.prompt('Enter HH:mm:ss', '00:00:00'); */}
+            {/*   let split = HHmmss.split(':'); */}
+            {/*   let position = (+split[0]-9)*3600 + (+split[1]*60) + (+split[2]); */}
+            {/*   if (heatmapRef.current !== null) heatmapRef.current.moveDataWindow(position); */}
+            {/*  }}>Set Position</button> */}
+          </div>
+        </React.Fragment>
+      </div>
       {!isActivation &&
         <div className="layoutContainer">
           <div className="activationBox">

+ 6 - 0
example/src/index.css

@@ -182,3 +182,9 @@ code {
 .btnWp .btn:active{
   background-color: #3a8ee6;
 }
+.visibilityHidden{
+ visibility: hidden;
+}
+.visibilityVisible{
+  visibility: visible;
+}

+ 0 - 2
src/index.js

@@ -27,9 +27,7 @@ export const d3 = Object.assign(
 
 /**
  * Stock Heatmap
- * @author Rounak Saha
  *
- * © Copyright 2020, Rounak Saha
  */
 export default class StockHeatmap extends React.Component {