Created
February 14, 2019 20:51
-
-
Save VhMuzini/a5f27cc4a7136b8727b248e1ee30ab00 to your computer and use it in GitHub Desktop.
Chart Annotation Sample
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
import 'chartjs-plugin-annotation'; | |
static chartOptions() { | |
const options: any = { | |
responsive: true, | |
title: { | |
display: true, | |
text: '' | |
}, | |
scales: { | |
yAxes: [{ | |
type: 'linear', | |
scaleLabel: { | |
display: true, | |
labelString: '', | |
} | |
}], | |
xAxes: [{ | |
scaleLabel: { | |
display: true, | |
labelString: 'Past Seven Days of Update' | |
} | |
}] | |
}, | |
annotation: { | |
annotations: [{ | |
// Horizontal Line | |
type: 'line', | |
mode: 'horizontal', | |
scaleID: 'y-axis-0', | |
value: 3, | |
borderColor: 'rgb(40, 167, 69)', | |
borderWidth: 2, | |
label: { | |
enabled: true, | |
content: 'Y Label' | |
} | |
}, | |
{ | |
// Vertical Line | |
type: 'line', | |
mode: 'vertical', | |
scaleID: 'x-axis-0', | |
value: 7, | |
borderColor: 'rgb(58, 167, 69)', | |
borderWidth: 2, | |
label: { | |
enabled: true, | |
content: 'X Label' | |
} | |
} | |
] | |
} | |
}; | |
return options; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment