GwtMaterialDesign / gwt-material-amcharts3

GMD + AmChart for charting library
2 stars 3 forks source link

AmGaugeBand error #12

Open dardison opened 6 years ago

dardison commented 6 years ago

Trying to use AngularGauge, I have problem setting Band.

This is my Java code:

    protected void buildUI(){
        this.chart=new AngularGauge();
        this.chart.setHeight("300px");
        this.chart.setWidth("100%");
        axis=new GaugeAxis();
        axis.setTopTextFontSize(20);
        axis.setTopTextYOffset(70);
        axis.setAxisColor("#31d6ea");
        axis.setAxisThickness(1);
        axis.setEndValue(100);
        axis.setGridInside(true);
        axis.setInside(true);
        axis.setRadius("50%");
        axis.setValueInterval(10);
        axis.setTickColor("#67b7dc");
        axis.setStartAngle(-90);
        axis.setEndAngle(90);
        axis.setUnit("%");
        axis.setBandOutlineAlpha(0);

        // Bands
        ArrayList<GaugeBand> bands=new ArrayList<>();

        GaugeBand band=new GaugeBand();
        band.setEndValue(100);
        band.setColor("#0080ff");
        band.setInnerRadius("105%");
        band.setRadius("170%");
        double[] gradientRatio={0.5, 0, -0.5};
        band.setGradientRatio(gradientRatio);
        band.setStartValue(0);
        bands.add(band);

        secondBand=new GaugeBand();
        secondBand.setColor("#3cd3a3");
        secondBand.setEndValue(0);
        secondBand.setInnerRadius("105%");
        secondBand.setRadius("170%");
        secondBand.setGradientRatio(gradientRatio);
        secondBand.setStartValue(0);
        bands.add(secondBand);

        GaugeBand[] barray=new GaugeBand[bands.size()];
        axis.setBands(bands.toArray(barray));

        this.chart.setAxes(axis);

        arrow=new GaugeArrow();
        arrow.setAlpha(1);
        arrow.setInnerRadius("35%");
        arrow.setNailRadius(0);
        arrow.setRadius("170%");
        this.chart.setArrows(arrow);
    }

And the error is this:

Caused by: com.google.gwt.core.client.JavaScriptException: (TypeError) : ((intermediate value)(intermediate value) , (intermediate value)(intermediate value) , $tmp_1_g$).getAmGaugeBand_0_g$(...).setEndValue is not a function
    at Unknown.dEj_g$(GaugeBand.java:85)
    at Unknown.Cxj_g$(GaugeChart.java:49)
    at Unknown.Axj_g$(GaugeChart.java:21)
    at Unknown.vxj_g$(ActivityGaugeViewImpl.java:11)
    at Unknown.twj_g$(ActivityDashboardPresenter.java:27)
    at Unknown.z_g$(ActivityDashboardPresenter.java:22)
    at Unknown.Lc_g$(ActivityDashboardActivity.java:10)
    at Unknown.DA_g$(ApplicationPresenter.java:42)
    at Unknown.JA_g$(ApplicationPresenter.java:61)
    at Unknown.OB_g$(ApplicationViewUI.java:99)
    at Unknown.iC_g$(ApplicationViewUI.java:99)
    at Unknown.qY_g$(MaterialWidget.java:1057)
    at Unknown.qTg_g$(MaterialWidget.java:1055)
    at Unknown.FAd_g$(ClickEvent.java:56)
    at Unknown.GAd_g$(ClickEvent.java:55)
    at Unknown.sr_g$(GwtEvent.java:76)
    at Unknown.sJd_g$(EventBus.java:40)
    at Unknown.YJd_g$(SimpleEventBus.java:193)
    at Unknown.cKd_g$(SimpleEventBus.java:88)
    at Unknown.KJd_g$(HandlerManager.java:127)
    at Unknown.QU_g$(Widget.java:129)
    at Unknown.Mzd_g$(DomEvent.java:125)
    at Unknown.YU_g$(Widget.java:177)
    at Unknown.Wke_g$(DOM.java:1481)
    at Unknown.Vke_g$(DOM.java:1420)
    at Unknown.ere_g$(DOMImplStandard.java:317)
    at Unknown.s6b_g$(Impl.java:309)
    at Unknown.v6b_g$(Impl.java:361)
    at Unknown.anonymous(Impl.java:78)

The problem is in this line: band.setEndValue(100);

Any idea? Not sure if this is a bug or I was configuring something wrong.

dardison commented 6 years ago

Also have the same error at: band.setStartValue(0) and at GaugeAxis at line 361

kevzlou7979 commented 6 years ago

I will patch this on comming weekend