/** * Applies the data from the graph's template to this chart * * @param data a Vector<DateValueTuple> of measurements that should be used to scale the lines * returned by the template */ private void applyTemplate(Vector data) { if (currentTemplate != null) { Vector lines = currentTemplate.getLines(data); if (lines != null) { Enumeration en = lines.elements(); while (en.hasMoreElements()) { Vector dataPoints = (Vector) en.nextElement(); for (int i = 0; i < dataPoints.size(); i++) { chart.insertItem((LinePointsItem) dataPoints.elementAt(i)); } } chart.startNewLine(); } } }
/** * Registers a new template for displaying records on the line chart * * @param template An IGraphTemplate object that this widget will register to use in displaying * graph data. */ public void registerTemplate(IGraphTemplate template) { templates.put(template.getTemplateName(), template); }