Created
March 17, 2020 23:00
-
-
Save typpo/ac818236e1f5da8ba76764b357afdffa to your computer and use it in GitHub Desktop.
Build a chart.js config as a string
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
const chartStr = `{ | |
type: 'bar', | |
data: { | |
labels: ['January', 'February', 'March', 'April', 'May'], | |
datasets: [{ | |
label: 'Dogs', | |
data: [ 50, 60, 70, 180, 190 ] | |
}] | |
}, | |
options: { | |
scales: { | |
yAxes: [{ | |
ticks: { | |
callback: function(value) { | |
return '$' + value; | |
} | |
} | |
}], | |
}, | |
}, | |
}`; | |
console.log(encodeURIComponent(chartStr)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment