Pei Chi
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # 電錶查詢系統 --- ## 目前後端提供給我的API有哪些? 1. [所有部門的名稱和ID](https://codepen.io/pei-chi-tsai/pen/RwQgmWO) 2. [全部的資料](https://codepen.io/pei-chi-tsai/pen/BaYZezN?editors=1010) 3. [撈單一部門的資料](https://codepen.io/pei-chi-tsai/pen/abqwrZG?editors=1010 ) 只需要改?dept_id =後面的參數 例如: http://192.168.1.148:8000/api/Environment/EnergyOfDate?dept_id=01 後端跟我說 可以用 s_data 和 e_data篩選日期範圍 --- ## [版面規劃](https://whimsical.com/GNKp1UTDkhxTpskkLvQUVJ): ### 1. 主要頁面: 所有部門當天電錶顯示資料 使用到的套件: (C3.js的[Gauge Chart](https://c3js.org/samples/chart_gauge.html)) ![](https://i.imgur.com/SFraMI5.png) 功能: (1)點擊整張卡片會連結到 **2.即時電表顯示頁面** 左上角的select區塊部門會帶上在主頁點選的部門名稱 下面的卡片區塊會跑出電錶資料 (2)點擊到單一個圖表會跳到**3. 單一電錶資料的頁面** 目前做的畫面: ![](https://i.imgur.com/9NaRRUb.png) --- ## **!!!遇到的問題!!!** **Q1.** 一直無法調整C3 gauge chart 的尺寸 在圖表和文字之前就是有一塊莫名的留白 ![](https://i.imgur.com/H0opjNL.png) <font color=red> A1.可能要F12看一下是什麼問題,可以用css 去把空白弄掉 </font> **Q2.** 每次跑這頁都會跑出D3報錯 不太確定是不是用錯什麼? 在public的index.js載了CDN又在components資料夾內的DeptList.vue檔案裡import c3 from 'c3'​ 可是不這樣寫又會說找不到c3 ![](https://i.imgur.com/2N77j0B.png) <font color=red> A2.如果已經npm c3 了,應該不用在public 裡面加入cdn 部分 </font> <font color=blue> 5/23 把cdn去掉之後 畫面會長不一樣 ![](https://i.imgur.com/6QL0mMQ.png) 又報這個錯誤 ![](https://i.imgur.com/OVgORlu.png) </font> **Q3.**如果點了某個部門的卡片 要跳轉到**2.即時電表顯示頁面** 又要把部門select區的內的option文字是顯示哪個部門 是不是要請後端多開api內的欄位 讓我可以寫在components資料夾內的DeptList.vue檔案的renderHTML函式內 去串資料? ![](https://i.imgur.com/evTs0rz.png) <font color=red> A3.感覺不用 </font> **Q4.** 點擊到單一個圖表會跳到**3. 單一電錶資料的頁面** 是不是也要請後端再多開一個id欄位才可以帶動態路由到單一的頁面上跑資料 還是可以不用麻煩後端 --- ### 2. 包含和其他部門比較的即時電錶顯示資訊頁面 ![](https://i.imgur.com/TRIJbjl.png) 功能: (1)選擇左上區塊的部門選單 會觸發change事件帶出不同部門的電錶資料 (2)右上區塊顯示全部部門當月以使用電量的doughnut chart (3)左下區塊顯示左上選取部門的當月所有電錶資料的圓餅圖 (4)右下區塊顯示近十天左上選取部門的所有電表折線圖 --- ## **!!!遇到的問題!!!** **Q5.** 看很久還是不懂vue chart.js的文件 不知道從哪裡帶入api的資料 **Chart使用API的數據** 那一個連結 https://vue-chartjs.org/zh-cn/guide/#chart%E4%BD%BF%E7%94%A8api%E7%9A%84%E6%95%B0%E6%8D%AE ![](https://i.imgur.com/UHtaRRD.png) <font color=red> A5.這我需要點時間研究一下,整體來看,好像就是這邊有點卡住? </font> 智商低到連範例也是看不懂 https://codesandbox.io/s/github/apertureless/vue-chartjs/tree/main/sandboxes/doughnut?file=/src/components/doughnutChart.ts **Q6.** 後端說要新增一個欄位讓我可以判別資料的月份 但我跟他說應該不用 如果給他在新增一個 判別月份 的欄位是不是比較好 目前右上區塊doughnut chart因為不會用chart.js 還是用c3做 判別當月資料我是在components的DonutChart.vue寫一個 getMonthDeptData ()函式來判斷 但發現如果要做後面單一電表資料還是要判別月份 可是都要求後端生欄位是不是有點不太Ok? **Q7.** 在components的DonutChart.vue檔案內 想寫出一個函式 把取得的資料組成c3套件要的資料格式 (如果可以用chart.js資料格式好像又不一樣) 想法是 利用data內的monthlyData陣列和deptCategory陣列跑雙迴圈去跑出一個一個部門的資料帶到 donutChartSetting ()函式內的columns 組成的資料長這樣=> ``` [ [ 部門名稱, 當月累積的使用度數 ]​, [ 部門名稱, 當月累積的使用度數 ]​ ], ``` 在迴圈內組成想要的資料 一直還寫不出來 要把部門當日的last_kwh_deliver_tot欄位剪掉當月1日的 first_kwh_deliver_tot欄位 算出整個月目前累積多少kwh --- ### 3. 單一電錶資料的頁面 ![](https://i.imgur.com/ygCPLak.png) 功能: (1) 帶出單一電錶每月用電的長條圖 (x軸是1日-30/31日) (2) 表格目前想說帶出api現有的資料 其實也不知道帶這幹麼 還沒想到可以改成什麼 (3) 和去年同期比較圖 --- ## **!!!還沒做覺得想不到!!!** **Q8.** 和去年同期比較 沒有去年資料不知道怎麼幻想 覺得好難啊~~~ http://192.168.1.148:8000/api/Environment/EnergyOfDate?s_date=2021-05-01&e_date=2021-05-31&host=192.168.7.11 <font color=red> A8.整體來說可能需要使用假資料 1.可以請後端幫忙,生一些去年資料; 2.不然你就是要在前面調整作出假資料 </font> --- 5/24 套件問題 終端機一直報出錯誤 ![](https://i.imgur.com/5Iphhss.png) ![](https://i.imgur.com/c7de3RK.png) ![](https://i.imgur.com/r8dyUvY.png) 備註: 參考版型: https://startbootstrap.com/theme/sb-admin-2 https://github.com/startbootstrap/startbootstrap-sb-admin-2 https://dribbble.com/shots/6464404/attachments/6464404-Dashboard-Design-Concept?mode=media https://dribbble.com/shots/17171783-Project-Management-Dashboard-UI-Concept/attachments/12272346?mode=media https://dribbble.com/shots/16928773/attachments/11998692?mode=media https://advcloudfiles.advantech.com/cms/ce9ccdfb-97cb-4b9a-aa40-5411ad4eff3c/Content/content-image-1563345710096.png //192.168.7.11 總電 //192.168.7.12 UPS不斷電系統 //192.168.7.13 冷氣 --- 有時間再增加的功能: loading 動畫: https://ankurk91.github.io/vue-loading-overlay/ https://www.npmjs.com/package/vue-loading-overlay 感恩咖咖 https://codepen.io/gon790219/pen/bGLYBxN?editors=0010 https://blog.51cto.com/u_15127583/3441226 ![](https://i.imgur.com/1E4z7eM.png) https://codepen.io/pei-chi-tsai/pen/YzeEdyq https://blog.csdn.net/m0_49159526/article/details/117919606 ![](https://i.imgur.com/PU94Vu7.png)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully