Skip to content

Commit

Permalink
Revert "chore: added no data in time series chart"
Browse files Browse the repository at this point in the history
This reverts commit 372e086.
  • Loading branch information
claustres committed Aug 30, 2024
1 parent 1823295 commit 308fe93
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 16 deletions.
13 changes: 1 addition & 12 deletions core/client/components/chart/KTimeSeriesChart.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
<template>
<div class="fit">
<canvas v-show="hasChart" :ref="onCanvasRef" />
<div v-show="!hasChart" class="fit">
<slot name="empty-time-series">
<KStamp class="absolute-center" icon="las la-exclamation-circle" icon-size="3rem"
:text="$t('KTimeSeriesChart.NO_DATA_AVAILABLE')" text-size="1rem"/>
</slot>
</div>
<canvas :ref="onCanvasRef" />
</div>
</template>

Expand Down Expand Up @@ -52,7 +46,6 @@ const emit = defineEmits(['zoom-start', 'zoom-end', 'legend-click'])
// Data
let canvas = null
let chart = null
let hasChart = ref(false)
const unit2axis = new Map()
const startTime = ref(props.startTime ? moment.utc(props.startTime) : null)
const endTime = ref(props.endTime ? moment.utc(props.endTime) : null)
Expand All @@ -79,13 +72,11 @@ async function onCanvasRef (ref) {
const config = await makeChartConfig()
if (!config) return
chart = new Chart(ref.getContext('2d'), config)
hasChart.value = true
}
} else {
if (chart) {
chart.destroy()
chart = null
hasChart.value = false
}
}
canvas = ref
Expand Down Expand Up @@ -424,12 +415,10 @@ async function update () {
if (!config) {
if (chart) chart.destroy()
chart = null
hasChart.value = false
return
}
if (!chart) {
chart = new Chart(canvas.getContext('2d'), config)
hasChart.value = true
} else {
Object.assign(chart, config)
chart.update()
Expand Down
3 changes: 1 addition & 2 deletions core/client/i18n/core_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -896,8 +896,7 @@
"KTimeSeriesChart": {
"TIME_LABEL": "Time",
"EXPORT_SERIES": "Export series",
"SERIES_EXPORT_FILE": "Series.csv",
"NO_DATA_AVAILABLE": "No data available"
"SERIES_EXPORT_FILE": "Series.csv"
},
"KFilter": {
"SEARCH_LABEL": "Search"
Expand Down
3 changes: 1 addition & 2 deletions core/client/i18n/core_fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -895,8 +895,7 @@
"KTimeSeriesChart": {
"TIME_LABEL": "Temps",
"EXPORT_SERIES": "Exporter les données",
"SERIES_EXPORT_FILE": "Series.csv",
"NO_DATA_AVAILABLE": "Aucune donnée disponible"
"SERIES_EXPORT_FILE": "Series.csv"
},
"KFilter": {
"SEARCH_LABEL": "Rechercher"
Expand Down

0 comments on commit 308fe93

Please sign in to comment.