This commit is contained in:
2022-02-25 19:30:04 +00:00
parent ccd3c0a6b9
commit 96a878ebe7
2 changed files with 67 additions and 3 deletions

View File

@@ -9,8 +9,27 @@
v-on="$listeners" v-on="$listeners"
> >
<template slot="main"> <template slot="main">
{{ settings }} <div>
<!-- <gz-chart-line
:width="400"
:height="240"
:chart-data="obj"
:options="{
responsive: true,
maintainAspectRatio: false,
legend: { display: false }
}"
></gz-chart-line> -->
<gz-chart-line
:width="400"
:height="240"
:chart-data="chartData"
:options="timeLineChartOptions"
/>
</div>
</template> </template>
<template slot="settings"> <template slot="settings">
<div></div> <div></div>
<v-col v-if="context" cols="12"> <v-col v-if="context" cols="12">
@@ -71,6 +90,7 @@
</template> </template>
<script> <script>
import GzDash from "./dash-base.vue"; import GzDash from "./dash-base.vue";
import Palette from "../api/palette";
export default { export default {
components: { components: {
GzDash GzDash
@@ -87,10 +107,52 @@ export default {
dateFilterTokens: [], dateFilterTokens: [],
tagFilterOperators: [], tagFilterOperators: [],
units: [] units: []
},
timeLineChartOptions: {
responsive: true,
maintainAspectRatio: false,
// legend: { display: false },
scales: {
xAxes: [
{
type: "time",
gridLines: {
drawOnChartArea: false
}
}
],
yAxes: [
{
gridLines: {
drawOnChartArea: false
},
ticks: {
beginAtZero: true
}
}
]
}
} }
}; };
}, },
computed: {}, computed: {
chartData() {
return {
datasets: [
{
label: this.$ay.t("BillableHours"),
borderColor: Palette.color.soft_deep_blue,
backgroundColor: Palette.color.soft_deep_blue,
fill: false,
radius: 0,
hoverRadius: 10,
hitRadius: 4,
data: this.obj
}
]
};
}
},
async created() { async created() {
await initWidget(this); await initWidget(this);
}, },
@@ -111,6 +173,7 @@ export default {
this.settings.unit = this.localSettings.unit; this.settings.unit = this.localSettings.unit;
this.$emit("dash-change"); this.$emit("dash-change");
this.context = false; this.context = false;
this.getDataFromApi();
}, },
async getDataFromApi() { async getDataFromApi() {
@@ -177,6 +240,7 @@ ORDER BY timeframe ASC
this.errorMessage = res.error; this.errorMessage = res.error;
} else { } else {
console.log(res); console.log(res);
this.obj = res.data;
} }
} catch (error) { } catch (error) {
this.errorMessage = error.toString(); this.errorMessage = error.toString();

View File

@@ -2,7 +2,7 @@
<div> <div>
<v-row v-if="formState.ready"> <v-row v-if="formState.ready">
<gz-error :error-box-message="formState.errorBoxMessage"></gz-error> <gz-error :error-box-message="formState.errorBoxMessage"></gz-error>
{{ effectiveView }}
<v-col v-if="showSelector" cols="12"> <v-col v-if="showSelector" cols="12">
<v-dialog <v-dialog
v-model="showSelector" v-model="showSelector"