Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JfreeChart tooltips with HTML code inside

It is possible to use HTML in JFreeChart tooltips?

I extend StandardCategoryToolTipGenerator and override method generateToolTip

public String generateToolTip(Dataset dataset, int row,
        int column, int row) {

    return "<h1>ToolTips on line 1<\\h1> <br /> Second line tooltip"

}

But it is displaying whole string instead. Does anyone know how to display html text in jfrechart tooltips?

like image 860
user925531 Avatar asked Sep 04 '26 16:09

user925531


1 Answers

Use a CategoryURLGenerator, illustrated here for the homologous PieURLGenerator.

Addendum: As the tool tips are not Swing components, HTML is not supported. You can retrieve the result from your chosen URL generator in a ChartMouseListener to achieve any desired result.

like image 89
trashgod Avatar answered Sep 07 '26 06:09

trashgod



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!