Skip to content

Commit

Permalink
Heat map rendering has now been spun out into it's own library. It's …
Browse files Browse the repository at this point in the history
…now more flexible and more powerful.
  • Loading branch information
dbeaudoinfortin committed Nov 21, 2024
1 parent 8eb7e87 commit c3e10bd
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 707 deletions.
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@
<artifactId>stack-trace-compactor</artifactId>
<version>0.0.5</version>
</dependency>
<dependency>
<groupId>io.github.dbeaudoinfortin</groupId>
<artifactId>heatmaps</artifactId>
<version>0.0.2</version>
</dependency>
</dependencies>
<distributionManagement>
<repository>
Expand Down
20 changes: 17 additions & 3 deletions src/main/java/com/dbf/naps/data/analysis/DataQueryRecord.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

import org.apache.commons.csv.CSVPrinter;

public class DataQueryRecord {
import com.dbf.heatmaps.data.DataRecord;

public class DataQueryRecord implements DataRecord {
private Object field_0;
private Object field_1;
private Object field_2;
Expand Down Expand Up @@ -39,9 +41,21 @@ public void printToCSV(CSVPrinter printer, int fieldCount, boolean hasSampleCoun
printer.printRecord(values.toArray());
}

public BigDecimal getValue() {
return value;
@Override
public Object getX() {
return field_0;
}

@Override
public Object getY() {
return field_1;
}

@Override
public Double getValue() {
return value.doubleValue();
}

public void setValue(BigDecimal value) {
this.value = value;
}
Expand Down
173 changes: 0 additions & 173 deletions src/main/java/com/dbf/naps/data/analysis/heatmap/HeatMapGradient.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.dbf.heatmaps.HeatMapGradient;
import com.dbf.naps.data.analysis.DataQueryOptions;

public abstract class HeatMapOptions extends DataQueryOptions {
Expand All @@ -30,7 +31,7 @@ public abstract class HeatMapOptions extends DataQueryOptions {

getOptions().addOption("cub","colourUpperBound", true, "Heat map colour upper bound (inclusive).");
getOptions().addOption("clb","colourLowerBound", true, "Heat map colour lower bound (inclusive).");
getOptions().addOption("cg","colourGradient", true, "Heat map colour gradient choice. Values are 1-" + (HeatMapGradient.getGradientCount()) + " (inclusive).");
getOptions().addOption("cg","colourGradient", true, "Heat map colour gradient choice. Values are 1-" + (HeatMapGradient.getCannedGradientCount()) + " (inclusive).");
getOptions().addOption("csv","generateCSV", false, "Generate a corresponding CSV file containing the raw data for each heat map.");
getOptions().addOption("gl","gridlines", false, "Include grid lines.");
}
Expand Down Expand Up @@ -59,8 +60,8 @@ private void loadFromArgs(String[] args) throws IllegalArgumentException {
private void loadGradient(CommandLine cmd) {
if(cmd.hasOption("colourGradient")) {
colourGradient = Integer.parseInt(cmd.getOptionValue("colourGradient"));
if (colourGradient < 1 || colourGradient > HeatMapGradient.getGradientCount()) {
throw new IllegalArgumentException("Heat map colour gradient : " + colourGradient + ". Must be between 1 and " + HeatMapGradient.getGradientCount() + " (inclusive).");
if (colourGradient < 1 || colourGradient > HeatMapGradient.getCannedGradientCount()) {
throw new IllegalArgumentException("Heat map colour gradient : " + colourGradient + ". Must be between 1 and " + HeatMapGradient.getCannedGradientCount() + " (inclusive).");
}
log.info("Using heat map colour gradient " + colourGradient + ".");
} else {
Expand Down
Loading

0 comments on commit c3e10bd

Please sign in to comment.