e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
}
private void benchMark(final View view) {
final XYPlot plot = view.getChart().getPlot();
final Datasets datasets = plot.getDatasets();
// Reset plot domain to 'max zoom'
datasets.getDomainExtrema().copyTo(plot.getDomain());
final double dO = plot.getDomain().getStart();
final double cD = plot.getDomain().length();
final double dC = dO + cD / 2;
final int lim = GWT.isScript() ? 100 : 5;
final int numTrials = 4;
final double trialTimes[] = new double[numTrials];
if (benchTable == null) {
benchTable = new FlexTable();
RootPanel.get().add(benchTable);
}
benchTable.clear();
benchTable.getFlexCellFormatter().setColSpan(0, 0, 2);
benchTable
.setWidget(0, 0, new HTML("Trial Results (Trials=" + numTrials + ")"));
DeferredCommand.addCommand(new IncrementalCommand() {
int trialNum = 0;
int frameNum = 0;
double curTime = 0;
boolean doContinue = false;
public boolean execute() {
if (trialNum < numTrials) {
if (frameNum < lim) {
double ncd = cD - cD / 1.5 * ((double) frameNum / lim);
double ndo = dC - ncd / 2;
plot.getDomain().setEndpoints(ndo, ndo + ncd);
double start = Duration.currentTimeMillis();
view.getChart().redraw();
double end = Duration.currentTimeMillis();
curTime += end - start;
frameNum++;