Created
March 17, 2019 02:47
-
-
Save deptno/c660bf907e813a740c4af9a736f68ae1 to your computer and use it in GitHub Desktop.
frappe chart
This file contains 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 dataSelectHandler = (data) => { | |
console.log('data', data) | |
} | |
const graph = new Chart(ref.current, { | |
data : { | |
labels : Array(30).fill(0).map((_, i) => i + 1 + ''), | |
datasets: [ | |
{ | |
values, | |
chartType: 'line', | |
}, | |
{ | |
values: values.map((x, i, a) => x + a | |
.slice(0, i) | |
.reduce((acc, curr) => acc + curr, 0)) | |
} | |
], | |
yMarkers: [{ label: '평균', value: values.reduce((acc, curr) => (acc + curr), 0) / 30}], | |
yRegions: [{ label: "상위20%", start: 6000, end: 9000 }] | |
}, | |
type: 'line', | |
colors: ['light-green', 'magenta'], | |
barOptions: { | |
spaceRatio: 0.3, | |
}, | |
lineOptions: { | |
dotSize: 6 | |
}, | |
axisOptions: { | |
xIsSeries: true | |
}, | |
isNavigable: true, | |
valuesOverPoints: true | |
}) | |
graph.parent.addEventListener('data-select', dataSelectHandler) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment