Closed divq closed 4 months ago
@divq thank you for feedback. I have tested your code locally (GWT 2.10, later I'll do on GWT 2.11) but I don't have any issue :(.
Result:
Code
Charba.enable();
GaugeChartWidget.register();
GaugeChartWidget chart = new GaugeChartWidget();
chart.getCanvas().getStyle().setWidth("600px");
chart.getCanvas().getStyle().setHeight("400px");
Threshold normal = DefaultThreshold.NORMAL.getThreshold().setValue(60).setColor(HtmlColor.RED);
Threshold warning = DefaultThreshold.WARNING.getThreshold().setValue(80).setColor(HtmlColor.ORANGE);
Threshold critical = DefaultThreshold.CRITICAL.getThreshold().setValue(100).setColor(HtmlColor.GREEN);
GaugeDataset ds = chart.newDataset(100);
ds.setValue(40);
ValueLabel vl = ds.getValueLabel();
vl.setDisplay(true);
DescriptionLabel dl = ds.getDescriptionLabel();
dl.setDisplay(true);
dl.setContent("This is description");
ds.setThresholds(normal, warning, critical);
chart.getData().setDatasets(ds);
RootPanel.get().add(chart);
I don't expect a different behaviour using GWT 2.11.
@stockiNail I created an empty GWT 2.11 project and re-tested my code above and it worked. So I doubt if the error is due to interference with my other dependencies (although at the entry point class I didn't use anything other than charba
). I'll check that later. Thank you.
@divq I'm very glad to hear that now you are not stuck!
This is how I use Gauge chart in GWT 2.11 (The GWT example code in https://pepstock-org.github.io/Charba-Wiki/docs/charts/ChartGauge/ was using UiBinder, which I've also tried but failed):
Stack trace:
In
BaseMeterController
, the exception was thrown wheredatasetMetaItem.getController().getInnerRadius()
was called, sincedatasetMetaItem
was null.datasetMetaItem
was the result of callingchart.getDatasetItem(0)
, inside whichChart instance = lookForConsistentInstance
returned null (the two methods thereof are insideAbstractChart
). AndlookForConsistentInstance
just looks for theChart chart
field insideAbstractChart
.It seems that, creating a
GaugeChartWidget
this way, theAbstractChart
has an uninitializedChart
field.My environment: GWT 2.11, charba-gwt 6.5
Update:
MeterChart
has the same error. ButLineChart
works just fine.