Can't change the font size and style of Legend labels for vtkChartLegend()

I am implementing a 2d Histogram in VTK by following the example https://examples.vtk.org/site/Cxx/Plotting/Histogram2D/ .
To change the font size and style of the legend labels after setting the transfer function I tried using:

chart->SetTransferFunction(transferFunction);
chart->GetLegend()->GetLabelProperties()->SetFontFamilyToTimes();
chart->GetLegend()->GetLabelProperties()->SetFontSize(2.0);

But this does not seem to reflect in the chart rendering although I can see that the values have been changed accordingly when I print the label properties using :
std::cout<<*chart->GetLegend()->GetLabelProperties();

Am I doing something wrong here or is there another way to change the font size of the labels?