File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
classes/Visualizer/Module Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -214,8 +214,12 @@ private static function set_defaults_chartjs( $chart, $post_status ) {
214
214
// fall through.
215
215
case 'bar ' :
216
216
for ( $ i = 0 ; $ i < $ max ; $ i ++ ) {
217
- $ colors = self ::get_random_color ();
218
- $ attributes [] = array ( 'backgroundColor ' => $ colors [0 ], 'hoverBackgroundColor ' => $ colors [1 ] );
217
+ if ( isset ( $ settings [ $ name ][ $ i ]['backgroundColor ' ] ) && ! empty ( $ settings [ $ name ][ $ i ]['backgroundColor ' ] ) ) {
218
+ $ attributes [] = array ( 'backgroundColor ' => $ settings [ $ name ][ $ i ]['backgroundColor ' ], 'hoverBackgroundColor ' => $ settings [ $ name ][ $ i ]['hoverBackgroundColor ' ] );
219
+ } else {
220
+ $ colors = self ::get_random_color ();
221
+ $ attributes [] = array ( 'backgroundColor ' => $ colors [0 ], 'hoverBackgroundColor ' => $ colors [1 ] );
222
+ }
219
223
}
220
224
break ;
221
225
case 'radar ' :
@@ -224,8 +228,12 @@ private static function set_defaults_chartjs( $chart, $post_status ) {
224
228
// fall through.
225
229
case 'area ' :
226
230
for ( $ i = 0 ; $ i < $ max ; $ i ++ ) {
227
- $ colors = self ::get_random_color ();
228
- $ attributes [] = array ( 'borderColor ' => $ colors [0 ] );
231
+ if ( isset ( $ settings [ $ name ][ $ i ]['borderColor ' ] ) && ! empty ( $ settings [ $ name ][ $ i ]['borderColor ' ] ) ) {
232
+ $ attributes [] = array ( 'borderColor ' => $ settings [ $ name ][ $ i ]['borderColor ' ] );
233
+ } else {
234
+ $ colors = self ::get_random_color ();
235
+ $ attributes [] = array ( 'borderColor ' => $ colors [0 ] );
236
+ }
229
237
}
230
238
break ;
231
239
}
You can’t perform that action at this time.
0 commit comments