Add legend feature to documentation