Skip to content
Snippets Groups Projects
Commit 43641228 authored by syuilo's avatar syuilo
Browse files

feat(pages): Improve chart

parent 3b6dbd6d
No related branches found
No related tags found
No related merge requests found
...@@ -87,13 +87,13 @@ export class ASEvaluator { ...@@ -87,13 +87,13 @@ export class ASEvaluator {
data: { data: {
labels: opts.value.get('labels').value.map(x => x.value), labels: opts.value.get('labels').value.map(x => x.value),
datasets: opts.value.get('datasets').value.map(x => ({ 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), data: x.value.get('data').value.map(x => x.value),
pointRadius: 0, pointRadius: 0,
lineTension: 0, lineTension: 0,
borderWidth: 2, borderWidth: 2,
borderColor: color, borderColor: x.value.has('color') ? x.value.get('color') : color,
backgroundColor: tinycolor(color).setAlpha(0.1).toRgbString(), backgroundColor: tinycolor(x.value.has('color') ? x.value.get('color') : color).setAlpha(0.1).toRgbString(),
})) }))
}, },
options: { options: {
...@@ -111,6 +111,7 @@ export class ASEvaluator { ...@@ -111,6 +111,7 @@ export class ASEvaluator {
} }
}, },
legend: { legend: {
display: opts.value.get('datasets').value.filter(x => x.value.has('label') && x.value.get('label').value).length === 0 ? false : true,
position: 'bottom', position: 'bottom',
labels: { labels: {
boxWidth: 16, boxWidth: 16,
...@@ -121,7 +122,22 @@ export class ASEvaluator { ...@@ -121,7 +122,22 @@ export class ASEvaluator {
}, },
chartArea: { chartArea: {
backgroundColor: '#fff' 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
}
}]
}
})
} }
}); });
}), }),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment