File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,8 @@ function sqlpage_chart() {
35
35
for ( const c of document . querySelectorAll ( "[data-pre-init=chart]" ) ) {
36
36
try {
37
37
const data = JSON . parse ( c . querySelector ( "data" ) . innerText ) ;
38
+ const chartContainer = c . querySelector ( '.chart' ) ;
39
+ chartContainer . innerHTML = "" ;
38
40
const is_timeseries = ! ! data . time ;
39
41
/** @type { Series } */
40
42
const series_map = { } ;
@@ -71,7 +73,7 @@ function sqlpage_chart() {
71
73
type : data . type || 'line' ,
72
74
fontFamily : 'inherit' ,
73
75
parentHeightOffset : 0 ,
74
- height : c . style . height ,
76
+ height : chartContainer . style . height ,
75
77
stacked : ! ! data . stacked ,
76
78
toolbar : {
77
79
show : ! ! data . toolbar ,
@@ -143,8 +145,7 @@ function sqlpage_chart() {
143
145
series,
144
146
} ;
145
147
if ( labels ) options . labels = labels ;
146
- c . innerHTML = "" ;
147
- const chart = new ApexCharts ( c , options ) ;
148
+ const chart = new ApexCharts ( chartContainer , options ) ;
148
149
chart . render ( ) ;
149
150
if ( window . charts ) window . charts . push ( chart ) ;
150
151
else window . charts = [ chart ] ;
Original file line number Diff line number Diff line change 3
3
class =" card my-2 {{ class }} "
4
4
data-pre-init =" chart"
5
5
data-js =" /{{ static_path ' apexcharts.js' }} "
6
- style =" height: {{ default height 250 }} px;"
7
6
>
8
7
<div class =" card-body" >
9
8
<div class =" d-flex" >
10
9
<h3 class =" card-title" >{{ title }} </h3 >
11
10
</div >
12
- <div class =" chart" >
11
+ <div class =" chart" style = " height: {{ default height 250 }} px; " >
13
12
<div class =" d-flex justify-content-center h-100 align-items-center" >
14
13
<div class =" spinner-border" role =" status" style =" width: 3rem; height: 3rem;" >
15
14
<span class =" visually-hidden" >Loading...</span >
You can’t perform that action at this time.
0 commit comments