Skip to content

Commit 9fb60f9

Browse files
bug with refreshing live data
1 parent 176b7d3 commit 9fb60f9

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

classes/Visualizer/Source/Json.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,20 @@ private function connect( $url ) {
430430
public function refresh( $series ) {
431431
$this->_series = $series;
432432
$this->fetch();
433+
434+
$headers = wp_list_pluck( $this->_series, 'label' );
435+
$data = array();
436+
foreach ( $this->_data as $line ) {
437+
$data_row = array();
438+
foreach ( $line as $header => $value ) {
439+
// phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
440+
if ( in_array( $header, $headers ) ) {
441+
$data_row[] = $value;
442+
}
443+
}
444+
$data[] = $this->_normalizeData( $data_row );
445+
}
446+
$this->_data = $data;
433447
return true;
434448
}
435449

0 commit comments

Comments
 (0)