Cómo formatear una línea de tiempo de serie temporal SEMANA
TimeSeriesCollection data = new TimeSeriesCollection();
Mapa mapa = new HashMap();
String temp = "";
while (rs .next()) {
String order_id = rs.getString("order_id");
if (!order_id.equals(temp))getString( " first_result");
String total_num = rs. getString("num");
List tempData = new ArrayList();
tempData.add( new Cadena[] { nombre_región,
primer_resultado, núm_total });
map.put(order_id, tempData);
} más {
Listar otros = (Lista) map.get(order_id);
other.add(new String[] {
rs.getString("region_name"),
p>rs.getString("first_result"),
rs.getString("num") });
}
Establecer conjunto = map.entrySet();
List tempList = new ArrayList(set
Collections.sort(tempList, new Comparator() {
public int); comparar (Objeto arg0, Objeto arg1) {
return (Integer.parseInt(((Map.Entry) arg0)
.getKey().toString()) - Entero p >
.parseInt(((Map.Entry) arg1).getKey()
.toString()) - Entero
.toString()
}
}
for (int i = 0; i < tempList.size(); i++) {
Clave de cadena = (Cadena ) ((Map.Entry) tempList.get (i))
.getKey();
TimeSeries aLine = null;
Iterador myData = (( Lista ) ((Map.Entry) tempList
.get(i)).getValue()).iterator();
int index = 0;
while (myData.hasNext()) {
String[] valores = (String[]) myData.util.Date fecha = new java.util.Date();
fecha = sdf.parse(valores[1]);
Reg
ularTimePeriod rp = nuevo día(fecha);
aLine.add(rp, Double.parseDouble(values[2]));
}
datos. addSeries(aLine);
}
}
}
if (datas.getSeries().size() > 0) {
JFreeChart chart = ChartFactory
.createTimeSeriesChart("Número de alarmas en tendencia", "Fecha", "Número de alarmas",
datos, verdadero, true, false);
chart.setBackgroundPaint(Color.white);//Establecer el color de fondo del gráfico
String tipTemplete = "{0}{1},{2}" ;//Establece el mensaje que se muestra cuando el mouse se mueve sobre el punto en el pliegue
org.jfree.chart.plot.XYPlot xyplot = "{0}{1},{2}";