Pass options correctly to chart.js on articles#stats (#17435)
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
This commit is contained in:
parent
f4e0944bb0
commit
275cdadb60
1 changed files with 16 additions and 18 deletions
|
|
@ -45,15 +45,23 @@ function writeCards(data, timeRangeLabel) {
|
|||
}
|
||||
|
||||
function drawChart({ id, showPoints = true, title, labels, datasets }) {
|
||||
const chartOptions = showPoints
|
||||
? {}
|
||||
: {
|
||||
elements: {
|
||||
point: {
|
||||
radius: 0,
|
||||
},
|
||||
const chartOptions = {
|
||||
elements: {
|
||||
point: {
|
||||
// The default is 3: https://www.chartjs.org/docs/latest/configuration/elements.html#point-configuration
|
||||
radius: showPoints ? 3 : 0,
|
||||
},
|
||||
},
|
||||
scales: {
|
||||
y: {
|
||||
type: 'linear',
|
||||
suggestedMin: 0,
|
||||
ticks: {
|
||||
precision: 0,
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
};
|
||||
const dataOptions = {
|
||||
plugins: {
|
||||
legend: {
|
||||
|
|
@ -65,16 +73,6 @@ function drawChart({ id, showPoints = true, title, labels, datasets }) {
|
|||
display: true,
|
||||
text: title,
|
||||
},
|
||||
scales: {
|
||||
y: {
|
||||
type: 'linear',
|
||||
suggestedMin: 0,
|
||||
|
||||
ticks: {
|
||||
precision: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
import('chart.js').then(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue