add chart with the features done

This commit is contained in:
Julien Calixte
2023-07-30 01:42:29 +02:00
parent c9409ce861
commit adc5181e14
11 changed files with 111 additions and 22 deletions

View File

@@ -0,0 +1,59 @@
<script setup lang="ts">
import { useSimulationStore } from '@/modules/simulation/simulation-store'
import chartXkcd from 'chart.xkcd'
import { onMounted } from 'vue'
const simulationStore = useSimulationStore()
const reloadGraph = () => {
if (
simulationStore.dashboards.length === 0 ||
simulationStore.dashboards.length > 15
) {
return
}
const svg = document.querySelector('.chart')
const config = {
title: 'Features done per day',
xLabel: 'days',
yLabel: 'features done',
data: {
labels: Array.from(
{
length: Math.max(
...simulationStore.dashboards.map(
(dashboard) => dashboard.meta.totalDays
)
)
},
(_, index) => index + 1
),
datasets: simulationStore.dashboards.map((dashboard, index) => ({
label: `${dashboard.analysis.strategy} ${index + 1}`,
data: dashboard.meta.featuresDonePerDay
}))
},
options: {
showLegend: false
}
}
new chartXkcd.Line(svg, config)
}
// watch(simulationStore.dashboards, reloadGraph)
onMounted(reloadGraph)
</script>
<template>
<div class="simulation-chart">
<svg class="chart"></svg>
</div>
</template>
<style scoped lang="scss">
.chart {
width: 80vw;
height: 100vh;
}
</style>