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

fix heatmap tooltip

parent 282326f1
No related branches found
No related tags found
No related merge requests found
...@@ -985,45 +985,43 @@ public class BasePlot extends Plot ...@@ -985,45 +985,43 @@ public class BasePlot extends Plot
if(offset < 1) if(offset < 1)
offset = 0; offset = 0;
final int get_values_return_count = final int nvalues =
getBaseAlgorithm().getValueCount(); getBaseAlgorithm().getValueCount();
int xpos = getPointPosition(event.getPoint().x); int xpos = getPointPosition(event.getPoint().x);
//getXCoordinate(getWidthInBases(),
// offset, event.getPoint().x);
String tt = Integer.toString(xpos); String tt = Integer.toString(xpos);
NumberFormat df= NumberFormat.getNumberInstance(); NumberFormat df = NumberFormat.getNumberInstance();
df.setMaximumFractionDigits(2); df.setMaximumFractionDigits(2);
float ypos; for(int i = 0; i < nvalues; ++i)
for(int value_index = 0; value_index < get_values_return_count; tt += ", " + df.format(
++value_index) getYCoordinate(step_size, getWindowSize(),
{ offset, value_array_array[i], xpos));
ypos = getYCoordinate(step_size, getWindowSize(),
offset, value_array_array[value_index],
xpos);
tt = tt + ", " + df.format(ypos);
}
if(lines != null) if(lines != null)
{ {
// if heat map display column number // if heat map display column number
String plotType = lines[0].getPlotType(); String plotType = lines[0].getPlotType();
if(plotType.equals(LineAttributes.PLOT_TYPES[2])) if(plotType.equals(LineAttributes.PLOT_TYPES[2]))
{ {
final int graph_height = super.getSize().height - final int graph_height = getSize().height -
getLabelHeight() - getScaleHeight() - 2; getLabelHeight() - getScaleHeight() - 2;
float hgt = ((float)graph_height/(float)lines.length); int hgt = graph_height/value_array_array.length;
float mousePos = (float) (event.getPoint().getY()- float mousePos = (float) (event.getPoint().getY()-
getLabelHeight() - getScaleHeight() - 2.f ); getLabelHeight() - getScaleHeight() - 2.f );
int plotNumber = Math.round(( mousePos / hgt )+.5f); int plotNumber = Math.round(( mousePos / hgt )+.5f);
if(plotNumber < 1) if(plotNumber < 1)
plotNumber = 1; plotNumber = 1;
else if(plotNumber > value_array_array.length)
plotNumber = value_array_array.length;
if(nvalues > 5)
tt = Integer.toString(xpos)+", "+df.format(
getYCoordinate(step_size, getWindowSize(),
offset, value_array_array[plotNumber-1], xpos));
tt = "Plot number : "+plotNumber+"\n"+tt; tt = "Plot number : "+plotNumber+"\n"+tt;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment