Calculate THD From DFT Plot
What is shown in the plot is the PSD (Power Spectral density), which is measured in W/Hz (or dBc). So, in order to get the actual power in a given frequency range, you'd need to multiply with the bandwidth of each bin (which is determined by the length of the DFT window). Let the bandwidth of each bin be $B$.

Then, your formula becomes

$$
THD = 10\log\left(\frac{P_{HD}}{P_S}\right)=10\log\left(\frac{\sum_i B\cdot S_i}{B S_{HD}}\right)
$$

where $S_i$ denotes the Density at the $i$th harmonic and $S_HD$ denotes the density at the fundamental. As you see, B cancels in the expression, so you can ignore it. Note, that $S$ are in linear scale, (i.e. you'd need to transform the measurements in the diagram to linear scale before summing them up etc.)