/** * Plot plot. * * @param pts the pts * @return the plot */ public Plot plot(final double[][] pts) { Plot plot; switch (type) { case Scatter: plot = new ScatterPlot(pts); plot.setID(name); plot.setColor(color); return plot; case Line: plot = new LinePlot(pts); plot.setID(name); plot.setColor(color); return plot; default: throw new IllegalStateException(type.toString()); } }
/** * Add a graphical shape to the canvas. */ public void add(Plot p) { shapes.add(p); JComponent[] tb = p.getToolBar(); if (tb != null) { toolbar.addSeparator(); for (JComponent comp : tb) { toolbar.add(comp); } } repaint(); }
if (s instanceof Plot) { Plot p = (Plot) s; if (p.getID() != null) { k++; if (s instanceof Plot) { Plot p = (Plot) s; if (p.getID() != null) { g2d.setColor(p.getColor()); g2d.fillRect(x, y, width, height); g2d.drawRect(x, y, width, height); g2d.drawString(p.getID(), x + 2 * width, y + height); y += 2 * width;
if (shape instanceof Plot) { Plot plot = (Plot) shape; String s = plot.getToolTip(sc); if (s != null) { if (tooltip == null) { tooltip = s; firstid = plot.getID(); } else { if (firstid != null) { String id = plot.getID(); if (id != null) { tooltip += "<br><b>" + id + ":</b><br>" + s;
/** * Plot plot. * * @param pts the pts * @return the plot */ public Plot plot(final double[][] pts) { Plot plot; switch (type) { case Scatter: plot = new ScatterPlot(pts); plot.setID(name); plot.setColor(color); return plot; case Line: plot = new LinePlot(pts); plot.setID(name); plot.setColor(color); return plot; default: throw new IllegalStateException(type.toString()); } }
/** * Remove a graphical shape from the canvas. */ public void remove(Plot p) { shapes.remove(p); JComponent[] tb = p.getToolBar(); if (tb != null) { for (JComponent comp : tb) { toolbar.remove(comp); } } repaint(); }
/** * Plot plot. * * @param pts the pts * @return the plot */ public Plot plot(final double[][] pts) { Plot plot; switch (type) { case Scatter: plot = new ScatterPlot(pts); plot.setID(name); plot.setColor(color); return plot; case Line: plot = new LinePlot(pts); plot.setID(name); plot.setColor(color); return plot; default: throw new IllegalStateException(type.toString()); } }