@@ -141,10 +141,9 @@ const loadData = (data) => {
141
141
} ;
142
142
143
143
const createChart = ( gradesData ) => {
144
-
145
144
const cardBgColor = getComputedStyle ( document . body )
146
- . getPropertyValue ( "--card-background-color" )
147
- . trim ( ) ;
145
+ . getPropertyValue ( "--card-background-color" )
146
+ . trim ( ) ;
148
147
149
148
const chartData = {
150
149
datasets : [
@@ -249,24 +248,24 @@ const createChart = (gradesData) => {
249
248
Chart . register ( ChartDataLabels ) ;
250
249
251
250
// Set up a MutationObserver to update chart borderColor when the body class changes.
252
- const observer = new MutationObserver ( ( mutationsList ) => {
253
- for ( const mutation of mutationsList ) {
254
- if ( mutation . attributeName === "class" ) {
255
- updateChartBorderColor ( ) ;
251
+ const observer = new MutationObserver ( ( mutationsList ) => {
252
+ for ( const mutation of mutationsList ) {
253
+ if ( mutation . attributeName === "class" ) {
254
+ updateChartBorderColor ( ) ;
255
+ }
256
256
}
257
- }
258
- } ) ;
259
- observer . observe ( document . body , { attributes : true } ) ;
257
+ } ) ;
258
+ observer . observe ( document . body , { attributes : true } ) ;
260
259
261
- function updateChartBorderColor ( ) {
262
- const newCardBgColor = getComputedStyle ( document . body )
263
- . getPropertyValue ( "--card-background-color" )
264
- . trim ( ) ;
265
- if ( myChart && myChart . config . data . datasets [ 0 ] ) {
266
- myChart . config . data . datasets [ 0 ] . borderColor = newCardBgColor ;
267
- myChart . update ( { duration : 0 } ) ;
260
+ function updateChartBorderColor ( ) {
261
+ const newCardBgColor = getComputedStyle ( document . body )
262
+ . getPropertyValue ( "--card-background-color" )
263
+ . trim ( ) ;
264
+ if ( myChart && myChart . config . data . datasets [ 0 ] ) {
265
+ myChart . config . data . datasets [ 0 ] . borderColor = newCardBgColor ;
266
+ myChart . update ( { duration : 0 } ) ;
267
+ }
268
268
}
269
- }
270
269
// Generate configuration for Pie Chart
271
270
pieConfig = {
272
271
type : "doughnut" ,
0 commit comments