public function addLegend($name, $parent, $position = self::POSITION_AFTER, $hide = false)
{
$this->validatePosition($position);
$this->legends[] = ['name' => $name, 'parents' => (array) $parent, 'position' => $position, 'hide' => (bool) $hide];
return $this;
}