Closed ssamikk closed 4 years ago
@ssamikk I've tested your code with 2.8 in my tester app, as following:;
public void onModuleLoad() {
ResourcesType.setClientBundle(EmbeddedResources.INSTANCE);
MeterChart chart = new MeterChart();
chart.getOptions().getTitle().setDisplay(false);
chart.getOptions().setDisplay(MeterDisplay.VALUE);
chart.getOptions().setFormat("###.## units");
chart.getOptions().setResponsive(true);
MeterDataset dataSet = chart.newDataset(90);
dataSet.setValue(10);
chart.getData().setDatasets(dataSet);
RootPanel.get().add(chart);
}
This is the result:
Do you have anything else to try to reproduce the error ?
Thanks for the quick response. I will deal with what I am doing wrong.
@ssamikk let me know if you are able to solve it. I'm doing some tests and I'm not able to have that exception.
That exception means Chart
object (native instance of Chart.js) doesn't have the "innerRadius" property (read it by jstype native).
It sounds a little bit strange.
hellogwt.zip I tried on the simplest project. Got the same result
@ssamikk I think I found the reason of the issue because I got the same.
Are you sure you have added -generateJsInteropExports
to GWT compiler?
From Doc:
Pay attention that GWT compiler (you are using for your project) requires -generateJsInteropExports to be passed.
This is mandatory from version 2.x and be aware that the compiler will end correctly and you have this error at runtime.
I apologize for my carelessness.
Really missing one line in the gwt-maven-plugin configuration
<generateJsInteropExports>
true </generateJsInteropExports>
Many thanks for the help
@ssamikk no problem at all. This is a common issue and GWT compiler does not help because it does not provide any warning when that parameter for JSINTEROP is missing.
Furthermore this issue has helped to improve a statement into BaseMeterController.
It has also enforced our idea to improve the controller part in the next major version, for instance improving the enable of javascript controllers injection (see some additional chart types developed by others) or to use defaults (global and chart type) for meter and gauge types that at the moment can be configured ONLY at char level.
I'm gonna add the Maven configuration that you shared into Wiki, as reminder, for who will use Maven.
Thank you very much!
With version 2.6, everything works. After the update, I get the following error:
ChartNode.java:212 Uncaught TypeError: Cannot read property 'innerRadius' of undefined at Utv_g$.cuv_g$ [as getInnerRadius_0_g$] (ChartNode.java:212) at a$w_g$.d$w_g$ [as execute_5_g$] (BaseMeterController.java:166) at a$w_g$.c$w_g$ [as draw_4_g$] (BaseMeterController.java:139) at Fiw_g$.Siw_g$ [as onDraw_0_g$] (WrapperController.java:339) at Fiw_g$.Miw_g$ [as lambda$3_14_g$] (WrapperController.java:252) at Function.zjw_g$ (WrapperController.java:252) at n.lambda_0_g$ (Runtime.java:166)
My code:
MeterChart
chart = new MeterChart(); chart.getOptions().getTitle().setDisplay(false); chart.getOptions().setDisplay(MeterDisplay.VALUE); chart.getOptions().setFormat("###.## "+check.getUnits()); chart.getOptions().setResponsive(true);Tell me what I'm doing wrong.