protected void _initChart() throws Exception { /* already initialized? */ if (this.didInitChart) { return; } /* axis tick counts */ int yTickCnt = this.getTemperatureTickCount(); int xTickCnt = this.getDateTickCount(); /* horizontal grid */ this.setGrid(0, yTickCnt); /* Y-axis labels */ StringBuffer ya = new StringBuffer(); double deltaC = this.maxTempC - this.minTempC; for (int y = 0; y <= yTickCnt; y++) { double C = this.minTempC + (deltaC * ((double) y / (double) yTickCnt)); double v = (this.dispUnits == TEMP_C) ? C : C2F(C); ya.append("|").append(StringTools.format(v, "0.0")); } if ((this.maxTempC > 0.0) && (this.minTempC < 0.0)) { double sep = Math.abs(this.minTempC) / (this.maxTempC - this.minTempC); this.addShapeMarker( "r,AA4444,0," + StringTools.format(sep, "0.000") + "," + StringTools.format(sep + 0.002, "0.000")); } /* X-axis labels */ StringBuffer xat = new StringBuffer(); StringBuffer xad = new StringBuffer(); double deltaTS = (double) (this.maxDateTS - this.minDateTS); long lastDN = 0L; for (int x = 0; x <= xTickCnt; x++) { long ts = this.minDateTS + Math.round(deltaTS * ((double) x / (double) xTickCnt)); DateTime dt = new DateTime(ts, this.timeZone); long dn = DateTime.getDayNumberFromDate(dt); xat.append("|").append(dt.format(this.getTimeFormat())); xad.append("|").append(dt.format(this.getDateFormat())); if (dn != lastDN) { long ds = dt.getDayStart(); if (ds > this.minDateTS) { double sep = (double) (ds - this.minDateTS) / deltaTS; this.addShapeMarker( "R,444444,0," + StringTools.format(sep, "0.000") + "," + StringTools.format(sep + 0.001, "0.000")); } lastDN = dn; } } /* axis labels */ this.setAxisLabels( "y,x,x", "0:" + ya.toString() + "|1:" + xad.toString() + "|2:" + xat.toString()); /* did init */ this.didInitChart = true; }