<?php
include "$_SERVER[DOCUMENT_ROOT]/root.class.php";
include "$_SERVER[DOCUMENT_ROOT]/app/team_dashboard/classes/team_dashboard.class.php";
$db = new db_safeguard();
$team = new TeamDashboard($db);

$team_id = intval($_GET['team_id']);

// Keys match the LIKE prefix in metersByType()
// Values are the chart labels returned to JS
$categories = [
    'RIEMING'  => ['REIMING_PAUSE','REIMING_STOP'],
    'DRILLING' => ['DRILLING_PAUSE','DRILLING_STOP'],
    'CASING'   => ['CASING_PAUSE','CASING_STOP'],
    'BLASTING' => ['BLASTING_PAUSE','BLASTING_STOP'],
];

$data = [];
foreach ($categories as $prefix => $label) {
    $data[] = $team->metersByType($team_id, $prefix);
}

// Returns: 120,340,80,200  (4 values matching the 4 chart labels)
echo implode(",", $data);