/** * Uses the calculator with name calcName to construct & display a series for the sg. This should * be the only way new series' are added to the chart, since we need to keep track of all the * current series in the sgSeriesMap * * @param calcName * @param sg */ protected void addSeriesForSG(String calcName, SequenceGroup sg) { BaseCounter calc = null; try { calc = sgReg.getBaseCounterInstance(calcName, sg); } catch (IllegalArgumentException ex) { System.err.println("Could not find base counter of type : " + calcName); return; } List<AbstractSeries> seriesList = sgSeriesMap.get(sg); if (seriesList == null) { System.out.println( "Uh-oh, this sequence group doesn't have an associated list in the sgSeriesMap..."); } // Make a new series from the calculator int windowsize = ((Integer) windowSizeSpinner.getValue()).intValue(); int windowStep = ((Integer) windowStepSpinner.getValue()).intValue(); if (usePartitionsBox.isSelected()) { for (int i = 0; i < sg.getPartitionCount(); i++) { BaseCounterSeries ser = calc.getWindowSeries(windowsize, windowStep, i); ser.setPartitionIndex(i); seriesList.add(ser); ser.setName(calc.getName() + " - " + sg.getPartitionKeyForIndex(i)); if (ser != null && ser.size() > 0) { chart.addDataSeries(ser); chart.repaint(); } } } else { BaseCounterSeries ser = calc.getWindowSeries(windowsize, windowStep); seriesList.add(ser); if (sgSeriesMap.size() > 1) { String name = sg.getName(); if (name == null) { ser.setName(calc.getName()); } else { ser.setName(calc.getName() + " - " + sg.getName()); } } if (ser != null && ser.size() > 0) { chart.addDataSeries(ser); chart.repaint(); } } }