0

Geckoboard用来显示某些指标。我使用 Java API 将我的内容推送到 Geckoboard 中的小部件。但是,当我尝试将数据推送到Text小部件时,我不断收到错误消息invalid type provided: expected "float64", got "string"。网络上没有太多关于此的信息。我将如何消除错误。这是我的仪表板的链接,第一个小部件是错误。

https://agero.geckoboard.com/dashboards/1FC347183F126E8D#

public class ClusterGeckoMeter {
static Geckoboard geckoboard = new Geckoboard("sfsfsdfds");
static GeckOMeter text;
static GeckOMeter textprod;

static {
    text = new GeckOMeter("wewrwer", GraphType.STANDARD);
    textprod = new GeckOMeter("sdsdfaf", GraphType.STANDARD);
}

public ClusterGeckoMeter() {
}

public static void main(String[] args) throws ValidationException, GeckoboardException, IOException, NoSuchAlgorithmException {
    handShake();
    pushToDevProd();
}

public static void handShake() throws IOException, NoSuchAlgorithmException {
    TrustManager[] trustAllCerts = new TrustManager[]{new X509TrustManager() {
        public X509Certificate[] getAcceptedIssuers() {
            return null;
        }

        public void checkClientTrusted(X509Certificate[] certs, String authType) {
        }

        public void checkServerTrusted(X509Certificate[] certs, String authType) {
        }
    }};
    SSLContext sc = SSLContext.getInstance("SSL");

    try {
        sc.init((KeyManager[])null, trustAllCerts, new SecureRandom());
    } catch (KeyManagementException var7) {
        var7.printStackTrace();
    }

    HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
    HostnameVerifier allHostsValid = new HostnameVerifier() {
        public boolean verify(String hostname, SSLSession session) {
            return true;
        }
    };
    HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
    URL url = new URL("https://sri.geckoboard.com");
    URLConnection con = url.openConnection();
    InputStreamReader reader = new InputStreamReader(con.getInputStream());

    while(true) {
        int ch = reader.read();
        if(ch == -1) {
            return;
        }

        System.out.print((char)ch);
    }
}

public static void pushToDevProd() throws IOException {
    text.setCurrent("4");
    text.setMin("", "0");
    text.setMax("", "10");
    geckoboard.push(text);
    text.setCurrent("4");
    textprod.setCurrent("4");
    textprod.setMin("", "0");
    textprod.setMax("", "10");
    geckoboard.push(textprod);
}

}

4

0 回答 0