charts
charts copied to clipboard
Tooltips at series level not working in Charts 2.0.0
Originally by [email protected]
Hi there,
We are using Charts 2.0.0 along with Vaadin 7.3.9. and have an issue when trying to use Tooltips at series level rather than at Configuration level. We are display different types of metric (currency, time, money, ...) in the same chart so we want to assign specific Tooltip instance for each metric type. The process in simple, for each ListSeries instance we set an instance of PlotOptions with the right Tooltip formatter. However, it keeps on using the default Tooltip at Configuration level.
Are we missing something?
Many thanks in advance, Luis
Imported from https://dev.vaadin.com/ issue #17856
Originally by [email protected]
To be more specific. When the format is applied with tooltip.setPointFormat() it works at series level, but if you do it with tooltip.setFormatter() it doesn't work, and unfortunately we need the flexibility provided by setFormatter
Originally by @zch
This case would require setting the point formatter, which unfortunately isn't exposed in our API. A quick workaround for this is to use the following class instead of the Tooltip class:
import com.vaadin.addon.charts.model.Tooltip;
public class PointTooltip extends Tooltip {
private String _fn_pointFormatter;
public void setPointFormatter(String formatter) {
_fn_pointFormatter = formatter;
}
public String getPointFormatter() {
return _fn_pointFormatter;
}
}
Just instantiate the above class and use the setPointFormatter instead of setFormatter and everything should work. We'll look at getting this included in a future release.
Could I ask what your requirements are that forces you to use a JavaScript formatter instead of the point format?