Example #1
0
 private RichTooltip buildTooltip() {
   if (histogram.countValues() == 0) {
     return null;
   }
   NumberFormat formatter = DecimalFormat.getNumberInstance();
   formatter.setMaximumFractionDigits(3);
   String average = formatter.format(histogram.getAverage());
   String averageInRange = formatter.format(histogram.getAverageInRange());
   RichTooltip richTooltip = new RichTooltip();
   richTooltip.setTitle("Statistics (In-Range)");
   richTooltip.addDescriptionSection(
       "<html><b># of Values:</b> "
           + histogram.countValues()
           + " ("
           + histogram.countInRange()
           + ")");
   richTooltip.addDescriptionSection(
       "<html><b>Average:</b> " + average + " (" + averageInRange + ")");
   richTooltip.addDescriptionSection(
       "<html><b>Median:</b> "
           + histogram.getMedian()
           + " ("
           + histogram.getMedianInRange()
           + ")");
   return richTooltip;
 }