> $series Metrics to draw: metric, label, class. * @var string $title Figure heading. * @var string $id Unique id stem for this figure. */ use AdPix\Analytics\View\Chart; use AdPix\Analytics\View\Format; defined( 'ABSPATH' ) || exit; $adpix_labels = $report->labels(); $adpix_count = count( $adpix_labels ); /* * One axis for every line. Three series on three scales would let a flat line above a rising one * suggest the opposite of what happened, so they share the largest of the three peaks. */ $adpix_peak = 0.0; foreach ( $series as $adpix_line ) { $adpix_peak = max( $adpix_peak, $report->peak( $adpix_line['metric'] ) ); } $adpix_max = Chart::nice_max( $adpix_peak ); $adpix_ticks = array_reverse( Chart::ticks( $adpix_max, 4 ) ); $adpix_plots = array(); foreach ( $series as $adpix_line ) { $adpix_plots[] = $adpix_line + array( 'plot' => Chart::line( $report->series( $adpix_line['metric'] ), 100.0, 100.0, $adpix_max ) ); } $adpix_primary = $adpix_plots[0] ?? null; // Five dates along the bottom at most: past that they collide on a phone and stop being readable. $adpix_stride = $adpix_count > 5 ? (int) ceil( $adpix_count / 5 ) : 1; $adpix_gradient = $id . '-fill'; $adpix_described = $id . '-summary'; ?>

total( $adpix_primary['metric'] ) : 0.0 ) ), esc_html( Format::date( $report->meta( 'start' ) ) ), esc_html( Format::date( $report->meta( 'end' ) ) ) ); ?>

1 ? 100 / ( $adpix_count - 1 ) : 100; ?> $adpix_day ) : ?>
$adpix_day ) : ?>