added dynamic labels and values to the legend