bfg-common 1.5.315 → 1.5.316
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,120 +1,120 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<common-graph-graph-new
|
|
3
|
-
v-if="isNewView"
|
|
4
|
-
:chart-options="chartOptions"
|
|
5
|
-
@select-item="onSelectNewViewExportItem"
|
|
6
|
-
/>
|
|
7
|
-
<common-graph-old v-else :chart-options="chartOptions" />
|
|
8
|
-
</template>
|
|
9
|
-
|
|
10
|
-
<script setup lang="ts">
|
|
11
|
-
import type {
|
|
12
|
-
I_LineGraph,
|
|
13
|
-
I_DiskGraph,
|
|
14
|
-
} from 'bfg-nuxt-3-graph/graph/lib/models/interfaces'
|
|
15
|
-
|
|
16
|
-
const props = defineProps<{
|
|
17
|
-
chart?: any
|
|
18
|
-
data: I_LineGraph | I_DiskGraph
|
|
19
|
-
update: number
|
|
20
|
-
exportType?: string
|
|
21
|
-
selectedRow?: number[]
|
|
22
|
-
}>()
|
|
23
|
-
|
|
24
|
-
const { $store }: any = useNuxtApp()
|
|
25
|
-
const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
|
|
26
|
-
|
|
27
|
-
let localChart: any = null
|
|
28
|
-
const exportChart = (type: string): void => {
|
|
29
|
-
if (type === 'png') {
|
|
30
|
-
localChart.
|
|
31
|
-
type: 'image/png',
|
|
32
|
-
})
|
|
33
|
-
} else if (type === 'jpeg') {
|
|
34
|
-
localChart.
|
|
35
|
-
type: 'image/jpeg',
|
|
36
|
-
})
|
|
37
|
-
} else if (type === 'svg') {
|
|
38
|
-
localChart.
|
|
39
|
-
type: 'image/svg+xml',
|
|
40
|
-
})
|
|
41
|
-
} else if (type === 'csv') {
|
|
42
|
-
localChart.downloadCSV()
|
|
43
|
-
} else if (type === 'print') {
|
|
44
|
-
localChart.print()
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const onSelectNewViewExportItem = (value: string): void => {
|
|
49
|
-
switch (value) {
|
|
50
|
-
case 'downloadPNG':
|
|
51
|
-
exportChart('png')
|
|
52
|
-
break
|
|
53
|
-
case 'downloadJPEG':
|
|
54
|
-
exportChart('jpeg')
|
|
55
|
-
break
|
|
56
|
-
case 'downloadSVG':
|
|
57
|
-
exportChart('svg')
|
|
58
|
-
break
|
|
59
|
-
case 'downloadCSV':
|
|
60
|
-
exportChart('csv')
|
|
61
|
-
break
|
|
62
|
-
case 'printChart':
|
|
63
|
-
exportChart('print')
|
|
64
|
-
break
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const chartOptions = ref<I_LineGraph | I_DiskGraph | null>(null)
|
|
69
|
-
const initGraph = (): void => {
|
|
70
|
-
if (!props.data) return
|
|
71
|
-
setTimeout(() => {
|
|
72
|
-
chartOptions.value = props.data
|
|
73
|
-
}, 500)
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
watch(
|
|
77
|
-
() => props.update,
|
|
78
|
-
(newValue) => {
|
|
79
|
-
newValue && initGraph()
|
|
80
|
-
},
|
|
81
|
-
{ immediate: true }
|
|
82
|
-
)
|
|
83
|
-
|
|
84
|
-
watch(
|
|
85
|
-
() => props.exportType,
|
|
86
|
-
(newValue) => {
|
|
87
|
-
if (!newValue) return
|
|
88
|
-
|
|
89
|
-
exportChart(newValue)
|
|
90
|
-
}
|
|
91
|
-
)
|
|
92
|
-
|
|
93
|
-
watch(
|
|
94
|
-
() => props.chart,
|
|
95
|
-
(newValue) => {
|
|
96
|
-
if (newValue && newValue.series) localChart = newValue
|
|
97
|
-
},
|
|
98
|
-
{ deep: true }
|
|
99
|
-
)
|
|
100
|
-
|
|
101
|
-
const updateSeriesStrokeWidth = (data: number[]): void => {
|
|
102
|
-
if (!localChart) return
|
|
103
|
-
|
|
104
|
-
const newChartOptions = chartOptions.value
|
|
105
|
-
newChartOptions.series.forEach((_: any, key: number) => {
|
|
106
|
-
newChartOptions.series[key].lineWidth = 1.5
|
|
107
|
-
|
|
108
|
-
if (data.includes(key)) newChartOptions.series[key].lineWidth = 3
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
chartOptions.value = newChartOptions
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
watch(
|
|
115
|
-
() => props.selectedRow,
|
|
116
|
-
(newValue) => newValue && updateSeriesStrokeWidth(newValue)
|
|
117
|
-
)
|
|
118
|
-
</script>
|
|
119
|
-
|
|
120
|
-
<style scoped lang="scss"></style>
|
|
1
|
+
<template>
|
|
2
|
+
<common-graph-graph-new
|
|
3
|
+
v-if="isNewView"
|
|
4
|
+
:chart-options="chartOptions"
|
|
5
|
+
@select-item="onSelectNewViewExportItem"
|
|
6
|
+
/>
|
|
7
|
+
<common-graph-old v-else :chart-options="chartOptions" />
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup lang="ts">
|
|
11
|
+
import type {
|
|
12
|
+
I_LineGraph,
|
|
13
|
+
I_DiskGraph,
|
|
14
|
+
} from 'bfg-nuxt-3-graph/graph/lib/models/interfaces'
|
|
15
|
+
|
|
16
|
+
const props = defineProps<{
|
|
17
|
+
chart?: any
|
|
18
|
+
data: I_LineGraph | I_DiskGraph
|
|
19
|
+
update: number
|
|
20
|
+
exportType?: string
|
|
21
|
+
selectedRow?: number[]
|
|
22
|
+
}>()
|
|
23
|
+
|
|
24
|
+
const { $store }: any = useNuxtApp()
|
|
25
|
+
const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
|
|
26
|
+
|
|
27
|
+
let localChart: any = null
|
|
28
|
+
const exportChart = (type: string): void => {
|
|
29
|
+
if (type === 'png') {
|
|
30
|
+
localChart.exportChartLocal({
|
|
31
|
+
type: 'image/png',
|
|
32
|
+
})
|
|
33
|
+
} else if (type === 'jpeg') {
|
|
34
|
+
localChart.exportChartLocal({
|
|
35
|
+
type: 'image/jpeg',
|
|
36
|
+
})
|
|
37
|
+
} else if (type === 'svg') {
|
|
38
|
+
localChart.exportChartLocal({
|
|
39
|
+
type: 'image/svg+xml',
|
|
40
|
+
})
|
|
41
|
+
} else if (type === 'csv') {
|
|
42
|
+
localChart.downloadCSV()
|
|
43
|
+
} else if (type === 'print') {
|
|
44
|
+
localChart.print()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const onSelectNewViewExportItem = (value: string): void => {
|
|
49
|
+
switch (value) {
|
|
50
|
+
case 'downloadPNG':
|
|
51
|
+
exportChart('png')
|
|
52
|
+
break
|
|
53
|
+
case 'downloadJPEG':
|
|
54
|
+
exportChart('jpeg')
|
|
55
|
+
break
|
|
56
|
+
case 'downloadSVG':
|
|
57
|
+
exportChart('svg')
|
|
58
|
+
break
|
|
59
|
+
case 'downloadCSV':
|
|
60
|
+
exportChart('csv')
|
|
61
|
+
break
|
|
62
|
+
case 'printChart':
|
|
63
|
+
exportChart('print')
|
|
64
|
+
break
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const chartOptions = ref<I_LineGraph | I_DiskGraph | null>(null)
|
|
69
|
+
const initGraph = (): void => {
|
|
70
|
+
if (!props.data) return
|
|
71
|
+
setTimeout(() => {
|
|
72
|
+
chartOptions.value = props.data
|
|
73
|
+
}, 500)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
watch(
|
|
77
|
+
() => props.update,
|
|
78
|
+
(newValue) => {
|
|
79
|
+
newValue && initGraph()
|
|
80
|
+
},
|
|
81
|
+
{ immediate: true }
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
watch(
|
|
85
|
+
() => props.exportType,
|
|
86
|
+
(newValue) => {
|
|
87
|
+
if (!newValue) return
|
|
88
|
+
|
|
89
|
+
exportChart(newValue)
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
watch(
|
|
94
|
+
() => props.chart,
|
|
95
|
+
(newValue) => {
|
|
96
|
+
if (newValue && newValue.series) localChart = newValue
|
|
97
|
+
},
|
|
98
|
+
{ deep: true }
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
const updateSeriesStrokeWidth = (data: number[]): void => {
|
|
102
|
+
if (!localChart) return
|
|
103
|
+
|
|
104
|
+
const newChartOptions = chartOptions.value
|
|
105
|
+
newChartOptions.series.forEach((_: any, key: number) => {
|
|
106
|
+
newChartOptions.series[key].lineWidth = 1.5
|
|
107
|
+
|
|
108
|
+
if (data.includes(key)) newChartOptions.series[key].lineWidth = 3
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
chartOptions.value = newChartOptions
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
watch(
|
|
115
|
+
() => props.selectedRow,
|
|
116
|
+
(newValue) => newValue && updateSeriesStrokeWidth(newValue)
|
|
117
|
+
)
|
|
118
|
+
</script>
|
|
119
|
+
|
|
120
|
+
<style scoped lang="scss"></style>
|
|
@@ -1,61 +1,50 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :class="['graph-content', ...hiddenButtons]">
|
|
3
|
-
<template v-if="props.chartOptions">
|
|
4
|
-
<client-only>
|
|
5
|
-
<highchart
|
|
6
|
-
:options="props.chartOptions"
|
|
7
|
-
:modules="
|
|
8
|
-
class="graph-block"
|
|
9
|
-
/>
|
|
10
|
-
</client-only>
|
|
11
|
-
</template>
|
|
12
|
-
</div>
|
|
13
|
-
</template>
|
|
14
|
-
|
|
15
|
-
<script setup lang="ts">
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
:deep(.highcharts-menu) {
|
|
52
|
-
.highcharts-menu-item:first-child {
|
|
53
|
-
display: none;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
.graph-block {
|
|
58
|
-
height: 100%;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="['graph-content', ...hiddenButtons]">
|
|
3
|
+
<template v-if="props.chartOptions">
|
|
4
|
+
<client-only>
|
|
5
|
+
<highchart
|
|
6
|
+
:options="props.chartOptions"
|
|
7
|
+
:modules="['exporting', 'export-data', 'offline-exporting']"
|
|
8
|
+
class="graph-block"
|
|
9
|
+
/>
|
|
10
|
+
</client-only>
|
|
11
|
+
</template>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script setup lang="ts">
|
|
16
|
+
const props = defineProps<{
|
|
17
|
+
chartOptions: any
|
|
18
|
+
}>()
|
|
19
|
+
|
|
20
|
+
const hiddenButtons = computed<string[]>(() => {
|
|
21
|
+
const result = []
|
|
22
|
+
const chartOptions = props.chartOptions
|
|
23
|
+
if (chartOptions) {
|
|
24
|
+
const { openNewWindow } = chartOptions.exporting.menuItemDefinitions || {}
|
|
25
|
+
|
|
26
|
+
if (openNewWindow.isHide) result.push('hide-new-window')
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return result
|
|
30
|
+
})
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<style scoped lang="scss">
|
|
34
|
+
.graph-content {
|
|
35
|
+
width: 100%;
|
|
36
|
+
//height: inherit;
|
|
37
|
+
height: 100%;
|
|
38
|
+
|
|
39
|
+
&.hide-new-window {
|
|
40
|
+
:deep(.highcharts-menu) {
|
|
41
|
+
.highcharts-menu-item:first-child {
|
|
42
|
+
display: none;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
.graph-block {
|
|
47
|
+
height: 100%;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
</style>
|