Skip to content

Commit

Permalink
Merge pull request #7 from KlasJoenssson/Debugging
Browse files Browse the repository at this point in the history
Some more bug fixes.
  • Loading branch information
goglepox committed Dec 13, 2013
2 parents f97dde6 + f764acd commit 90abdfb
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 26 deletions.
2 changes: 2 additions & 0 deletions plugins/net.bioclipse.chart/.classpath
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="jars/batik-ext.jar"/>
<classpathentry exported="true" kind="lib" path="jars/batik-xml.jar"/>
<classpathentry exported="true" kind="lib" path="jars/batik-awt-util.jar"/>
<classpathentry exported="true" kind="lib" path="jars/batik-dom.jar"/>
<classpathentry exported="true" kind="lib" path="jars/batik-svggen.jar"/>
Expand Down
12 changes: 1 addition & 11 deletions plugins/net.bioclipse.chart/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,12 @@ Bundle-ClassPath: chart.jar,
jars/batik-svggen.jar,
jars/batik-awt-util.jar,
jars/batik-util.jar,
jars/xml-apis.jar,
jars/batik-anim.jar,
jars/batik-bridge.jar,
jars/batik-codec.jar,
jars/batik-css.jar,
jars/batik-ext.jar,
jars/batik-extension.jar,
jars/batik-gui-util.jar,
jars/batik-gvt.jar,
jars/batik-parser.jar,
jars/batik-script.jar,
jars/batik-svg-dom.jar,
jars/batik-swing.jar,
jars/batik-transcoder.jar,
jars/batik-xml.jar,
jars/js.jar
jars/batik-ext.jar
Export-Package: net.bioclipse.chart;uses:="net.bioclipse.chart.events,org.jfree.chart.renderer.xy",
net.bioclipse.chart.events;uses:="org.eclipse.jface.viewers",
net.bioclipse.chart.ui.business,
Expand Down
13 changes: 11 additions & 2 deletions plugins/net.bioclipse.chart/build.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
bin.includes = plugin.xml,\
META-INF/,\
icons/,\
jars/batik-awt-util.jar,\
jars/batik-dom.jar,\
jars/batik-svggen.jar,\
jars/batik-util.jar
jars/batik-util.jar,\
jars/batik-awt-util.jar,\
jars/batik-gui-util.jar,\
jars/batik-gvt.jar,\
jars/batik-parser.jar,\
jars/batik-svg-dom.jar,\
jars/batik-xml.jar,\
jars/batik-ext.jar
source.chart.jar = src/
bin.excludes = jars/batik-css.jar,\
jars/batik-anim.jar,\
jars/batik-codec.jar
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,12 @@
import org.jfree.chart.JFreeChart;
import org.jfree.chart.labels.XYItemLabelGenerator;
import org.jfree.chart.labels.XYToolTipGenerator;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.Plot;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer;
import org.jfree.chart.renderer.category.CategoryItemRenderer;
import org.jfree.chart.renderer.xy.XYBarRenderer;
import org.jfree.chart.renderer.xy.XYItemRenderer;
import org.jfree.data.category.DefaultCategoryDataset;
Expand Down Expand Up @@ -329,6 +333,9 @@ public static void boxPlot(IChartDescriptor descriptor) {
dataset,
false );

CategoryPlot plot = (CategoryPlot) chart.getPlot();
BoxAndWhiskerRenderer r = (BoxAndWhiskerRenderer) plot.getRenderer();
r.setMaximumBarWidth( 0.3 );

chartManager.put(chart, descriptor);
ChartViewMouseListener l = new ChartViewMouseListener( view, descriptor );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ private void addPropertiesWithValues() {
double xStart = ((HistogramDataset) dataset).getStartXValue( series, item );
PropertyDescriptor descriptor0 = new TextPropertyDescriptor(ChartConstants.MAX_VALUE, "Max value");
properties.add( descriptor0 );
valueMap.put( ChartConstants.MAX_VALUE, xStart );
valueMap.put( ChartConstants.MIN_VALUE, xStart );

double xEnd = ((HistogramDataset) dataset).getEndXValue( series, item );
PropertyDescriptor descriptor1 = new TextPropertyDescriptor(ChartConstants.MIN_VALUE, "Min value");
properties.add( descriptor1 );
valueMap.put( ChartConstants.MIN_VALUE, xStart);
valueMap.put( ChartConstants.MAX_VALUE, xEnd);

double items = ((HistogramDataset) dataset).getEndYValue( series, item );
PropertyDescriptor descriptor2 = new TextPropertyDescriptor(ChartConstants.ITEMS, "No of Selected values");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import net.bioclipse.chart.events.CellSelection;
import net.bioclipse.model.ChartAction;
import net.bioclipse.model.ChartActionFactory;
import net.bioclipse.model.ChartDescriptor;
import net.bioclipse.model.ChartEventType;
import net.bioclipse.model.ChartModelEvent;
import net.bioclipse.model.ChartModelListener;
Expand Down Expand Up @@ -385,12 +384,26 @@ public void run() {
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();
String toolTip;
if (cd.hasToolTips()) {
toolTip = cd.getToolTip( item );
if (toolTip.startsWith( "<html>" )) {
int index = toolTip.lastIndexOf( '\"' )-1;
final int height = (int) Math.round( chartPanel.getHeight() / 3 );
final int width = (int) Math.round( chartPanel.getWidth() / 3 );
StringBuilder newToolTip = new StringBuilder(toolTip.substring( 0, index ));
newToolTip.append( "?height=" );
newToolTip.append( height );
newToolTip.append( "&width=" );
newToolTip.append( width );
newToolTip.append( toolTip.substring( index+1 ) );
toolTip = newToolTip.toString();
}
} else
toolTip = dataset.getY( series, item ).toString();

return toolTip;
}

});
Expand Down
7 changes: 4 additions & 3 deletions plugins/net.bioclipse.statistics/html/ChartViewHelp.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ <h3>The properties view</h3>
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.
<h2>The different plot types</h2>
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.
<h3>Scatter plot</h3>
<h3>Line plot</h3>
<h3>Scatter and line plot</h3>
There is not so much to say about this plot types, they are ordinary scatter and line plots. Worth mention is that the tool-tip shown when hovering over a point in one of these plots will show an image of the molecule related to that point if the plot was made from the molecule table editor, otherwise it will most probably show the y-value of the point just as the point labels. Selections of one or more points will show information of them in the properties view as described in the section about it above. If the plot was made from an editor, then a selection in the chart will highlight the relavant values in that editor.
<h3>Histogram</h3>
When creating a histogram a small dialog will apear where it is possibly to set the name of the plot, x- and y-axis. It also possibly to set the number of bins to divide the data into. Selecting a pile in the histogram will update the properties view with information about the values in that pile. The values that are shown on the properties view are the interval of the pile as a max vale and a min value of the selected pile. It also shows how many values that are in the selected pile and if the histogram was created from an editor the name of the file in that editor will be shown. The point labels and tool-tip will show the interval of the pile(s).
<h3>Box plot</h3>
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.
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. If the there are outliers that are so off that they do not fit incide the diagram, this is marked with a triangle. If there are outliers that are outside the diagram this will be indicated with a triangle. If the are any outliers above the diagram a triangle will be in the in the top of the diagram pointing upwards, for outliers below the bottom of the diagram the triangle will be in the bottom of the diagram pointing downwards.
<h2>Scripting</h2>
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.
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -918,9 +918,9 @@ public void plot( ChartConstants.plotTypes plotType )
}


StringBuffer title = new StringBuffer( cdx.getLabel() );
StringBuffer title = new StringBuffer( cdy.getLabel() );
title.append( " against " );
title.append( cdy.getLabel() );
title.append( cdx.getLabel() );

descriptor = new ChartDescriptor(this,
plotType,
Expand Down

0 comments on commit 90abdfb

Please sign in to comment.