public static void main(String argv[]) { RTConfig.setCommandLineArgs(argv); long now = DateTime.getCurrentTimeSec(); long sts = now - DateTime.DaySeconds(3); long ets = now; GoogleChartTemperature gct = new GoogleChartTemperature(); try { gct.setSize(700, 400); gct.setTitle(Color.black, 16, "Temperature"); gct.setTemperatureRange(1, F2C(0.0), F2C(130.0), 10); gct.setDateRange(new DateTime(sts), new DateTime(ets), 8); gct.setDateFormat("MM/dd"); gct.setTimeFormat("HH:mm:ss"); int setCount = 3; int tempCount = 15; gct._addRandomSampleData(setCount, tempCount); System.out.println(gct.toString()); } catch (Throwable th) { Print.logException("Error", th); System.exit(1); } }
protected boolean _setDevice(Device device, String ipAddress, int clientPort) { /* valid device? */ if (device == null) { return false; } /* validate ID address */ DataTransport dataXPort = device.getDataTransport(); if ((ipAddress != null) && !dataXPort.isValidIPAddress(ipAddress)) { Print.logError( "Invalid IPAddr: " + device.getAccountID() + "/" + device.getDeviceID() + " Found=" + ipAddress + " Expect=" + dataXPort.getIpAddressValid()); return false; } /* update device */ this.device = device; this.dataXPort = dataXPort; this.dataXPort.setIpAddressCurrent(ipAddress); // FLD_ipAddressCurrent this.dataXPort.setRemotePortCurrent(clientPort); // FLD_remotePortCurrent this.dataXPort.setDeviceCode(this.getDeviceCode()); // FLD_deviceCode this.device.setLastTotalConnectTime(DateTime.getCurrentTimeSec()); // FLD_lastTotalConnectTime /* ok */ return true; }
public String toString() { StringBuffer sb = new StringBuffer(); sb.append(CHART_API_URL); sb.append("uniq=").append(DateTime.getCurrentTimeSec()).append("&"); sb.append("cht=").append(this.cht).append("&"); sb.append("chs=").append(this.chs).append("&"); sb.append("chxt=").append(this.chxt).append("&"); sb.append("chg=").append(this.chg).append("&"); sb.append("chxl=").append(this.chxl).append("&"); sb.append("chts=").append(this.chts).append("&"); sb.append("chtt=").append(this.chtt).append("&"); sb.append("chco=").append(this.chco).append("&"); sb.append("chdl=").append(this.chdl).append("&"); sb.append("chd=").append(this.chd).append("&"); sb.append("chm=").append(this.chm); return sb.toString(); }