public void render(Writer w) throws IOException {
{
    final String summary="Showing samples: period=" + t.units;
    w.write("<table border=\"1\" summary=\"" + attrib(summary) + "\"\n>");
  }
{
    w.write(" <tr\n>");
    w.write("  <th></th\n>");
    w.write("  <th>" + "From: " + cdata(formatter.date(t.firstTimestamp)) + "</th\n>");
    w.write("  <th colspan=\"*\">" + "To: " + cdata(formatter.date(t.lastTimestamp)) + "</th\n>");
    w.write(" </tr\n>");
    w.write(" <tr\n>");
    w.write("  <th></th\n>");
    for (    ICounter counter : t.a) {
      w.write("  <th colspan=\"*\">");
      formatter.writeFullPath(w,counter.getPath());
      w.write("  </th\n>");
    }
    w.write(" </tr\n>");
    w.write(" <tr\n>");
    w.write("  <th>Timestamp</th>\n");
    for (    ICounter counter : t.a) {
      final String[] groups=QueryUtil.getCapturedGroups(pattern,counter);
      final String label;
      if (groups != null) {
        final StringBuilder sb=new StringBuilder();
        for (int i=0; i < groups.length; i++) {
          final String s=groups[i];
          if (i > 0)           sb.append(":");
          sb.append(s);
        }
        label=sb.toString();
      }
 else {
        label=counter.getName();
      }
      w.write("  <th>" + cdata(label) + "</th\n>");
    }
    w.write(" </tr\n>");
  }
  for (int row=0; row < t.nrows; row++) {
    final String[] valStr=new String[t.a.length];
    for (int col=0; col < t.ncols; col++) {
      final ICounter c=t.a[col];
      final IHistoryEntry e=t.data[row][col];
      valStr[col]=formatter.value(c,e == null ? "" : e.getValue());
    }
    final long timestamp=t.getTimestamp(row);
    w.write(" <tr\n>");
    w.write("  <td>" + cdata(formatter.date(timestamp)) + "</td\n>");
    for (    String s : valStr) {
      w.write("  <td>" + s + "</td\n>");
    }
    w.write(" </tr\n>");
  }
  w.write("</table\n>");
}

public void render ( Writer w ) throws IOException { { final String summary = "Showing samples: period=" + t . units ; w . write ( "<table border=\"1\" summary=\"" + attrib ( summary ) + "\"\n>" ) ; } { w . write ( " <tr\n>" ) ; w . write ( "  <th></th\n>" ) ; w . write ( "  <th>" + "From: " + cdata ( formatter . date ( t . firstTimestamp ) ) + "</th\n>" ) ; w . write ( "  <th colspan=\"*\">" + "To: " + cdata ( formatter . date ( t . lastTimestamp ) ) + "</th\n>" ) ; w . write ( " </tr\n>" ) ; w . write ( " <tr\n>" ) ; w . write ( "  <th></th\n>" ) ; for ( ICounter counter : t . a ) { w . write ( "  <th colspan=\"*\">" ) ; formatter . writeFullPath ( w , counter . getPath ( ) ) ; w . write ( "  </th\n>" ) ; } w . write ( " </tr\n>" ) ; w . write ( " <tr\n>" ) ; w . write ( "  <th>Timestamp</th>\n" ) ; for ( ICounter counter : t . a ) { final String [ ] groups = QueryUtil . getCapturedGroups ( pattern , counter ) ; final String label ; if ( groups != null ) { final StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < groups . length ; i ++ ) { final String s = groups [ i ] ; if ( i > 0 ) sb . append ( ":" ) ; sb . append ( s ) ; } label = sb . toString ( ) ; } else { label = counter . getName ( ) ; } w . write ( "  <th>" + cdata ( label ) + "</th\n>" ) ; } w . write ( " </tr\n>" ) ; } for ( int row = 0 ; row < t . nrows ; row ++ ) { final String [ ] valStr = new String [ t . a . length ] ; for ( int col = 0 ; col < t . ncols ; col ++ ) { final ICounter c = t . a [ col ] ; final IHistoryEntry e = t . data [ row ] [ col ] ; valStr [ col ] = formatter . value ( c , e == null ? "" : e . getValue ( ) ) ; } final long timestamp = t . getTimestamp ( row ) ; w . write ( " <tr\n>" ) ; w . write ( "  <td>" + cdata ( formatter . date ( timestamp ) ) + "</td\n>" ) ; for ( String s : valStr ) { w . write ( "  <td>" + s + "</td\n>" ) ; } w . write ( " </tr\n>" ) ; } w . write ( "</table\n>" ) ; }
generate the table . < p > the table has one column for each counter having history data . the 1st header row of the table has the counter path . the seconds header row has just the counter name . the data rows are the samples from each period of the history for each counter .
