java - Time format on y axis Primafaces multiaxis LineChart -
i want display time on y axis of chart hh:mm:ss time format. represent data in seconds.
is possible?
i used extender solve problem:
xhtml:
<p:chart type="line" model="#{mybean.multiaxischartmodel}" style="width:800px;" extender="customformatter" /> <script type="text/javascript"> function customformatter() { this.cfg.axes.y2axis.tickoptions.formatter = function(format, value) { d = number(value); var h = math.floor(d / 3600); var m = math.floor(d % 3600 / 60); var s = math.floor(d % 3600 % 60); return (h.tostring().length == 1 ? ("0" + h) : h) + ":" + (m.tostring().length == 1 ? ("0" + m) : m) + ":" + (s.tostring().length == 1 ? ("0" + s) : s); }; } </script>
bean:
multiaxischartmodel.setextender("customformatter");
Comments
Post a Comment