Skip to content
Snippets Groups Projects
Commit f472c2b4 authored by tcarver's avatar tcarver
Browse files

add show average option

parent 70425791
Branches
Tags
No related merge requests found
......@@ -31,7 +31,6 @@ import uk.ac.sanger.artemis.plot.*;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.GridLayout;
......@@ -89,6 +88,8 @@ public abstract class Plot extends JPanel
**/
protected boolean recalculate_flag = true;
private boolean showAverage = true;
/**
* The x position of the last click or -1 if the user hasn't clicked
* anywhere yet or the user clicked outside the graph.
......@@ -293,10 +294,9 @@ public abstract class Plot extends JPanel
});
popup.add(setScale);
final JCheckBoxMenuItem scaling_toggle =
new JCheckBoxMenuItem("Scaling");
scaling_toggle.setState(getAlgorithm().scalingFlag());
final JCheckBoxMenuItem scaling_toggle =
new JCheckBoxMenuItem("Scaling",getAlgorithm().scalingFlag());
scaling_toggle.addItemListener(new ItemListener()
{
public void itemStateChanged(ItemEvent _)
......@@ -306,9 +306,18 @@ public abstract class Plot extends JPanel
repaint();
}
});
popup.add(scaling_toggle);
final JCheckBoxMenuItem showAverageLn = new JCheckBoxMenuItem("Show average", showAverage);
showAverageLn.addItemListener(new ItemListener()
{
public void itemStateChanged(ItemEvent _)
{
showAverage = showAverageLn.isSelected();
repaint();
}
});
popup.add(showAverageLn);
if(Plot.this instanceof BasePlot)
{
......@@ -450,8 +459,7 @@ public abstract class Plot extends JPanel
{
public void actionPerformed(ActionEvent e)
{
Dimension d = getSize();
rescale((int) (d.height * 0.9f));
rescale((int) (getSize().height * 0.9f));
}
});
......@@ -459,8 +467,7 @@ public abstract class Plot extends JPanel
{
public void actionPerformed(ActionEvent e)
{
Dimension d = getSize();
rescale((int) (d.height * 1.1f));
rescale((int) (getSize().height * 1.1f));
}
});
......@@ -478,12 +485,10 @@ public abstract class Plot extends JPanel
if(select == 1)
return;
try
{
final int value = Integer
.parseInt(newGraphHgt.getText().trim());
rescale(value);
rescale(Integer.parseInt(
newGraphHgt.getText().trim()));
}
catch(NumberFormatException nfe)
{
......@@ -953,7 +958,8 @@ public abstract class Plot extends JPanel
final float max_value)
{
// if a heatmap do not show the average
if(lines != null && lines[0].getPlotType().equals(LineAttributes.PLOT_TYPES[2]))
if(!showAverage || (
lines != null && lines[0].getPlotType().equals(LineAttributes.PLOT_TYPES[2])))
return;
final Float average = getAlgorithm().getAverage();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment