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

**URL:** https://discourse.vtk.org/t/cant-change-the-font-size-and-style-of-legend-labels-for-vtkchartlegend/15302
**Category:** Support
**Created:** [February 24, 2025, 10:15am UTC](https://discourse.vtk.org/t/cant-change-the-font-size-and-style-of-legend-labels-for-vtkchartlegend/15302 "2025-02-24T10:15:58Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![roy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/r/4da419/32.png) [@roy](https://discourse.vtk.org/u/roy)
#### Post date: [February 24, 2025, 10:15am UTC](https://discourse.vtk.org/t/cant-change-the-font-size-and-style-of-legend-labels-for-vtkchartlegend/15302/1 "2025-02-24T10:15:58Z")

</div>

I am implementing a 2d Histogram in VTK by following the example [https://examples.vtk.org/site/Cxx/Plotting/Histogram2D/](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?
