diff --git a/plugins/net.bioclipse.chart/build.properties b/plugins/net.bioclipse.chart/build.properties index 81bf3ba..6e49f86 100644 --- a/plugins/net.bioclipse.chart/build.properties +++ b/plugins/net.bioclipse.chart/build.properties @@ -3,5 +3,6 @@ bin.includes = plugin.xml,\ icons/,\ jars/batik-awt-util.jar,\ jars/batik-dom.jar,\ - jars/batik-svggen.jar + jars/batik-svggen.jar,\ + jars/batik-util.jar source.chart.jar = src/ diff --git a/plugins/net.bioclipse.chart/src/net/bioclipse/chart/BioclipseChartPanel.java b/plugins/net.bioclipse.chart/src/net/bioclipse/chart/BioclipseChartPanel.java index c7b7ed5..716b092 100644 --- a/plugins/net.bioclipse.chart/src/net/bioclipse/chart/BioclipseChartPanel.java +++ b/plugins/net.bioclipse.chart/src/net/bioclipse/chart/BioclipseChartPanel.java @@ -71,21 +71,24 @@ public BioclipseChartPanel(JFreeChart chart, ChartAction ca) { public void selectionChanged( IWorkbenchPart part, ISelection selection ) { if ( part instanceof IEditorPart ) - if ( selection instanceof IStructuredSelection) { - XYPlot plot = (XYPlot) getChart().getPlot(); - XYItemRenderer plotRenderer = plot.getRenderer(); - ScatterPlotRenderer renderer = null; - if (plotRenderer instanceof ScatterPlotRenderer) { - renderer = (ScatterPlotRenderer) plot.getRenderer(); - IChartDescriptor cd = ChartUtils.getChartDescriptor( getChart() ); - List values = cd.handleEvent( selection ); - renderer.clearMarkedPoints(); - for (ChartPoint cp:values) { - selectPoints( cp.getX(), cp.getY(), plot, renderer ); + if ( selection instanceof IStructuredSelection) { + if (getChart().getPlot() instanceof XYPlot) { + XYPlot plot = (XYPlot) getChart().getPlot(); + XYItemRenderer plotRenderer = plot.getRenderer(); + ScatterPlotRenderer renderer = null; + if (plotRenderer instanceof ScatterPlotRenderer) { + renderer = (ScatterPlotRenderer) plot.getRenderer(); + IChartDescriptor cd = ChartUtils.getChartDescriptor( getChart() ); + if (cd != null) { + List values = cd.handleEvent( selection ); + renderer.clearMarkedPoints(); + for (ChartPoint cp:values) { + selectPoints( cp.getX(), cp.getY(), plot, renderer ); + } + } } } } - } @Override diff --git a/plugins/net.bioclipse.chart/src/net/bioclipse/chart/ChartConstants.java b/plugins/net.bioclipse.chart/src/net/bioclipse/chart/ChartConstants.java index 667d49c..5d60c88 100644 --- a/plugins/net.bioclipse.chart/src/net/bioclipse/chart/ChartConstants.java +++ b/plugins/net.bioclipse.chart/src/net/bioclipse/chart/ChartConstants.java @@ -17,6 +17,7 @@ public enum plotTypes { LINE_PLOT, TIME_SERIES, BAR_PLOT, + BOX_PLOT, PLOT_MENU } diff --git a/plugins/net.bioclipse.chart/src/net/bioclipse/chart/ChartDescriptorFactory.java b/plugins/net.bioclipse.chart/src/net/bioclipse/chart/ChartDescriptorFactory.java index 616baa5..ed06b38 100644 --- a/plugins/net.bioclipse.chart/src/net/bioclipse/chart/ChartDescriptorFactory.java +++ b/plugins/net.bioclipse.chart/src/net/bioclipse/chart/ChartDescriptorFactory.java @@ -3,6 +3,7 @@ import org.eclipse.swt.graphics.Point; import org.eclipse.ui.IEditorPart; +import net.bioclipse.model.BoxPlotDescriptor; import net.bioclipse.model.ChartDescriptor; import net.bioclipse.model.HistogramDiscriptor; @@ -117,4 +118,13 @@ public static IChartDescriptor histogramDescriptor(IEditorPart source, return new HistogramDiscriptor( source, xLabel, values, yLable, bins, originCells, ChartTitle ); } + + public static IChartDescriptor boxPlotDescriptor(IEditorPart source, + String[] itemLabels, + double[][] values, + Point[] originCells, + String ChartTitle) { + + return new BoxPlotDescriptor( source, itemLabels, values, originCells, ChartTitle ); + } } diff --git a/plugins/net.bioclipse.chart/src/net/bioclipse/chart/ChartUtils.java b/plugins/net.bioclipse.chart/src/net/bioclipse/chart/ChartUtils.java index e9ab32c..b2f9514 100644 --- a/plugins/net.bioclipse.chart/src/net/bioclipse/chart/ChartUtils.java +++ b/plugins/net.bioclipse.chart/src/net/bioclipse/chart/ChartUtils.java @@ -19,6 +19,7 @@ import net.bioclipse.chart.events.CellChangedEvent; import net.bioclipse.chart.events.CellData; import net.bioclipse.managers.business.IBioclipseManager; +import net.bioclipse.model.BoxPlotDescriptor; import net.bioclipse.model.ChartManager; import net.bioclipse.model.ChartModelListener; import net.bioclipse.model.ChartSelection; @@ -43,6 +44,7 @@ import org.jfree.chart.renderer.xy.XYBarRenderer; import org.jfree.chart.renderer.xy.XYItemRenderer; import org.jfree.data.category.DefaultCategoryDataset; +import org.jfree.data.statistics.DefaultBoxAndWhiskerCategoryDataset; import org.jfree.data.statistics.HistogramDataset; import org.jfree.data.xy.DefaultXYDataset; import org.jfree.data.xy.IntervalXYDataset; @@ -308,6 +310,33 @@ public static void barPlot(double[][] dataValues, String[] seriesLabels, String[ } + public static void boxPlot(IChartDescriptor descriptor) { + + setupData( descriptor ); + + if (descriptor instanceof BoxPlotDescriptor) { + BoxPlotDescriptor bpd = (BoxPlotDescriptor) descriptor; + + DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); + + for (int i=0;i getCharts() { return chartManager.keySet(); } diff --git a/plugins/net.bioclipse.chart/src/net/bioclipse/chart/IChartDescriptor.java b/plugins/net.bioclipse.chart/src/net/bioclipse/chart/IChartDescriptor.java index 79bdc91..1646e76 100644 --- a/plugins/net.bioclipse.chart/src/net/bioclipse/chart/IChartDescriptor.java +++ b/plugins/net.bioclipse.chart/src/net/bioclipse/chart/IChartDescriptor.java @@ -178,6 +178,11 @@ public interface IChartDescriptor extends IAdaptable { */ public void removeItemLabels(); - public List handleEvent( ISelection selection ); + public boolean hasToolTips(); + public String getToolTip(int index); + + public List handleEvent( ISelection selection ); + + public T getAdapter(int index, Class clazz); } diff --git a/plugins/net.bioclipse.chart/src/net/bioclipse/chart/ui/business/ChartManager.java b/plugins/net.bioclipse.chart/src/net/bioclipse/chart/ui/business/ChartManager.java index 7c952c6..cfbbd0b 100644 --- a/plugins/net.bioclipse.chart/src/net/bioclipse/chart/ui/business/ChartManager.java +++ b/plugins/net.bioclipse.chart/src/net/bioclipse/chart/ui/business/ChartManager.java @@ -173,7 +173,39 @@ public void histogram(double[] values, int bins, String xLabel, String yLabel, S descriptor.setItemLabels( itemLabels ); this.plot( descriptor ); } - + + public void boxPlot(double[] values, String boxName) { + Point[] origin = new Point[0]; + double[][] valueMatrix = new double[1][values.length]; + valueMatrix[0] = values; + String[] itemLabels = {boxName}; + IChartDescriptor descriptor = ChartDescriptorFactory.boxPlotDescriptor( null, itemLabels, valueMatrix, origin, "" ); + this.plot( descriptor ); + } + + public void boxPlot(double[] values1, String nameOfbox1, double[] values2, String nameOfbox2) { + Point[] origin = new Point[0]; + double[][] valueMatrix = new double[2][values1.length]; + valueMatrix[0] = values1; + valueMatrix[1] = values2; + String[] itemLabels = {nameOfbox1, nameOfbox2}; + IChartDescriptor descriptor = ChartDescriptorFactory.boxPlotDescriptor( null, itemLabels, valueMatrix, origin, "" ); + this.plot( descriptor ); + } + + public void boxPlot(double[][] values) { + String[] names = new String[values.length]; + for (int i=0;i getRow(int index) { + List row = new ArrayList(); + for(int i=0;i getColumn(int index) { + List col = new ArrayList(); + for(int i=0;i 0 || index < itemLabels.length)) + return itemLabels[index]; + + throw new IllegalAccessError( "Cant find the item label." ); + } + + @Override + public void setItemLabel( int index, String label ) + throws IllegalAccessError { + + } + + @Override + public String[] getItemLabels() { + return itemLabels; + } + + @Override + public boolean hasItemLabels() { + return (itemLabels != null); + } + + @Override + public void removeItemLabels() { + itemLabels = null; + } + + @Override + public List handleEvent( ISelection selection ) { + return new ArrayList(); + } + + @Override + public T getAdapter( int index, Class clazz ) { + return null; + } + + @Override + public boolean hasToolTips() { + return hasItemLabels(); + } + + @Override + public String getToolTip( int index ) { + return getItemLabel( index ); + } + +} diff --git a/plugins/net.bioclipse.chart/src/net/bioclipse/model/ChartDescriptor.java b/plugins/net.bioclipse.chart/src/net/bioclipse/model/ChartDescriptor.java index 5c67c13..3c6e4f0 100644 --- a/plugins/net.bioclipse.chart/src/net/bioclipse/model/ChartDescriptor.java +++ b/plugins/net.bioclipse.chart/src/net/bioclipse/model/ChartDescriptor.java @@ -1,5 +1,5 @@ /* *************************************************************************** - * Copyright (c) 2008 Bioclipse Project +T * Copyright (c) 2008 Bioclipse Project * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -214,7 +214,15 @@ public boolean hasItemLabels() { public void removeItemLabels() { itemLabels = null; } - + + public boolean hasToolTips() { + return hasItemLabels(); + } + + public String getToolTip(int index) { + return getItemLabel( index ); + } + @Override public Object getAdapter( Class adapter ) { if (adapter == HistogramDiscriptor.class) { @@ -252,4 +260,9 @@ else if (size < 20) public List handleEvent( ISelection selection ) { return new ArrayList(); } + + @Override + public T getAdapter( int index, Class clazz ) { + return null; + } } diff --git a/plugins/net.bioclipse.chart/src/net/bioclipse/model/HistogramDiscriptor.java b/plugins/net.bioclipse.chart/src/net/bioclipse/model/HistogramDiscriptor.java index 9b29a28..6099860 100644 --- a/plugins/net.bioclipse.chart/src/net/bioclipse/model/HistogramDiscriptor.java +++ b/plugins/net.bioclipse.chart/src/net/bioclipse/model/HistogramDiscriptor.java @@ -221,4 +221,19 @@ public Object getAdapter( Class adapter ) { public List handleEvent( ISelection selection ) { return new ArrayList(); } + + @Override + public T getAdapter( int index, Class clazz ) { + return null; + } + + @Override + public boolean hasToolTips() { + return hasItemLabels(); + } + + @Override + public String getToolTip( int index ) { + return getItemLabel( index ); + } } diff --git a/plugins/net.bioclipse.chart/src/net/bioclipse/model/JFreeChartActionFactory.java b/plugins/net.bioclipse.chart/src/net/bioclipse/model/JFreeChartActionFactory.java index cda6446..c28524d 100644 --- a/plugins/net.bioclipse.chart/src/net/bioclipse/model/JFreeChartActionFactory.java +++ b/plugins/net.bioclipse.chart/src/net/bioclipse/model/JFreeChartActionFactory.java @@ -126,6 +126,7 @@ public void run() public void handleChartModelEvent(ChartModelEvent e) { if( e.getEventType() == ChartEventType.ACTIVE_CHART_CHANGED){ activeChart = ChartUtils.getActiveChart(); + createZoomSelectAction(); } } }; @@ -178,7 +179,7 @@ public ChartAction createZoomSelectAction() { ChartAction zoomSelect = new ChartAction("Click for zoom-mode", Action.AS_CHECK_BOX ){ public void run() { IChartDescriptor cd = ChartUtils.getChartDescriptor(ChartUtils.getActiveChart()); - if (!this.isChecked() && cd.getPlotType() != ChartConstants.plotTypes.HISTOGRAM) { + if (!this.isChecked() && (cd.getPlotType() != ChartConstants.plotTypes.HISTOGRAM || cd.getPlotType() != ChartConstants.plotTypes.BOX_PLOT)) { this.setText( "Select" ); this.setToolTipText( "Click for zoom-mode" ); this.setImageDescriptor( ImageDescriptor @@ -200,23 +201,23 @@ public void run() { public void handleChartModelEvent( ChartModelEvent e ) { if( e.getEventType() == ChartEventType.ACTIVE_CHART_CHANGED){ - IChartDescriptor cd = ChartUtils.getChartDescriptor(ChartUtils.getActiveChart()); - - if (cd != null ) { - if(cd.getPlotType() == ChartConstants.plotTypes.HISTOGRAM) { - this.setText( "Zoom" ); - this.setToolTipText( "Click for selection-mode" ); - this.setImageDescriptor( ImageDescriptor - .createFromFile(this.getClass(), - "13991find.gif") ); - this.setChecked( true ); - this.setEnabled( false ); - } else{ - this.setEnabled( true ); - } - - } else - this.setEnabled( false ); +// IChartDescriptor cd = ChartUtils.getChartDescriptor(ChartUtils.getActiveChart()); +// +// if (cd != null ) { +// if(cd.getPlotType() == ChartConstants.plotTypes.HISTOGRAM || cd.getPlotType() != ChartConstants.plotTypes.BOX_PLOT) { +// this.setText( "Zoom" ); +// this.setToolTipText( "Click for selection-mode" ); +// this.setImageDescriptor( ImageDescriptor +// .createFromFile(this.getClass(), +// "13991find.gif") ); +// this.setChecked( true ); +// this.setEnabled( false ); +// } else{ +// this.setEnabled( true ); +// } +// +// } else +// this.setEnabled( false ); } } diff --git a/plugins/net.bioclipse.chart/src/net/bioclipse/model/ScatterPlotMouseHandler.java b/plugins/net.bioclipse.chart/src/net/bioclipse/model/ScatterPlotMouseHandler.java index 5368703..1eaeb0c 100644 --- a/plugins/net.bioclipse.chart/src/net/bioclipse/model/ScatterPlotMouseHandler.java +++ b/plugins/net.bioclipse.chart/src/net/bioclipse/model/ScatterPlotMouseHandler.java @@ -26,6 +26,7 @@ import javax.swing.event.MouseInputAdapter; import net.bioclipse.chart.ChartConstants; +import net.bioclipse.chart.ChartConstants.plotTypes; import net.bioclipse.chart.ChartUtils; import net.bioclipse.chart.IChartDescriptor; import net.bioclipse.chart.ScatterPlotRenderer; @@ -61,127 +62,139 @@ public ScatterPlotMouseHandler( ) @Override public void mouseDragged(MouseEvent e) { - super.mouseDragged(e); - - ChartPanel chartPanel = getChartPanel(e); - JFreeChart selectedChart = chartPanel.getChart(); - IChartDescriptor cd = ChartUtils.getChartDescriptor(selectedChart); - int[] indices = cd.getSourceIndices(); - - XYPlot plot = (XYPlot) chartPanel.getChart().getPlot(); - - //Create double buffer - Image buffer = chartPanel.createImage(chartPanel.getWidth(), chartPanel.getHeight()); - Graphics bufferGraphics = buffer.getGraphics(); - chartPanel.paint(bufferGraphics); - - if( lastX == 0 && lastY == 0) - { - lastX = e.getX(); - lastY = e.getY(); - } - - drawRect = new Rectangle(); - int x1 = Math.min(Math.min(e.getX(), lastX), startX); - int y1 = Math.min(Math.min(e.getY(), lastY), startY); - int x2 = Math.max(Math.max(e.getX(), lastX), startX); - int y2 = Math.max(Math.max(e.getY(), lastY), startY); - - drawRect.x = x1; - drawRect.y = y1; - drawRect.width = x2 - drawRect.x; - drawRect.height = y2 - drawRect.y; - - //Create a clipping rectangle - Rectangle clipRect = new Rectangle(drawRect.x-100, drawRect.y-100, drawRect.width+200, drawRect.height+200); - - //Check for selected points - for (int j=0; j iterator = currentSelection.iterator(); - while( iterator.hasNext()){ - PlotPointData next = iterator.next(); - Point dataPoint = next.getDataPoint(); - ((ScatterPlotRenderer) plot.getRenderer()).addMarkedPoint(dataPoint); - } - - lastX = e.getX(); - lastY = e.getY(); - - Graphics graphics = chartPanel.getGraphics(); - graphics.setClip(clipRect); - - //Draw selection rectangle - bufferGraphics.drawRect(drawRect.x, drawRect.y, drawRect.width, drawRect.height); - - graphics.drawImage(buffer, 0, 0, chartPanel.getWidth(), chartPanel.getHeight(), null); + super.mouseDragged(e); + + ChartPanel chartPanel = getChartPanel(e); + JFreeChart selectedChart = chartPanel.getChart(); + IChartDescriptor cd = ChartUtils.getChartDescriptor(selectedChart); + int[] indices = cd.getSourceIndices(); + + if (cd.getPlotType() != plotTypes.BOX_PLOT) { + XYPlot plot = (XYPlot) chartPanel.getChart().getPlot(); + + //Create double buffer + Image buffer = chartPanel.createImage(chartPanel.getWidth(), chartPanel.getHeight()); + Graphics bufferGraphics = buffer.getGraphics(); + chartPanel.paint(bufferGraphics); + + if( lastX == 0 && lastY == 0) + { + lastX = e.getX(); + lastY = e.getY(); + } + + drawRect = new Rectangle(); + int x1 = Math.min(Math.min(e.getX(), lastX), startX); + int y1 = Math.min(Math.min(e.getY(), lastY), startY); + int x2 = Math.max(Math.max(e.getX(), lastX), startX); + int y2 = Math.max(Math.max(e.getY(), lastY), startY); + + drawRect.x = x1; + drawRect.y = y1; + drawRect.width = x2 - drawRect.x; + drawRect.height = y2 - drawRect.y; + + //Create a clipping rectangle + Rectangle clipRect = new Rectangle(drawRect.x-100, drawRect.y-100, drawRect.width+200, drawRect.height+200); + + //Check for selected points + for (int j=0; j iterator = currentSelection.iterator(); + while( iterator.hasNext()){ + PlotPointData next = iterator.next(); + Point dataPoint = next.getDataPoint(); + ((ScatterPlotRenderer) plot.getRenderer()).addMarkedPoint(dataPoint); + } + + lastX = e.getX(); + lastY = e.getY(); + + Graphics graphics = chartPanel.getGraphics(); + graphics.setClip(clipRect); + + //Draw selection rectangle + bufferGraphics.drawRect(drawRect.x, drawRect.y, drawRect.width, drawRect.height); + + graphics.drawImage(buffer, 0, 0, chartPanel.getWidth(), chartPanel.getHeight(), null); + } // TODO What to do in a box plot when the mouse is dragged? } - @Override public void mousePressed(MouseEvent e) { - super.mousePressed(e); - ChartPanel chartPanel = getChartPanel(e); - startX = e.getX(); - startY = e.getY(); - - if( !e.isShiftDown()) - { - XYItemRenderer renderer = ((XYPlot)chartPanel.getChart().getPlot()).getRenderer(); - if (renderer instanceof ScatterPlotRenderer) - ((ScatterPlotRenderer) renderer).clearMarkedPoints(); - currentSelection = new ChartSelection(); - chartPanel.getChart().plotChanged(new PlotChangeEvent(chartPanel.getChart().getPlot())); - } else{ - ((ScatterPlotRenderer)((XYPlot)chartPanel.getChart().getPlot()).getRenderer()).removeMarkedPoint(null); - } - if( currentSelection == null){ - currentSelection = new ChartSelection(); - } + super.mousePressed(e); + ChartPanel chartPanel = getChartPanel(e); + startX = e.getX(); + startY = e.getY(); + + JFreeChart selectedChart = chartPanel.getChart(); + IChartDescriptor cd = ChartUtils.getChartDescriptor(selectedChart); + + if (cd.getPlotType() != plotTypes.BOX_PLOT) { + if( !e.isShiftDown() ) { - mouseDragSelection = new ChartSelection(); - currentSelection.setDescriptor(ChartUtils.getChartDescriptor(chartPanel.getChart())); + XYItemRenderer renderer = ((XYPlot)chartPanel.getChart().getPlot()).getRenderer(); + if (renderer instanceof ScatterPlotRenderer) + ((ScatterPlotRenderer) renderer).clearMarkedPoints(); + currentSelection = new ChartSelection(); + chartPanel.getChart().plotChanged(new PlotChangeEvent(chartPanel.getChart().getPlot())); + } else{ + ((ScatterPlotRenderer)((XYPlot)chartPanel.getChart().getPlot()).getRenderer()).removeMarkedPoint(null); + } + if( currentSelection == null){ + currentSelection = new ChartSelection(); + } + + mouseDragSelection = new ChartSelection(); + currentSelection.setDescriptor(ChartUtils.getChartDescriptor(chartPanel.getChart())); + } // TODO What should happen if the left mouse button is pressed in a box plot? } @Override public void mouseReleased(MouseEvent e) { super.mouseReleased(e); + + startX = 0; startY = 0; lastX = 0; lastY = 0; ChartPanel chartPanel = this.getChartPanel(e); - chartPanel.repaint(); - currentSelection.addAll(mouseDragSelection); - ChartUtils.updateSelection(currentSelection); - + JFreeChart selectedChart = chartPanel.getChart(); + IChartDescriptor cd = ChartUtils.getChartDescriptor(selectedChart); + + if (cd.getPlotType() != plotTypes.BOX_PLOT) { + chartPanel.repaint(); + currentSelection.addAll(mouseDragSelection); + ChartUtils.updateSelection(currentSelection); + } //TODO What to do in a box plot when the left mouse button is released? } private Number getDomainX(ChartPanel chartPanel, XYPlot plot, Point2D mousePoint ) @@ -255,73 +268,75 @@ private ChartPanel getChartPanel(MouseEvent me) } public void mouseClicked(MouseEvent me) { - Point2D p = null; - IChartDescriptor cd = null; - int[] indices = null; - JFreeChart selectedChart = null; - ChartPanel chartPanel = getChartPanel(me); - p = chartPanel.translateScreenToJava2D(new Point(me.getX(), me.getY())); - selectedChart = chartPanel.getChart(); - - cd = ChartUtils.getChartDescriptor(selectedChart); - indices = cd.getSourceIndices(); + Point2D p = null; + IChartDescriptor cd = null; + int[] indices = null; + JFreeChart selectedChart = null; + ChartPanel chartPanel = getChartPanel(me); + p = chartPanel.translateScreenToJava2D(new Point(me.getX(), me.getY())); + selectedChart = chartPanel.getChart(); - XYPlot plot = (XYPlot) chartPanel.getChart().getPlot(); - - XYItemRenderer plotRenderer = plot.getRenderer(); - - if( !(plotRenderer instanceof ScatterPlotRenderer) ) - { - throw new IllegalStateException("Charts using ScatterPlotMouseHandler must use ScatterPlotRenderer as their renderer"); - } - renderer = (ScatterPlotRenderer) plot.getRenderer(); - - // now convert the Java2D coordinate to axis coordinates... - Number xx = getDomainX(chartPanel, plot, p); - Number yy = getRangeY(chartPanel, plot, p); - Range xRange = plot.getDataRange( plot.getDomainAxis() ); - Range yRange = plot.getDataRange( plot.getRangeAxis() ); - if (xRange.getLowerBound() != 0) - xx=xx.doubleValue()/xRange.getCentralValue(); - if (yRange.getLowerBound() != 0) - yy=yy.doubleValue()/yRange.getCentralValue(); - //Find the selected point in the dataset - //If shift is down, save old selections - if( !me.isShiftDown() || currentSelection == null) - { - currentSelection = new ChartSelection(); - } - - for (int j=0; j selectionListeners; @@ -179,7 +181,6 @@ private void addActions( IContributionManager manager ) { manager.add(saveImageActionSVG); manager.add(saveImageActionPNG); - manager.add(saveImageActionJPG); manager.add(new Separator()); manager.add( showHidePointLables ); } @@ -188,18 +189,15 @@ private void makeActions() { saveImageActionSVG = factory.createExportSvgAction(); saveImageActionPNG = factory.createExportPngAction(); - saveImageActionJPG = factory.createExtportJpegAction(); showHidePointLables = factory.createPointLabelsAction(); zoomSelectAction = factory.createZoomSelectAction(); - saveImageActionJPG.setEnabled(false); saveImageActionPNG.setEnabled(false); saveImageActionSVG.setEnabled(false); showHidePointLables.setEnabled( false ); zoomSelectAction.setEnabled( false ); ChartUtils.addListener(saveImageActionSVG); - ChartUtils.addListener(saveImageActionJPG); ChartUtils.addListener(saveImageActionPNG); ChartUtils.addListener( showHidePointLables ); ChartUtils.addListener( zoomSelectAction ); @@ -369,61 +367,62 @@ public void run() { frame.removeAll(); frame.add(chartPanel); frame.setVisible(true); + if( cd.getPlotType() != ChartConstants.plotTypes.BOX_PLOT ) { + XYPlot plot = (XYPlot) chartPanel.getChart().getPlot(); + if( cd.getPlotType() != ChartConstants.plotTypes.HISTOGRAM ) + { + //Listens for mouseclicks on points + + switch (cd.getPlotType()) { + case SCATTER_PLOT: + plot.setRenderer(new ScatterPlotRenderer(false,true)); + break; + default: + plot.setRenderer(new ScatterPlotRenderer(true,false)); + break; + } + + XYItemRenderer r = plot.getRenderer(); + if (r instanceof ScatterPlotRenderer) { + ((ScatterPlotRenderer) r).setBaseToolTipGenerator( new XYToolTipGenerator() { + + public String generateToolTip( XYDataset dataset, int series, int item ) { + if (cd.hasToolTips()) + return cd.getToolTip( item ); + else + return dataset.getY( series, item ).toString(); + } + + }); + + if (cd.hasItemLabels()) { + ((ScatterPlotRenderer) r).setBaseItemLabelGenerator( new StandardXYItemLabelGenerator() { + @Override + public String generateLabel(XYDataset dataset, int series, int item) { + return cd.getItemLabel( item ); + } + }); + } else + ((ScatterPlotRenderer) r).setBaseItemLabelGenerator( new StandardXYItemLabelGenerator() ); + + } + // if( ChartView.IS_MACOS ) + // { + // frame.addMouseListener(pmh); + // frame.addMouseMotionListener(pmh); + // chartPanel.addMouseListener(pmh); + // } + // else + // { + // chartPanel.addMouseListener(pmh); + // frame.addMouseMotionListener(pmh); + // } + } + + XYItemRenderer renderer = plot.getRenderer(); + renderer.setBaseItemLabelsVisible( showHidePointLables.isChecked() ); - XYPlot plot = (XYPlot) chartPanel.getChart().getPlot(); - if( cd.getPlotType() != ChartConstants.plotTypes.HISTOGRAM ) - { - //Listens for mouseclicks on points - - switch (cd.getPlotType()) { - case SCATTER_PLOT: - plot.setRenderer(new ScatterPlotRenderer(false,true)); - break; - default: - plot.setRenderer(new ScatterPlotRenderer(true,false)); - break; - } - - XYItemRenderer r = plot.getRenderer(); - if (r instanceof ScatterPlotRenderer) { - ((ScatterPlotRenderer) r).setBaseToolTipGenerator( new XYToolTipGenerator() { - - public String generateToolTip( XYDataset dataset, int series, int item ) { - if (cd.hasItemLabels()) - return cd.getItemLabel( item ); - else - return dataset.getY( series, item ).toString(); - } - - }); - - if (cd.hasItemLabels()) { - ((ScatterPlotRenderer) r).setBaseItemLabelGenerator( new StandardXYItemLabelGenerator() { - @Override - public String generateLabel(XYDataset dataset, int series, int item) { - return cd.getItemLabel( item ); - } - }); - } else - ((ScatterPlotRenderer) r).setBaseItemLabelGenerator( new StandardXYItemLabelGenerator() ); - - } -// if( ChartView.IS_MACOS ) -// { -// frame.addMouseListener(pmh); -// frame.addMouseMotionListener(pmh); -// chartPanel.addMouseListener(pmh); -// } -// else -// { -// chartPanel.addMouseListener(pmh); -// frame.addMouseMotionListener(pmh); -// } } - - XYItemRenderer renderer = plot.getRenderer(); - renderer.setBaseItemLabelsVisible( showHidePointLables.isChecked() ); - } }); tabFolder.setSelection(chartTab); @@ -431,30 +430,56 @@ public String generateLabel(XYDataset dataset, int series, int item) { tabFolder.layout(); ChartUtils.setActiveChart(chart); - //Make sure actions are enabled when the chart has been created - saveImageActionJPG.setEnabled(true); + /*Make sure actions are enabled when the chart has been created, but not + * those functions that are not implemented yet.*/ + if (cd.getPlotType() == plotTypes.BOX_PLOT || + cd.getPlotType() == plotTypes.HISTOGRAM) { + zoomSelectAction.setChecked( true ); + zoomSelectAction.setEnabled( false ); + if (cd.getPlotType() == plotTypes.BOX_PLOT) + showHidePointLables.setEnabled( false ); + else + showHidePointLables.setEnabled( true ); + } else { + showHidePointLables.setEnabled( true ); + zoomSelectAction.setEnabled( true ); + } saveImageActionPNG.setEnabled(true); saveImageActionSVG.setEnabled(true); - showHidePointLables.setEnabled( true ); - zoomSelectAction.setEnabled( true ); } /** * Handles state changes in the model */ public void handleChartModelEvent(ChartModelEvent e) { - if(e.getEventType() == ChartEventType.ACTIVE_CHART_CHANGED ) - { - //Disable actions if no active chart exists - if( ChartUtils.getActiveChart() == null ) - { - saveImageActionJPG.setEnabled(false); - saveImageActionPNG.setEnabled(false); - saveImageActionSVG.setEnabled(false); - showHidePointLables.setEnabled( false ); - zoomSelectAction.setEnabled( false ); - } - } + if(e.getEventType() == ChartEventType.ACTIVE_CHART_CHANGED ) + { + JFreeChart chart = ChartUtils.getActiveChart(); + + //Disable actions if no active chart exists + if( chart == null ) + { + saveImageActionPNG.setEnabled(false); + saveImageActionSVG.setEnabled(false); + showHidePointLables.setEnabled( false ); + zoomSelectAction.setEnabled( false ); + } + else { + IChartDescriptor cd = ChartUtils.getChartDescriptor( chart ); + if (cd.getPlotType() == plotTypes.BOX_PLOT || + cd.getPlotType() == plotTypes.HISTOGRAM) { + zoomSelectAction.setChecked( true ); + zoomSelectAction.setEnabled( false ); + if (cd.getPlotType() == plotTypes.BOX_PLOT) + showHidePointLables.setEnabled( false ); + } else { + zoomSelectAction.setEnabled( true ); + showHidePointLables.setEnabled( true ); + } + saveImageActionPNG.setEnabled(true); + saveImageActionSVG.setEnabled(true); + } + } } public void handleCellChangeEvent(CellChangedEvent e) { } diff --git a/plugins/net.bioclipse.statistics/build.properties b/plugins/net.bioclipse.statistics/build.properties index 24566e7..00b2ac3 100644 --- a/plugins/net.bioclipse.statistics/build.properties +++ b/plugins/net.bioclipse.statistics/build.properties @@ -10,5 +10,9 @@ bin.includes = .,\ about.ini,\ about.mappings,\ about.properties,\ - jars/org.eclipse.nebula.widgets.grid_1.0.0.jar + jars/org.eclipse.nebula.widgets.grid_1.0.0.jar,\ + html/,\ + toc.xml,\ + matrixEditorToc.xml,\ + mtePlottingToc.xml jars.compile.order = . diff --git a/plugins/net.bioclipse.statistics/html/ChartViewHelp.html b/plugins/net.bioclipse.statistics/html/ChartViewHelp.html index a814596..31afa15 100644 --- a/plugins/net.bioclipse.statistics/html/ChartViewHelp.html +++ b/plugins/net.bioclipse.statistics/html/ChartViewHelp.html @@ -9,22 +9,29 @@

The chart view

-The chart view are showing plots, mainly made from the matrix editor or the molecular table editor. But it's also possibly to plot from the JavaScript console. Except for showing the plotted data the view also interacts with the source by high-lighting the corresponding data in the editor that it originated from, and makes a summation of the selected points in the properties view. It also interacts the other way around with the editors, i.e. by hight-lighting points that are related to selections in the editor.
+The chart view are showing plots, mainly made from the matrix editor or the molecular table editor. But it's also possibly to plot from the JavaScript console. If an selection is made in the chart a summation of the selected points are shown in the properties view, and if the plot was made from an editor the view also interacts with the editor by high-lighting the corresponding data. It also interacts the other way around with the editors, i.e. by hight-lighting points that are related to selections in the editor.

The toolbar

The toolbar is in the top of the view and except for showing different tabs for the different views stacked on top of each other, it also has some other buttons. In case with the chart view there's five different buttons. The two left-most are just for maximize (1) and minimize (2) the view, this can also be achieved by double click on the toolbar. The other three will be described in more detail below.

The menu

-The third from left is a triangel (3), and when clicking on that a menu with four items will appear. The three first, from the top, will export the diagram as an image. The reasons for having three different options for this is that it make it possibly to choose between three different formart for the output image: SVG (vector based image), PNG and JPG.
+The third from left is a triangel (3), and when clicking on that a menu with three items will appear. The two first, from the top, will export the diagram as an image. The reasons for having tow different options for this is that it make it possibly to choose between two different formart for the output image: SVG (vector based image) and PNG.
The last alternative are showing or hiding points labels in the chart, and is availably form the tool bar as well.

Select/zoom

-With the fourth button (4) from the left its possibly to change between selection- and zoom-mode. The default for this is the selection mode, and it makes it possibly to select several points in the chart to get more information about them. It's also possibly to select only one point by clicking on it. Observe that selecting only one point by a click is availably in zoom-mode as well. Exactly what information that is shown in the properties view depends on whether it's a single point or several points that are selected. It might also depend on the source of the plot, i.e. if it was made from the matrix editor or the Molecular table editor. Also notice that multi selection dont work in the histogram plot.
-When clicking on the button it will change to showing a magnify-glas, and activate zoom-mode. In this mode it's possibly to zoom in the diagram to take a closer look in some part of a part of the chart, this is done by pressing the left button and moving the mouse down and to the right un till the area that is wanted is covered by the rectangle that appar. When the zooming is done it's possibly to change back selection mode to investigate the points in the zoomed area. To zoom-out, make sure that the zoom-mode is active and then click some where on in the chart, draw the mouse upwards a bit while keeping the button (on the mouse) down and then release it. +With the fourth button (4) from the left its possibly to change between selection- and zoom-mode. The default for this is the selection mode, and it makes it possibly to select several points in the chart to get more information about them. It's also possibly to select only one point by clicking on it. Observe that selecting only one point by a click is availably in zoom-mode as well. Exactly what information that is shown in the properties view depends on whether it's a single point or several points that are selected. It might also depend on the source of the plot, i.e. if it was made from the matrix editor or the Molecular table editor. Also notice that multi-selection don't work in the histogram plot and that for the box plot there's no updates to the properties view nor any possibility to make selections.
+When clicking on the button it will change to showing a magnify-glas, and activate zoom-mode. In this mode it's possibly to zoom in the diagram to take a closer look in some part of a part of the chart, this is done by pressing the left button and moving the mouse down and to the right until the area that is wanted is covered by the rectangle that appar. When the zooming is done it's possibly to change back selection mode to investigate the points in the zoomed area. To zoom-out, make sure that the zoom-mode is active and then click some where on in the chart, draw the mouse upwards a bit while keeping the button (on the mouse) down and then release it.

Point labels

-The last button and the one to the first from right (5) are for showing point labels in the chart, the default for this is to not show the point labels. The values that are shown are the y-value of the points for all plot types except for the histogram where it shows the range of the bar along the x-axis. It's also possibly to control this from the menu, as mention above. +The last button and the one to the first from right (5) are for showing point labels in the chart, the default for this is to not show the point labels. The values that are shown are the y-value of the points for all plot types except for the histogram where it shows the range of the bar along the x-axis. It's also possibly to control this from the menu, as mention above. Observe that point labels is not availably for the box plot.

The properties view

As menton in the first section above a selection in the chart will display information about the selection in the properties view (6). Where it is located depends on the settings, but most likely it is below the editors. If the view is not open then it's possibly to open it via the menu Window > Show view > Others... > properties view.
When selecting one point is selected the properties view will show the x-value of the point together with the label of the x-axis, and the y-value together with its label. If two or more values are selected the properties view will show (from the top row and down) the average value of the points, maximum value along the points, the minmum value and the number of points selected. In both the cases the properties view will show the name of file (source) that the plotted values are from. Observe that the labels of values are sorted in the alphabetic order, here-since the order of the vales when one point is selected will depend on the x- and y-labels of the chart. +

The different plot types

+When creating plots in Bioclipse it is possibly to choose between four different plot types (there is a fifth type, times series, but it can only be plotted from the JavaScript-console. Since it is so alike line plot). The fore main types are scatter plot, line plot histogram and box plot. +

Scatter plot

+

Line plot

+

Histogram

+

Box plot

+The box plot creates a box from the data of each column and uses the column headers as label for the boxes. The box diagram shows the max and meen values of the data as tow lines, between those lines is a rectangle where the top marks the fourth quater of the values and the bottom the first quater. The line in the middle marks the median value of the values in the column, the boxes also have a big black dot that shows the average value of the data (including the outliers). Outliers are marked with a read circle.

Scripting

-It is also possibly to plot data from the JavaScript console. This is done with help of the chart-manager, there's five different plot types to choose between: barPlot, histogram, line plot, scatter plot and time series. the methods can plot data both from two arrays with numbers and from a matrix with two columns. For more information about the API see the Manager reference in the section Bioclipse scripting on the help pages. +It is also possibly to plot data from the JavaScript console. This is done with help of the chart-manager, there's five different plot types to choose between: barPlot, histogram, line plot, scatter plot, box plot and time series. the methods can plot data both from two arrays with numbers and from a matrix with two columns. For more information about the API see the Manager reference in the section Bioclipse scripting on the help pages. \ No newline at end of file diff --git a/plugins/net.bioclipse.statistics/html/matrixEditorHelp.html b/plugins/net.bioclipse.statistics/html/matrixEditorHelp.html index a807232..a534a77 100644 --- a/plugins/net.bioclipse.statistics/html/matrixEditorHelp.html +++ b/plugins/net.bioclipse.statistics/html/matrixEditorHelp.html @@ -9,12 +9,12 @@

The matrix editor

-The matrix editor is a simple spread sheet for opening and edit e.g. csv-files. It is also the editor that is used for opening matrixes created in the JavaScript console. It is also possibly to create plots in the chat view form the matrix editor. +The matrix editor is a simple spread sheet for opening and edit e.g. csv-files, and for opening matrixes created in the JavaScript console. It is also possibly to create plots that are viewed in the chat view from the matrix editor.

Row and column headers

In some cases the data file has in the top row and/or the first (i.e. the left-most) data that is can be interpreted as column and/or row headers, e.g. the name of the properties, names of the molecules that is associated with the properties. If no row- or column-headers are set, then the column will be labeled A, B, C etc, and the rows will be numbered (i.e labeled 1, 2 ,3 etc), just as in e.g. Excel.
To be able to add the top row and the left column as column- respectively row-headers there are two toggle-buttons on Bioclipses toolbar, that are visibly when the matrix editor is active. To use the left column as row-header, or if it already have row-headers, let it be the first column, just click on the right-most button in the toolbar (when the matrix editor is active). To let the top row in the matrix editor jump up as column heder, or if the already are a column-header, move it down as top row just click on the button that are second from the right in the toolbar. The row and column headers can also be set from the pop-up menu in the matrixeditor. from It might be worth to notice that sometimes the matrix editor can in some cases guess if a file has row and column headers, and then set them automatic.

Plot from the matrix editor

-To plot from the matrix editor just select the data that are to be plotted and right click on the selection, then choose the wanted plot type from the submenu under chart in the pop-up menu. When plotting data from the matrix editor it's possibly to choose between four different types of diagram: Histogram, line plot, scatter plot and time series. The creation of a histogram differs from the other plot-types and will therefor be discussed in an own section below. +To plot from the matrix editor just select the data that are to be plotted and right click on the selection, then choose the wanted plot type from the submenu under chart in the pop-up menu. When plotting data from the matrix editor it's possibly to choose between four different types of diagram: Histogram, line plot, scatter plot and box plot. The creation of histograms and box plots differs from the other plot-types and will therefor be discussed in own sections below.

Plot one column

When all the selected values are from the same column, then the values of the cells will be plotted in respect to which row they originated from. I.e. the value of the cell will be on the y-axis and the row it is located on will be on the x-axis. The label on the y-axis will be the same as the column header (or the letter that is above that column if it don't have any column header). The x-axis label will in this case be just "Row" and then the axis will numerated from the start row to the last row of the plotted values. If one (or more) of the cells don't contain a number then an error message will be shown and only the cells with containing a number will be plotted.

Plot two columns

@@ -25,10 +25,14 @@

Plot several columns

The histogram

When a histogram is to be plotted the dialog to the right appears. It has four different settings they are, beginning with the one at the top and moving down, the title of the histogram (1), the label on the x-axis (2) and on the y-axis (3). And the last one is the number of bins (4) that the data will be divided into. +

The Box plot

+The box plot differs in that way that it will create one box per column made up of the data from that column. The column header will be visibly beneath each box along the x-axis.

Selections and the values in properties view

Since a selection in of one or more cells in matrix editor don't generate any thing in the properties view this sections will be about selections in a plot plotted with data from the matrix editor. When a plot has been made an then a selection in the matrix editor will high-light the corresponding point in the chart.
Selections made in the chart (see also the section about selection and zooming in the chart view help) will both high-light the corresponding cell(s) in the matrix editor and make a summation in the properties view. What is shown in the properties view depends on whether there's one or several points has been selected in the chart. For the case where two or more points have been selected, then the properties view will show (from the top row and down) the average value of the points, maximum value along the points, the minmum value and the number of points selected. If only one point is selected then the properties view will show the x- and y-values of the point together with the name of the labels. In both the cases the properties view will show the name of file (source) that the plotted values are from. Observe that the labels of values are sorted in the alphabetic order, here-since the order of the vales when one point is selected will depend on the x- and y-labels of the chart.

The histogram

Just as the process of creating a histogram differs from the other plots, so dose what happens when selecting in a histogram. Of cause it also makes high-lighting in the matrix editor, but instead of just the cell(s) that are involved in the selected bar it high-lights the hole row from wich the cell(s) originates from. Multi-selection, i.e. the ability to select more than one bar, is not supported in the histogram. Also what is shown in the in the properties view differ. As for a selection of several points in an other chart type the histogram reports the number of values that are involved in creating the bar and the name of the file (i.e. the source) that where used for creating the histogram. The properties on the first and second row is called max- and min-value, and are the highest (i.e. max) and lowest (i.e. min) value that the selected bar has on the x-axis. +

The Box plot

+The box plot does not support selections, neither does it update the properties view at the moment. \ No newline at end of file diff --git a/plugins/net.bioclipse.statistics/html/plotFrMolTableEditor.html b/plugins/net.bioclipse.statistics/html/plotFrMolTableEditor.html deleted file mode 100644 index 3643b39..0000000 --- a/plugins/net.bioclipse.statistics/html/plotFrMolTableEditor.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - Bioclipse Help - - - - -

Plot from the Molecules Table Editor

-From a selection of some or all values from one or two columns there is possibly to make a scatterplot. This by right clicking on the selection and then choosing Plot column in the pop-up menu.

-

Plot one column

-If selecting all or only some values from one column and choosing to plot them, they will be plotted in respect to the row they are on. I.e. the x-axis will hold the row number of the values and the y-axis the values. The label on the x-axis will be "Row number" and on the y-axes the name of the column that contains the values. If a value in a cell isn't a number, then it will not be plotted. This means that if non of the values that is selected ar non-numbers the plot will be empty.
-

The 2D-structure column

-The column that displays the 2D-structure has been given a special roll in the plotting. Selecting some or all in this column will calculate and plot the mass of the molecule. The name of the axis that corresponds to this column is "Molecular mass". Because the values are calculated just before they are plotted, it might take some time if the are manny and/or lage structures.
-

Plot two columns

-If the values from two different columns are selected they will be plotted in respect to each other. Where the values of the column to the left will be on the x-axis and the one to the right on the y-axis. So by moving the columns in respect to each other its possibly to decide which columns values that are to be on which axis. The labels on the axis will corresponds to the name of the name of column the values are from.
-

Plot several columns

-Plotting values from more than two columns is not supported for the moment. However, if values from more than two columns are selected only the values from the left-most column will be used and then plotted in respect to the row they are on, just as for selection in a single column.
-

Selections

-For more information about how the chart view works can be found here. However, below are some notes about selections in the chart when plotted from the Molecules Table Editor.
-When some values has been plotted then a selection in the plot will high-light the corresponding row(s) in the Molecules Table Editor. And the other way around, a selection in the Molecules Table Editor will high-light the corresponding point(s) in the plot. Observe that if the SD-file in the Molecules Table Editor are closed and then reopen the chart will not recognize it as the source for the plotted data, and therefor the interaction will not work.
-

Selections in the Chart

-Except for high-lighting in the corresponding rows a selection in the chart will show information about the selections in the properties view. Where it is located depends on the settings, but most likely it is below the Molecules Table Editor. If the view not open then it's possibly to open it via the menu Window > Show view > Others... > properties view.
-When selecting one point is selected the properties view will show the x-value of the point together with the label of the x-axis, and the y-value together with its label. If two or more values are selected the properties view will show (from the top row and down) the average value of the points, maximum value along the points, the minmum value and the number of points selected. In both the cases the properties view will show the name of file (source) that the plotted values are from. Observe that the labels of values are sorted in the alphabetic order, here-since the order of the vales when one point is selected will depend on the x- and y-labels of the chart. -

Selections in the Molecules Table Editor

-When making a selection in the Molecules Table Editor the properties view will show information about the molecule on the selected row. E.g. if the SD-file contains 2D- and/or 3D-coordinates, the properties etc. If several rows are selected it will show this information for the molecule, of the selected, that has the lowers row number, i.e. the molecules on the upper-most row of the selected. - - \ No newline at end of file diff --git a/plugins/net.bioclipse.statistics/mtePlottingToc.xml b/plugins/net.bioclipse.statistics/mtePlottingToc.xml deleted file mode 100644 index 58c1e5c..0000000 --- a/plugins/net.bioclipse.statistics/mtePlottingToc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/plugins/net.bioclipse.statistics/plugin.xml b/plugins/net.bioclipse.statistics/plugin.xml index d33aac3..91d6459 100644 --- a/plugins/net.bioclipse.statistics/plugin.xml +++ b/plugins/net.bioclipse.statistics/plugin.xml @@ -102,6 +102,10 @@ file="toc.xml" primary="false"> + + diff --git a/plugins/net.bioclipse.statistics/src/net/bioclipse/statistics/editors/MatrixEditor.java b/plugins/net.bioclipse.statistics/src/net/bioclipse/statistics/editors/MatrixEditor.java index 70f59fa..a1f7c75 100644 --- a/plugins/net.bioclipse.statistics/src/net/bioclipse/statistics/editors/MatrixEditor.java +++ b/plugins/net.bioclipse.statistics/src/net/bioclipse/statistics/editors/MatrixEditor.java @@ -21,6 +21,8 @@ import java.util.Vector; import net.bioclipse.chart.ChartConstants; +import net.bioclipse.chart.ChartConstants.plotTypes; +import net.bioclipse.chart.ChartDescriptorFactory; import net.bioclipse.chart.ChartUtils; import net.bioclipse.chart.IChartDescriptor; import net.bioclipse.chart.ScatterPlotRenderer; @@ -472,12 +474,18 @@ public void run(){ } }; - final Action timeSeriesAction = new Action("&Time series plot"){ - public void run(){ - plot( ChartConstants.plotTypes.TIME_SERIES ); - } - }; +// final Action timeSeriesAction = new Action("&Time series plot"){ +// public void run(){ +// plot( ChartConstants.plotTypes.TIME_SERIES ); +// } +// }; + final Action boxPlotAction = new Action("&Box plot"){ + public void run(){ + plot( ChartConstants.plotTypes.BOX_PLOT); + } + }; + final Action histogramAction = new Action("&Histogram"){ @Override @@ -491,7 +499,8 @@ public void run() { MenuManager chartMenu = new MenuManager("Chart"); chartMenu.add(scatterPlotAction); chartMenu.add(linePlotAction); - chartMenu.add(timeSeriesAction); +// chartMenu.add(timeSeriesAction); + chartMenu.add(boxPlotAction); chartMenu.add(histogramAction); chartMenu.addMenuListener(new IMenuListener(){ @@ -504,8 +513,8 @@ public void menuAboutToShow(IMenuManager manager) { scatterPlotAction.setEnabled( atLeastOneColumn ); linePlotAction.setEnabled( atLeastOneColumn ); - timeSeriesAction.setEnabled( atLeastOneColumn ); - +// timeSeriesAction.setEnabled( atLeastOneColumn ); + boxPlotAction.setEnabled( atLeastOneColumn ); } }); @@ -867,49 +876,66 @@ public void plot( ChartConstants.plotTypes plotType ) } - //Setup a dialog where the user can adjust settings and plot if more than 2 - //columns are selected - - if( columnsVector.size() > 2) - { - ChartDialog chartDialog = new ChartDialog(Display.getCurrent() - .getActiveShell(), - SWT.NULL, plotType, columnsVector, true, this, cellSelection); - chartDialog.open(); - } - //If only 1 or 2 columns are selected no dialog is shown - else - { - ColumnData cdx,cdy; - if (columnsVector.size() == 1) { - cdy = ((ColumnData)columnsVector.get(0)); - cdx = new ColumnData("Row"); - int start = cdy.getIndices()[0]; - int end = cdy.getIndices().length+ start; - for (int i = start;i 2) + { + ChartDialog chartDialog = new ChartDialog(Display.getCurrent() + .getActiveShell(), + SWT.NULL, plotType, + columnsVector, + true, this, + cellSelection); + chartDialog.open(); + } + //If only 1 or 2 columns are selected no dialog is shown + else + { + ColumnData cdx,cdy; + if (columnsVector.size() == 1) { + cdy = ((ColumnData)columnsVector.get(0)); + cdx = new ColumnData("Row"); + int start = cdy.getIndices()[0]; + int end = cdy.getIndices().length+ start; + for (int i = start;i xValues = getCellValues(cSel, xLabel); - List yValues = getCellValues(cSel, yLabel); - if (!xValues.isEmpty() && !yValues.isEmpty()) - for (int i = 0;i xValues = getCellValues(cSel, xLabel); + List yValues = getCellValues(cSel, yLabel); + if (!xValues.isEmpty() && !yValues.isEmpty()) + for (int i = 0;i - +