[d.label, d.data[10]])));'; $f = tempnam(sys_get_temp_dir(), 'zmchart'); file_put_contents($f, $js); $out = trim(shell_exec('node '.escapeshellarg($f).' 2>&1')); unlink($f); $rows = json_decode($out, true); check('two years of the same calendar day make two lines', is_array($rows) ? count($rows) : $out, 2); check('each line holds only its own year', is_array($rows) ? array_column($rows, 1) : null, array(600, 300)); echo $failures ? "\n$failures failed\n" : "\nall passed\n"; exit($failures ? 1 : 0);