[學習筆記]Chart.js更改圖表大小

yurukuma
Feb 15, 2022

Demo

Step 1 HTML結構: 在圖表(canvas)外再包一層

Step 2 將畫圖表的Data options maintainAspectRatio: false

Step 3 用CSS設定圖表的寬高

.chartBlock {    height: 250px;    width: 250px;    margin: 0 auto;}

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

yurukuma
yurukuma

Written by yurukuma

I’m a front-end developer. Let’s learning by doing:)

No responses yet

Write a response