private function getLegendStates()
    {
        $environment  = $this->getEnvironment();
        $definition   = $environment->getDataDefinition();
        $legendStates = $environment->getSessionStorage()->get('LEGENDS') ?: [];

        if (\array_key_exists($definition->getName(), $legendStates)) {
            $legendStates = $legendStates[$definition->getName()];

            return $legendStates;
        }

        $legendStates = [];

        return $legendStates;
    }