public function applyToString($palette, $skipLegends = false)
{
$config = $this->explode($palette);
if (!$skipLegends) {
foreach ($this->legends as $legend) {
$this->applyLegend($config, $legend);
}
}
// Make sure there is at least one legend
if (0 === count($config)) {
$config = [['fields' => [], 'hide' => false]];
}
foreach ($this->fields as $field) {
$this->applyField($config, $field, $skipLegends);
}
return $this->implode($config);
}