Search code examples
graphjmeterjmeter-plugins

How to change font in jMeter output graphs


I am using one of jMeter plugins 'JP@GC response times over time' to display results and I would like to change the look of that graph.

Is there any way to do so ? For instance changing the font in the above mentioned graph.

Thank you.


Solution

  • I'm afraid it's kind of relying on Java defaults which are in %JAVA_HOME%/jre/lib/fontconfig.properties.src so you'll have to either change Java defaults (it'll have global level) or patch source code of Response Times Over Time listener.

    If you need once-only hack you can use Beanshell Sampler somewhere at the very beginning of your script to change font family, size, etc on-the-fly. See following example for details:

      import javax.swing.*;
        import javax.swing.plaf.FontUIResource;
        import java.awt.*;
        import java.util.Enumeration;
    
    Enumeration keys = UIManager.getDefaults().keys();   
     while (keys.hasMoreElements()){
            Object key = keys.nextElement();
            Object value = UIManager.get(key);
            if (value instanceof javax.swing.plaf.FontUIResource) {
                UIManager.put(key, new FontUIResource(new Font("MS Mincho", Font.PLAIN, 50)));
            }
        }
    

    Example of changing font JMeter family and size via Beanshell