Created
January 4, 2019 06:50
-
-
Save donma/1746c142070722086a107eedfc234c78 to your computer and use it in GitHub Desktop.
Chart.js Line Chart Y Axis Comma Sign
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| options: { | |
| responsive: true, | |
| maintainAspectRatio: false, | |
| scales: { | |
| yAxes: [{ | |
| scaleLabel: { | |
| display: true, | |
| labelString: '垂直軸的資料名稱' | |
| }, | |
| ticks: { | |
| beginAtZero: false, | |
| callback: function (value, index, values) { | |
| return value.toLocaleString(); | |
| } | |
| } | |
| }] | |
| }, | |
| tooltips: { | |
| mode: 'label', | |
| label: 'mylabel', | |
| callbacks: { | |
| label: function (tooltipItem, data) { | |
| return tooltipItem.yLabel.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment