Combine view and download graphs

This commit is contained in:
2021-12-16 21:20:05 +01:00
parent c5c8d6f8d5
commit 81c8baf639
4 changed files with 223 additions and 116 deletions

View File

@@ -5,12 +5,14 @@ import { Chart, PointElement, LineElement, LinearScale, CategoryScale, LineContr
let chart_element
let chart_object
export let label = "label"
export let dataType = ""
export let data_type = ""
export const chart = () => {
return chart_object
}
export const data = () => {
return chart_object.data
}
export const update = () => {
return chart_object.update()
}
@@ -32,15 +34,8 @@ onMount(() => {
{
type: 'line',
data: {
datasets: [
{
label: label,
borderWidth: 0,
pointRadius: 0,
fill: 'origin',
backgroundColor: "#"+window.style.highlightColor,
}
]
labels: [],
datasets: [],
},
options: {
legend: { display: false },
@@ -57,7 +52,7 @@ onMount(() => {
position: "left",
ticks: {
callback: function (value, index, values) {
if (dataType == "bytes") {
if (data_type == "bytes") {
return formatDataVolume(value, 3);
}
return formatNumber(value, 3);
@@ -88,7 +83,6 @@ onMount(() => {
}
);
})
</script>
<div class="chart-container">