Skip to content

Commit a9b83b0

Browse files
Revert "ChartJS: manual addition of data changes color for existing values"
This reverts commit 3ad20ba.
1 parent 3ad20ba commit a9b83b0

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

classes/Visualizer/Module/Utility.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,8 @@ private static function set_defaults_chartjs( $chart, $post_status ) {
214214
// fall through.
215215
case 'bar':
216216
for ( $i = 0; $i < $max; $i++ ) {
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-
}
217+
$colors = self::get_random_color();
218+
$attributes[] = array( 'backgroundColor' => $colors[0], 'hoverBackgroundColor' => $colors[1] );
223219
}
224220
break;
225221
case 'radar':
@@ -228,12 +224,8 @@ private static function set_defaults_chartjs( $chart, $post_status ) {
228224
// fall through.
229225
case 'area':
230226
for ( $i = 0; $i < $max; $i++ ) {
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-
}
227+
$colors = self::get_random_color();
228+
$attributes[] = array( 'borderColor' => $colors[0] );
237229
}
238230
break;
239231
}

0 commit comments

Comments
 (0)