public static void main(String[] args) throws Exception {
   List<String> signals = new ArrayList<>();
   Timestamp start = null;
   Timestamp end = null;
   String filename = null;
   for (int i = 0; i < args.length; i++) {
     String arg = args[i];
     if (arg.equals("-s")) {
       i++;
       start = format.parse(args[i]);
     } else if (arg.equals("-e")) {
       i++;
       end = format.parse(args[i]);
     } else if (arg.equals("-o")) {
       i++;
       filename = args[i];
     } else {
       signals.add(arg);
     }
   }
   List<TimeSeries> data = RrdToolDB.fetchData(signals, start, end);
   Map<String, TimeSeries> series = new HashMap<>();
   for (int i = 0; i < signals.size(); i++) {
     series.put(signals.get(i), data.get(i));
   }
   TimeSeriesMulti correlated = TimeSeriesMulti.synchronizeSeries(series);
   final Point3DWithLabelDataset dataset =
       Point3DWithLabelDatasets.build(
           correlated.getValues().get(signals.get(0)),
           correlated.getValues().get(signals.get(1)),
           correlated.getValues().get(signals.get(2)),
           Collections.nCopies(correlated.getValues().get(signals.get(0)).size(), "label"));
   BubbleUtil.createBubblePlot(filename, dataset, "DATASETLABEL", "", "", "", "", Timestamp.now());
 }
 @Test
 public void parse2() {
   BufferedReader reader =
       new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("rrdtool2.out")));
   RrdToolOutputParser instance = new RrdToolOutputParser();
   TimeSeriesMulti result = instance.parse(reader);
   assertThat(result.getTime().size(), equalTo(241));
   assertThat(result.getValues().size(), equalTo(18));
   assertThat(
       result.getValues().keySet(),
       equalTo(
           (Set<String>)
               new HashSet<String>(
                   Arrays.asList(
                       "Setpoint",
                       "Fan1cfm",
                       "Temp1",
                       "Temp3",
                       "Fan2Rpm",
                       "TempOvrSet",
                       "Fan2cfm",
                       "Totalcfm",
                       "Fan1Status",
                       "Temp2",
                       "Fan1Rpm",
                       "Fan2Status",
                       "Fan3cfm",
                       "Fan3Rpm",
                       "Fan3Status",
                       "Fan4cfm",
                       "Fan4Rpm",
                       "Fan4Status"))));
   ListDouble values = result.getValues().get("Temp1");
   assertThat(values.size(), equalTo(241));
   assertThat(result.getTime().get(0), equalTo(Timestamp.of(1355416920, 0)));
   assertThat(values.getDouble(0), equalTo(9.2500000000e+01));
   assertThat(result.getTime().get(150), equalTo(Timestamp.of(1355470920, 0)));
   assertThat(values.getDouble(150), equalTo(9.1000000000e+01));
   assertThat(result.getTime().get(240), equalTo(Timestamp.of(1355503320, 0)));
   assertThat(values.getDouble(240), equalTo(Double.NaN));
 }
 @Test
 public void parse1() {
   BufferedReader reader =
       new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("rrdtool1.out")));
   RrdToolOutputParser instance = new RrdToolOutputParser();
   TimeSeriesMulti result = instance.parse(reader);
   assertThat(result.getTime().size(), equalTo(241));
   assertThat(result.getValues().size(), equalTo(1));
   ListDouble values = result.getValues().get("load_1min");
   assertThat(values.size(), equalTo(241));
   assertThat(result.getTime().get(0), equalTo(Timestamp.of(1349877960, 0)));
   assertThat(values.getDouble(0), equalTo(Double.NaN));
   assertThat(result.getTime().get(150), equalTo(Timestamp.of(1349931960, 0)));
   assertThat(values.getDouble(150), equalTo(1.1737083333e+00));
   assertThat(result.getTime().get(240), equalTo(Timestamp.of(1349964360, 0)));
   assertThat(values.getDouble(240), equalTo(Double.NaN));
 }