src/CoreBundle/EventListener/DcGeneral/Table/FilterSetting/SubPaletteSubscriber.php
private function getLegend(PaletteInterface $palette, $legendName)
    {
        if ($palette->hasLegend($legendName)) {
            return $palette->getLegend($legendName);
        }

        $legend = new Legend($legendName);
        $palette->addLegend($legend);

        return $legend;
    }
private function getLegend(PaletteInterface $palette, $legendName)
    {
        if ($palette->hasLegend($legendName)) {
            return $palette->getLegend($legendName);
        }

        $legend = new Legend($legendName);
        $palette->addLegend($legend);

        return $legend;
    }
Get a legend. Create it if not exists.

@param PaletteInterface $palette    The palette.
@param string           $legendName The name of the legend.

@return LegendInterface