I managed to get this code to execute, but it wasnt exactly what I was looking for. The code you posted above does display the median, but I couldn't get the text to display outside the chart area. I was looking for something like what JMP does when you enable the Grand Mean, which shows the numeric value to the right of the chart.
I managed to find the median of my data and added the text box manually after the chart was generated. Not the most graceful, but it works.