mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-12-24 20:33:09 +02:00
feat(pages): Improve chart
This commit is contained in:
parent
3b6dbd6dc3
commit
4364122804
1 changed files with 20 additions and 4 deletions
|
@ -87,13 +87,13 @@ export class ASEvaluator {
|
|||
data: {
|
||||
labels: opts.value.get('labels').value.map(x => x.value),
|
||||
datasets: opts.value.get('datasets').value.map(x => ({
|
||||
label: x.value.get('label').value,
|
||||
label: x.value.has('label') ? x.value.get('label').value : '',
|
||||
data: x.value.get('data').value.map(x => x.value),
|
||||
pointRadius: 0,
|
||||
lineTension: 0,
|
||||
borderWidth: 2,
|
||||
borderColor: color,
|
||||
backgroundColor: tinycolor(color).setAlpha(0.1).toRgbString(),
|
||||
borderColor: x.value.has('color') ? x.value.get('color') : color,
|
||||
backgroundColor: tinycolor(x.value.has('color') ? x.value.get('color') : color).setAlpha(0.1).toRgbString(),
|
||||
}))
|
||||
},
|
||||
options: {
|
||||
|
@ -111,6 +111,7 @@ export class ASEvaluator {
|
|||
}
|
||||
},
|
||||
legend: {
|
||||
display: opts.value.get('datasets').value.filter(x => x.value.has('label') && x.value.get('label').value).length === 0 ? false : true,
|
||||
position: 'bottom',
|
||||
labels: {
|
||||
boxWidth: 16,
|
||||
|
@ -121,8 +122,23 @@ export class ASEvaluator {
|
|||
},
|
||||
chartArea: {
|
||||
backgroundColor: '#fff'
|
||||
},
|
||||
...(opts.value.get('type').value === 'rader' ? {
|
||||
scale: {
|
||||
ticks: {
|
||||
beginAtZero: opts.value.has('begin_at_zero') ? opts.value.get('begin_at_zero') : false
|
||||
}
|
||||
}
|
||||
} : {
|
||||
scales: {
|
||||
yAxes: [{
|
||||
ticks: {
|
||||
beginAtZero: opts.value.has('begin_at_zero') ? opts.value.get('begin_at_zero') : false
|
||||
}
|
||||
}]
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
}),
|
||||
}}, {
|
||||
|
|
Loading…
Reference in a new issue