Skip to content
Permalink
Browse files

A few bugfixes.

  • Loading branch information
emrikol committed Dec 15, 2018
1 parent 6c3c763 commit c873c463146623bb95347235687ae99684bd3c88
Showing with 11 additions and 8 deletions.
  1. +11 −8 inc/class-pagegen.php
@@ -65,6 +65,12 @@ public function init_hooks() {
add_action( 'wp_dashboard_setup', array( $this, 'wp_dashboard_setup' ) );
add_action( 'init', array( $this, 'register_cron' ) );
add_action( 'pagegen_purge', array( $this, 'pagegen_purge' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
}
/**
* Registers ChartJS.
*/
public function admin_enqueue_scripts() {
wp_register_script( 'chartjs', 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.3/Chart.min.js', array(), '2.7.3', true );
}

@@ -150,6 +156,11 @@ public function generate_widget() {
);
}

if ( empty( $grand_average ) ) {
echo '<p>No data yet!</p>';
return;
}

wp_enqueue_script( 'chartjs' );
?>

@@ -176,14 +187,6 @@ public function generate_widget() {
type: 'line',
data: {
labels: <?php echo wp_json_encode( $labels ); ?>,
/*datasets: [ {
label: "Average Page Generation Time",
backgroundColor: 'rgb(0, 115, 170)',
borderColor: 'rgb(0, 115, 170)',
cubicInterpolationMode: 'monotone',
fill: false,
data: <?php echo wp_json_encode( $average ); ?>,
} ],*/
datasets: <?php echo wp_json_encode( $datasets ); ?>
},
} );

0 comments on commit c873c46

Please sign in to comment.
You can’t perform that action at this time.