Hello,
I am trying to get custom formatting for date/time in vaadin charts on the y-axis. I want to use moment.js library functions to use for formatting the data. I am using Vaadin 8.
The way I am currently trying to do it is using the cdn for moment.js.
public class QuickChart {
...
YAxis ya = new YAxis();
String loadMoment = "try {"
+ "var script = document.createElement('script');"
+ "script.src = \"https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js\";"
+ "document.head.appendChild(script);"
+ "} catch(e) {"
+ "alert('first one'); }";
IeUI.getCurrent().getPage().getJavaScript().execute(loadMoment);
String js = "function() {";
js += "try {"
+ "alert(moment.utc('2013-12-01').valueOf());"
+ "return g;}"
+ "catch(e) {"
+ "alert(e);} }";
ya.getLabels().setFormatter(js);
But it throws a reference exception. Is there another way of loading JS libraries to vaadin charts?