draw points and percentile lines with the same color
This commit is contained in:
@@ -28,9 +28,18 @@ public class PercentileAggregate implements AggregateHandler{
|
|||||||
for (DataSeries dataSerie : dataSeries) {
|
for (DataSeries dataSerie : dataSeries) {
|
||||||
final AggregatedData aggregatedData = dataSerie.getAggregatedData();
|
final AggregatedData aggregatedData = dataSerie.getAggregatedData();
|
||||||
if (aggregatedData != null){
|
if (aggregatedData != null){
|
||||||
appendfln(result, "'%s' using 1:2 title '%s' with lines lw 1 axes x2y1, \\", //
|
appendfln(
|
||||||
aggregatedData.getDataFile().getAbsolutePath(),//
|
result,
|
||||||
dataSerie.getTitle()+" " +aggregatedData.getLabel());
|
"'%s' using 1:2 notitle with lines axes x2y1 lw 2 %s, \\", //
|
||||||
|
aggregatedData.getDataFile().getAbsolutePath(),//
|
||||||
|
dataSerie.getStyle()//
|
||||||
|
);
|
||||||
|
|
||||||
|
// appendfln(result, "'%s' using 1:2 title '%s' with lines axes x2y1 %s, \\", //
|
||||||
|
// aggregatedData.getDataFile().getAbsolutePath(),//
|
||||||
|
// dataSerie.getTitle()+" " +aggregatedData.getLabel(), // title
|
||||||
|
// dataSerie.getStyle()//
|
||||||
|
// );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package org.lucares.recommind.logs;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class DashTypes {
|
||||||
|
public static final List<String> DEFAULT = Arrays.asList(
|
||||||
|
"1",//
|
||||||
|
"2",//
|
||||||
|
"3",//
|
||||||
|
"4",//
|
||||||
|
"6",//
|
||||||
|
"\".\"",//
|
||||||
|
"\"-\"",//
|
||||||
|
"\"._\"",//
|
||||||
|
"\"..- \"",//
|
||||||
|
"\"(50,6,2,6)\""//
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -19,11 +19,16 @@ public interface DataSeries {
|
|||||||
return result < 0 ? -1 : (result > 0 ? 1 : 0);
|
return result < 0 ? -1 : (result > 0 ? 1 : 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
public String getId();
|
public String getIdAsString();
|
||||||
|
|
||||||
|
public int getId();
|
||||||
|
|
||||||
public String getTitle();
|
public String getTitle();
|
||||||
public int getValues();
|
public int getValues();
|
||||||
public long getMaxValue();
|
public long getMaxValue();
|
||||||
|
|
||||||
|
public void setStyle(String style);
|
||||||
|
public String getStyle();
|
||||||
|
|
||||||
public AggregatedData getAggregatedData();
|
public AggregatedData getAggregatedData();
|
||||||
|
|
||||||
@@ -74,5 +79,28 @@ public interface DataSeries {
|
|||||||
case NO_LIMIT:
|
case NO_LIMIT:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void setColors(List<DataSeries> dataSeries){
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
for (DataSeries dataSerie : dataSeries) {
|
||||||
|
|
||||||
|
final int numColors = GnuplotColorPalettes.DEFAULT.size();
|
||||||
|
final int numDashTypes = DashTypes.DEFAULT.size();
|
||||||
|
|
||||||
|
final String color = GnuplotColorPalettes.DEFAULT.get(i % numColors).getColor();
|
||||||
|
final String dashType = DashTypes.DEFAULT.get((i/numColors) % numDashTypes);
|
||||||
|
String style = String.format("lt %s dt %s ",//
|
||||||
|
color,//
|
||||||
|
dashType//
|
||||||
|
);
|
||||||
|
dataSerie.setStyle(style);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,21 +10,39 @@ public class FileBackedDataSeries implements DataSeries {
|
|||||||
|
|
||||||
private CsvSummary csvSummary;
|
private CsvSummary csvSummary;
|
||||||
|
|
||||||
private String id;
|
private int id;
|
||||||
|
|
||||||
private GnuplotLineType linetype;
|
private GnuplotLineType linetype;
|
||||||
|
|
||||||
|
|
||||||
public FileBackedDataSeries(String id, String title, CsvSummary csvSummary, GnuplotLineType linetype) {
|
private String style;
|
||||||
|
|
||||||
|
public FileBackedDataSeries(int id, String title, CsvSummary csvSummary,
|
||||||
|
GnuplotLineType linetype) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.csvSummary = csvSummary;
|
this.csvSummary = csvSummary;
|
||||||
this.linetype = linetype;
|
this.linetype = linetype;
|
||||||
}
|
}
|
||||||
public String getId() {
|
|
||||||
|
public String getIdAsString() {
|
||||||
|
return "id" + id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setStyle(String style) {
|
||||||
|
this.style = style;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getStyle() {
|
||||||
|
return style;
|
||||||
|
}
|
||||||
|
|
||||||
public File getDataFile() {
|
public File getDataFile() {
|
||||||
return csvSummary.getDataFile();
|
return csvSummary.getDataFile();
|
||||||
}
|
}
|
||||||
@@ -40,13 +58,18 @@ public class FileBackedDataSeries implements DataSeries {
|
|||||||
public long getMaxValue() {
|
public long getMaxValue() {
|
||||||
return csvSummary.getMaxValue();
|
return csvSummary.getMaxValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public AggregatedData getAggregatedData() {
|
public AggregatedData getAggregatedData() {
|
||||||
return csvSummary.getAggregatedData();
|
return csvSummary.getAggregatedData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGnuplotPlotDefinition() {
|
public String getGnuplotPlotDefinition() {
|
||||||
return String.format("'%s' using 1:2 title '%s' with %s, \\", getDataFile(),
|
return String.format("'%s' using 1:2 title '%s' with %s %s, \\", //
|
||||||
getTitle(), linetype);
|
getDataFile(),//
|
||||||
|
getTitle(),//
|
||||||
|
linetype, // line or points
|
||||||
|
style//
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,296 +1,26 @@
|
|||||||
package org.lucares.recommind.logs;
|
package org.lucares.recommind.logs;
|
||||||
|
|
||||||
public enum GnuplotColor {
|
public class GnuplotColor {
|
||||||
|
private final String color; // either a name ('darkorchid') or hex ('#00efcc')
|
||||||
ALICEBLUE("aliceblue"),
|
|
||||||
|
private GnuplotColor(String color) {
|
||||||
ANTIQUEWHITE("antiquewhite"),
|
this.color = color;
|
||||||
|
}
|
||||||
AQUA("aqua"),
|
|
||||||
|
public static GnuplotColor byHex(String aHex){
|
||||||
AQUAMARINE("aquamarine"),
|
return new GnuplotColor("rgb \"" + aHex+"\"");
|
||||||
|
}
|
||||||
AZURE("azure"),
|
|
||||||
|
public static GnuplotColor byName(GnuplotColorNames aName){
|
||||||
BEIGE("beige"),
|
return new GnuplotColor(aName.getColor());
|
||||||
|
}
|
||||||
BISQUE("bisque"),
|
|
||||||
|
public String getColor() {
|
||||||
BLACK("black"),
|
return color;
|
||||||
|
}
|
||||||
BLANCHEDALMOND("blanchedalmond"),
|
|
||||||
|
@Override
|
||||||
BLUE("blue"),
|
public String toString() {
|
||||||
|
return color;
|
||||||
BLUEVIOLET("blueviolet"),
|
}
|
||||||
|
}
|
||||||
BROWN("brown"),
|
|
||||||
|
|
||||||
BURLYWOOD("burlywood"),
|
|
||||||
|
|
||||||
CADETBLUE("cadetblue"),
|
|
||||||
|
|
||||||
CHARTREUSE("chartreuse"),
|
|
||||||
|
|
||||||
CHOCOLATE("chocolate"),
|
|
||||||
|
|
||||||
CORAL("coral"),
|
|
||||||
|
|
||||||
CORNFLOWERBLUE("cornflowerblue"),
|
|
||||||
|
|
||||||
CORNSILK("cornsilk"),
|
|
||||||
|
|
||||||
CRIMSON("crimson"),
|
|
||||||
|
|
||||||
CYAN("cyan"),
|
|
||||||
|
|
||||||
DARKBLUE("darkblue"),
|
|
||||||
|
|
||||||
DARKCYAN("darkcyan"),
|
|
||||||
|
|
||||||
DARKGOLDENROD("darkgoldenrod"),
|
|
||||||
|
|
||||||
DARKGRAY("darkgray"),
|
|
||||||
|
|
||||||
DARKGREEN("darkgreen"),
|
|
||||||
|
|
||||||
DARKKHAKI("darkkhaki"),
|
|
||||||
|
|
||||||
DARKMAGENTA("darkmagenta"),
|
|
||||||
|
|
||||||
DARKOLIVEGREEN("darkolivegreen"),
|
|
||||||
|
|
||||||
DARKORANGE("darkorange"),
|
|
||||||
|
|
||||||
DARKORCHID("darkorchid"),
|
|
||||||
|
|
||||||
DARKRED("darkred"),
|
|
||||||
|
|
||||||
DARKSALMON("darksalmon"),
|
|
||||||
|
|
||||||
DARKSEAGREEN("darkseagreen"),
|
|
||||||
|
|
||||||
DARKSLATEBLUE("darkslateblue"),
|
|
||||||
|
|
||||||
DARKSLATEGRAY("darkslategray"),
|
|
||||||
|
|
||||||
DARKTURQUOISE("darkturquoise"),
|
|
||||||
|
|
||||||
DARKVIOLET("darkviolet"),
|
|
||||||
|
|
||||||
DEEPPINK("deeppink"),
|
|
||||||
|
|
||||||
DEEPSKYBLUE("deepskyblue"),
|
|
||||||
|
|
||||||
DIMGRAY("dimgray"),
|
|
||||||
|
|
||||||
DODGERBLUE("dodgerblue"),
|
|
||||||
|
|
||||||
FIREBRICK("firebrick"),
|
|
||||||
|
|
||||||
FLORALWHITE("floralwhite"),
|
|
||||||
|
|
||||||
FORESTGREEN("forestgreen"),
|
|
||||||
|
|
||||||
FUCHSIA("fuchsia"),
|
|
||||||
|
|
||||||
GAINSBORO("gainsboro"),
|
|
||||||
|
|
||||||
GHOSTWHITE("ghostwhite"),
|
|
||||||
|
|
||||||
GOLD("gold"),
|
|
||||||
|
|
||||||
GOLDENROD("goldenrod"),
|
|
||||||
|
|
||||||
GRAY("gray"),
|
|
||||||
|
|
||||||
GREEN("green"),
|
|
||||||
|
|
||||||
GREENYELLOW("greenyellow"),
|
|
||||||
|
|
||||||
HONEYDEW("honeydew"),
|
|
||||||
|
|
||||||
HOTPINK("hotpink"),
|
|
||||||
|
|
||||||
INDIANRED("indianred"),
|
|
||||||
|
|
||||||
INDIGO("indigo"),
|
|
||||||
|
|
||||||
IVORY("ivory"),
|
|
||||||
|
|
||||||
KHAKI("khaki"),
|
|
||||||
|
|
||||||
LAVENDER("lavender"),
|
|
||||||
|
|
||||||
LAVENDERBLUSH("lavenderblush"),
|
|
||||||
|
|
||||||
LAWNGREEN("lawngreen"),
|
|
||||||
|
|
||||||
LEMONCHIFFON("lemonchiffon"),
|
|
||||||
|
|
||||||
LIGHTBLUE("lightblue"),
|
|
||||||
|
|
||||||
LIGHTCORAL("lightcoral"),
|
|
||||||
|
|
||||||
LIGHTCYAN("lightcyan"),
|
|
||||||
|
|
||||||
LIGHTGOLDENRODYE("lightgoldenrodye"),
|
|
||||||
|
|
||||||
LIGHTGREEN("lightgreen"),
|
|
||||||
|
|
||||||
LIGHTGREY("lightgrey"),
|
|
||||||
|
|
||||||
LIGHTPINK("lightpink"),
|
|
||||||
|
|
||||||
LIGHTSALMON("lightsalmon"),
|
|
||||||
|
|
||||||
LIGHTSEAGREEN("lightseagreen"),
|
|
||||||
|
|
||||||
LIGHTSKYBLUE("lightskyblue"),
|
|
||||||
|
|
||||||
LIGHTSLATEGRAY("lightslategray"),
|
|
||||||
|
|
||||||
LIGHTSTEELBLUE("lightsteelblue"),
|
|
||||||
|
|
||||||
LIGHTYELLOW("lightyellow"),
|
|
||||||
|
|
||||||
LIME("lime"),
|
|
||||||
|
|
||||||
LIMEGREEN("limegreen"),
|
|
||||||
|
|
||||||
LINEN("linen"),
|
|
||||||
|
|
||||||
MAGENTA("magenta"),
|
|
||||||
|
|
||||||
MAROON("maroon"),
|
|
||||||
|
|
||||||
MEDIUMAQUAMARINE("mediumaquamarine"),
|
|
||||||
|
|
||||||
MEDIUMBLUE("mediumblue"),
|
|
||||||
|
|
||||||
MEDIUMORCHID("mediumorchid"),
|
|
||||||
|
|
||||||
MEDIUMPURPLE("mediumpurple"),
|
|
||||||
|
|
||||||
MEDIUMSEAGREEN("mediumseagreen"),
|
|
||||||
|
|
||||||
MEDIUMSLATEBLUE("mediumslateblue"),
|
|
||||||
|
|
||||||
MEDIUMSPRINGGREE("mediumspringgree"),
|
|
||||||
|
|
||||||
MEDIUMTURQUOISE("mediumturquoise"),
|
|
||||||
|
|
||||||
MEDIUMVIOLETRED("mediumvioletred"),
|
|
||||||
|
|
||||||
MIDNIGHTBLUE("midnightblue"),
|
|
||||||
|
|
||||||
MINTCREAM("mintcream"),
|
|
||||||
|
|
||||||
MISTYROSE("mistyrose"),
|
|
||||||
|
|
||||||
MOCCASIN("moccasin"),
|
|
||||||
|
|
||||||
NAVAJOWHITE("navajowhite"),
|
|
||||||
|
|
||||||
NAVY("navy"),
|
|
||||||
|
|
||||||
NAVYBLUE("navyblue"),
|
|
||||||
|
|
||||||
OLDLACE("oldlace"),
|
|
||||||
|
|
||||||
OLIVE("olive"),
|
|
||||||
|
|
||||||
OLIVEDRAB("olivedrab"),
|
|
||||||
|
|
||||||
ORANGE("orange"),
|
|
||||||
|
|
||||||
ORANGERED("orangered"),
|
|
||||||
|
|
||||||
ORCHID("orchid"),
|
|
||||||
|
|
||||||
PALEGOLDENROD("palegoldenrod"),
|
|
||||||
|
|
||||||
PALEGREEN("palegreen"),
|
|
||||||
|
|
||||||
PALETURQUOISE("paleturquoise"),
|
|
||||||
|
|
||||||
PALEVIOLETRED("palevioletred"),
|
|
||||||
|
|
||||||
PAPAYAWHIP("papayawhip"),
|
|
||||||
|
|
||||||
PEACHPUFF("peachpuff"),
|
|
||||||
|
|
||||||
PERU("peru"),
|
|
||||||
|
|
||||||
PINK("pink"),
|
|
||||||
|
|
||||||
PLUM("plum"),
|
|
||||||
|
|
||||||
POWDERBLUE("powderblue"),
|
|
||||||
|
|
||||||
PURPLE("purple"),
|
|
||||||
|
|
||||||
RED("red"),
|
|
||||||
|
|
||||||
ROSYBROWN("rosybrown"),
|
|
||||||
|
|
||||||
ROYALBLUE("royalblue"),
|
|
||||||
|
|
||||||
SADDLEBROWN("saddlebrown"),
|
|
||||||
|
|
||||||
SALMON("salmon"),
|
|
||||||
|
|
||||||
SANDYBROWN("sandybrown"),
|
|
||||||
|
|
||||||
SEAGREEN("seagreen"),
|
|
||||||
|
|
||||||
SEASHELL("seashell"),
|
|
||||||
|
|
||||||
SIENNA("sienna"),
|
|
||||||
|
|
||||||
SILVER("silver"),
|
|
||||||
|
|
||||||
SKYBLUE("skyblue"),
|
|
||||||
|
|
||||||
SLATEBLUE("slateblue"),
|
|
||||||
|
|
||||||
SLATEGRAY("slategray"),
|
|
||||||
|
|
||||||
SNOW("snow"),
|
|
||||||
|
|
||||||
SPRINGGREEN("springgreen"),
|
|
||||||
|
|
||||||
STEELBLUE("steelblue"),
|
|
||||||
|
|
||||||
TAN("tan"),
|
|
||||||
|
|
||||||
TEAL("teal"),
|
|
||||||
|
|
||||||
THISTLE("thistle"),
|
|
||||||
|
|
||||||
TOMATO("tomato"),
|
|
||||||
|
|
||||||
TURQUOISE("turquoise"),
|
|
||||||
|
|
||||||
VIOLET("violet"),
|
|
||||||
|
|
||||||
WHEAT("wheat"),
|
|
||||||
|
|
||||||
WHITE("white"),
|
|
||||||
|
|
||||||
WHITESMOKE("whitesmoke"),
|
|
||||||
|
|
||||||
YELLOW("yellow"),
|
|
||||||
|
|
||||||
YELLOWGREEN("yellowgreen");
|
|
||||||
|
|
||||||
private final String color;
|
|
||||||
|
|
||||||
private GnuplotColor(final String color) {
|
|
||||||
this.color = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getColor() {
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -0,0 +1,300 @@
|
|||||||
|
package org.lucares.recommind.logs;
|
||||||
|
|
||||||
|
public enum GnuplotColorNames {
|
||||||
|
|
||||||
|
ALICEBLUE("aliceblue"),
|
||||||
|
|
||||||
|
ANTIQUEWHITE("antiquewhite"),
|
||||||
|
|
||||||
|
AQUA("aqua"),
|
||||||
|
|
||||||
|
AQUAMARINE("aquamarine"),
|
||||||
|
|
||||||
|
AZURE("azure"),
|
||||||
|
|
||||||
|
BEIGE("beige"),
|
||||||
|
|
||||||
|
BISQUE("bisque"),
|
||||||
|
|
||||||
|
BLACK("black"),
|
||||||
|
|
||||||
|
BLANCHEDALMOND("blanchedalmond"),
|
||||||
|
|
||||||
|
BLUE("blue"),
|
||||||
|
|
||||||
|
BLUEVIOLET("blueviolet"),
|
||||||
|
|
||||||
|
BROWN("brown"),
|
||||||
|
|
||||||
|
BURLYWOOD("burlywood"),
|
||||||
|
|
||||||
|
CADETBLUE("cadetblue"),
|
||||||
|
|
||||||
|
CHARTREUSE("chartreuse"),
|
||||||
|
|
||||||
|
CHOCOLATE("chocolate"),
|
||||||
|
|
||||||
|
CORAL("coral"),
|
||||||
|
|
||||||
|
CORNFLOWERBLUE("cornflowerblue"),
|
||||||
|
|
||||||
|
CORNSILK("cornsilk"),
|
||||||
|
|
||||||
|
CRIMSON("crimson"),
|
||||||
|
|
||||||
|
CYAN("cyan"),
|
||||||
|
|
||||||
|
DARKBLUE("darkblue"),
|
||||||
|
|
||||||
|
DARKCYAN("darkcyan"),
|
||||||
|
|
||||||
|
DARKGOLDENROD("darkgoldenrod"),
|
||||||
|
|
||||||
|
DARKGRAY("darkgray"),
|
||||||
|
|
||||||
|
DARKGREEN("darkgreen"),
|
||||||
|
|
||||||
|
DARKKHAKI("darkkhaki"),
|
||||||
|
|
||||||
|
DARKMAGENTA("darkmagenta"),
|
||||||
|
|
||||||
|
DARKOLIVEGREEN("darkolivegreen"),
|
||||||
|
|
||||||
|
DARKORANGE("darkorange"),
|
||||||
|
|
||||||
|
DARKORCHID("darkorchid"),
|
||||||
|
|
||||||
|
DARKRED("darkred"),
|
||||||
|
|
||||||
|
DARKSALMON("darksalmon"),
|
||||||
|
|
||||||
|
DARKSEAGREEN("darkseagreen"),
|
||||||
|
|
||||||
|
DARKSLATEBLUE("darkslateblue"),
|
||||||
|
|
||||||
|
DARKSLATEGRAY("darkslategray"),
|
||||||
|
|
||||||
|
DARKTURQUOISE("darkturquoise"),
|
||||||
|
|
||||||
|
DARKVIOLET("darkviolet"),
|
||||||
|
|
||||||
|
DEEPPINK("deeppink"),
|
||||||
|
|
||||||
|
DEEPSKYBLUE("deepskyblue"),
|
||||||
|
|
||||||
|
DIMGRAY("dimgray"),
|
||||||
|
|
||||||
|
DODGERBLUE("dodgerblue"),
|
||||||
|
|
||||||
|
FIREBRICK("firebrick"),
|
||||||
|
|
||||||
|
FLORALWHITE("floralwhite"),
|
||||||
|
|
||||||
|
FORESTGREEN("forestgreen"),
|
||||||
|
|
||||||
|
FUCHSIA("fuchsia"),
|
||||||
|
|
||||||
|
GAINSBORO("gainsboro"),
|
||||||
|
|
||||||
|
GHOSTWHITE("ghostwhite"),
|
||||||
|
|
||||||
|
GOLD("gold"),
|
||||||
|
|
||||||
|
GOLDENROD("goldenrod"),
|
||||||
|
|
||||||
|
GRAY("gray"),
|
||||||
|
|
||||||
|
GREEN("green"),
|
||||||
|
|
||||||
|
GREENYELLOW("greenyellow"),
|
||||||
|
|
||||||
|
HONEYDEW("honeydew"),
|
||||||
|
|
||||||
|
HOTPINK("hotpink"),
|
||||||
|
|
||||||
|
INDIANRED("indianred"),
|
||||||
|
|
||||||
|
INDIGO("indigo"),
|
||||||
|
|
||||||
|
IVORY("ivory"),
|
||||||
|
|
||||||
|
KHAKI("khaki"),
|
||||||
|
|
||||||
|
LAVENDER("lavender"),
|
||||||
|
|
||||||
|
LAVENDERBLUSH("lavenderblush"),
|
||||||
|
|
||||||
|
LAWNGREEN("lawngreen"),
|
||||||
|
|
||||||
|
LEMONCHIFFON("lemonchiffon"),
|
||||||
|
|
||||||
|
LIGHTBLUE("lightblue"),
|
||||||
|
|
||||||
|
LIGHTCORAL("lightcoral"),
|
||||||
|
|
||||||
|
LIGHTCYAN("lightcyan"),
|
||||||
|
|
||||||
|
LIGHTGOLDENRODYE("lightgoldenrodye"),
|
||||||
|
|
||||||
|
LIGHTGREEN("lightgreen"),
|
||||||
|
|
||||||
|
LIGHTGREY("lightgrey"),
|
||||||
|
|
||||||
|
LIGHTPINK("lightpink"),
|
||||||
|
|
||||||
|
LIGHTSALMON("lightsalmon"),
|
||||||
|
|
||||||
|
LIGHTSEAGREEN("lightseagreen"),
|
||||||
|
|
||||||
|
LIGHTSKYBLUE("lightskyblue"),
|
||||||
|
|
||||||
|
LIGHTSLATEGRAY("lightslategray"),
|
||||||
|
|
||||||
|
LIGHTSTEELBLUE("lightsteelblue"),
|
||||||
|
|
||||||
|
LIGHTYELLOW("lightyellow"),
|
||||||
|
|
||||||
|
LIME("lime"),
|
||||||
|
|
||||||
|
LIMEGREEN("limegreen"),
|
||||||
|
|
||||||
|
LINEN("linen"),
|
||||||
|
|
||||||
|
MAGENTA("magenta"),
|
||||||
|
|
||||||
|
MAROON("maroon"),
|
||||||
|
|
||||||
|
MEDIUMAQUAMARINE("mediumaquamarine"),
|
||||||
|
|
||||||
|
MEDIUMBLUE("mediumblue"),
|
||||||
|
|
||||||
|
MEDIUMORCHID("mediumorchid"),
|
||||||
|
|
||||||
|
MEDIUMPURPLE("mediumpurple"),
|
||||||
|
|
||||||
|
MEDIUMSEAGREEN("mediumseagreen"),
|
||||||
|
|
||||||
|
MEDIUMSLATEBLUE("mediumslateblue"),
|
||||||
|
|
||||||
|
MEDIUMSPRINGGREE("mediumspringgree"),
|
||||||
|
|
||||||
|
MEDIUMTURQUOISE("mediumturquoise"),
|
||||||
|
|
||||||
|
MEDIUMVIOLETRED("mediumvioletred"),
|
||||||
|
|
||||||
|
MIDNIGHTBLUE("midnightblue"),
|
||||||
|
|
||||||
|
MINTCREAM("mintcream"),
|
||||||
|
|
||||||
|
MISTYROSE("mistyrose"),
|
||||||
|
|
||||||
|
MOCCASIN("moccasin"),
|
||||||
|
|
||||||
|
NAVAJOWHITE("navajowhite"),
|
||||||
|
|
||||||
|
NAVY("navy"),
|
||||||
|
|
||||||
|
NAVYBLUE("navyblue"),
|
||||||
|
|
||||||
|
OLDLACE("oldlace"),
|
||||||
|
|
||||||
|
OLIVE("olive"),
|
||||||
|
|
||||||
|
OLIVEDRAB("olivedrab"),
|
||||||
|
|
||||||
|
ORANGE("orange"),
|
||||||
|
|
||||||
|
ORANGERED("orangered"),
|
||||||
|
|
||||||
|
ORCHID("orchid"),
|
||||||
|
|
||||||
|
PALEGOLDENROD("palegoldenrod"),
|
||||||
|
|
||||||
|
PALEGREEN("palegreen"),
|
||||||
|
|
||||||
|
PALETURQUOISE("paleturquoise"),
|
||||||
|
|
||||||
|
PALEVIOLETRED("palevioletred"),
|
||||||
|
|
||||||
|
PAPAYAWHIP("papayawhip"),
|
||||||
|
|
||||||
|
PEACHPUFF("peachpuff"),
|
||||||
|
|
||||||
|
PERU("peru"),
|
||||||
|
|
||||||
|
PINK("pink"),
|
||||||
|
|
||||||
|
PLUM("plum"),
|
||||||
|
|
||||||
|
POWDERBLUE("powderblue"),
|
||||||
|
|
||||||
|
PURPLE("purple"),
|
||||||
|
|
||||||
|
RED("red"),
|
||||||
|
|
||||||
|
ROSYBROWN("rosybrown"),
|
||||||
|
|
||||||
|
ROYALBLUE("royalblue"),
|
||||||
|
|
||||||
|
SADDLEBROWN("saddlebrown"),
|
||||||
|
|
||||||
|
SALMON("salmon"),
|
||||||
|
|
||||||
|
SANDYBROWN("sandybrown"),
|
||||||
|
|
||||||
|
SEAGREEN("seagreen"),
|
||||||
|
|
||||||
|
SEASHELL("seashell"),
|
||||||
|
|
||||||
|
SIENNA("sienna"),
|
||||||
|
|
||||||
|
SILVER("silver"),
|
||||||
|
|
||||||
|
SKYBLUE("skyblue"),
|
||||||
|
|
||||||
|
SLATEBLUE("slateblue"),
|
||||||
|
|
||||||
|
SLATEGRAY("slategray"),
|
||||||
|
|
||||||
|
SNOW("snow"),
|
||||||
|
|
||||||
|
SPRINGGREEN("springgreen"),
|
||||||
|
|
||||||
|
STEELBLUE("steelblue"),
|
||||||
|
|
||||||
|
TAN("tan"),
|
||||||
|
|
||||||
|
TEAL("teal"),
|
||||||
|
|
||||||
|
THISTLE("thistle"),
|
||||||
|
|
||||||
|
TOMATO("tomato"),
|
||||||
|
|
||||||
|
TURQUOISE("turquoise"),
|
||||||
|
|
||||||
|
VIOLET("violet"),
|
||||||
|
|
||||||
|
WHEAT("wheat"),
|
||||||
|
|
||||||
|
WHITE("white"),
|
||||||
|
|
||||||
|
WHITESMOKE("whitesmoke"),
|
||||||
|
|
||||||
|
YELLOW("yellow"),
|
||||||
|
|
||||||
|
YELLOWGREEN("yellowgreen");
|
||||||
|
|
||||||
|
private final String color;
|
||||||
|
|
||||||
|
private GnuplotColorNames(final String color) {
|
||||||
|
this.color = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getColor() {
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GnuplotColor toColor(){
|
||||||
|
return GnuplotColor.byName(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package org.lucares.recommind.logs;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface GnuplotColorPalettes {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
<div style="background-color: #9400D3; display:inline;">#9400D3</div>
|
||||||
|
<div style="background-color: #009e73; display:inline;">#009e73</div>
|
||||||
|
<div style="background-color: #56b4e9; display:inline;">#56b4e9</div>
|
||||||
|
<div style="background-color: #e69f00; display:inline;">#e69f00</div>
|
||||||
|
<div style="background-color: #f0e442; display:inline;">#f0e442</div>
|
||||||
|
<div style="background-color: #0072b2; display:inline;">#0072b2</div>
|
||||||
|
<div style="background-color: #e51e10; display:inline;">#e51e10</div>
|
||||||
|
<div style="background-color: blue; display:inline;">blue</div>
|
||||||
|
<div style="background-color: #FF69B4; display:inline;">#FF69B4</div>
|
||||||
|
<div style="background-color: #00BFFF; display:inline;">#00BFFF</div>
|
||||||
|
<div style="background-color: black; display:inline;">black</div>
|
||||||
|
*/
|
||||||
|
|
||||||
|
List<GnuplotColor> DEFAULT = Arrays.asList(
|
||||||
|
GnuplotColor.byHex("#9400D3"),//
|
||||||
|
GnuplotColor.byHex("#009e73"),//
|
||||||
|
GnuplotColor.byHex("#56b4e9"),//
|
||||||
|
GnuplotColor.byHex("#e69f00"),//
|
||||||
|
GnuplotColor.byHex("#f0e442"),//
|
||||||
|
GnuplotColor.byHex("#0072b2"),//
|
||||||
|
GnuplotColor.byHex("#e51e10"),//
|
||||||
|
GnuplotColor.byHex("#0000FF"),//
|
||||||
|
GnuplotColor.byHex("#FF69B4"),//
|
||||||
|
GnuplotColor.byHex("#00BFFF"),//
|
||||||
|
GnuplotColorNames.BLACK.toColor()//
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -30,16 +30,9 @@ public class GnuplotFileGenerator {
|
|||||||
appendfln(result, "set xtics rotate by %d", xAxis.getRotateXAxisLabel());
|
appendfln(result, "set xtics rotate by %d", xAxis.getRotateXAxisLabel());
|
||||||
appendfln(result, "set xrange [\"%s\":\"%s\"]", xAxis.getFrom(), xAxis.getTo());
|
appendfln(result, "set xrange [\"%s\":\"%s\"]", xAxis.getFrom(), xAxis.getTo());
|
||||||
|
|
||||||
/*
|
appendfln(result, "set x2label \"percentile\"");
|
||||||
* set yrange ["0":"100"]
|
appendln(result, "set format x2 \"%.0f%%\"");
|
||||||
set ytics nomirror # don't show the tics of the left y-axis on the right side
|
appendfln(result, "set x2tics");
|
||||||
|
|
||||||
set y2label "CPU load"
|
|
||||||
set y2tics
|
|
||||||
set autoscale y2
|
|
||||||
*/
|
|
||||||
appendfln(result, "set x2label \"percent\"");
|
|
||||||
appendfln(result, "set y2tics");
|
|
||||||
appendfln(result, "set x2range [\"0\":\"100\"]");
|
appendfln(result, "set x2range [\"0\":\"100\"]");
|
||||||
|
|
||||||
final long graphOffset = settings.getYAxisScale() == AxisScale.LINEAR ? 0 : 1;
|
final long graphOffset = settings.getYAxisScale() == AxisScale.LINEAR ? 0 : 1;
|
||||||
@@ -84,6 +77,11 @@ public class GnuplotFileGenerator {
|
|||||||
private void appendfln(final StringBuilder builder, final String format, final Object... args) {
|
private void appendfln(final StringBuilder builder, final String format, final Object... args) {
|
||||||
builder.append(String.format(format + "\n", args));
|
builder.append(String.format(format + "\n", args));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void appendln(final StringBuilder builder, final String string) {
|
||||||
|
builder.append(string+"\n");
|
||||||
|
}
|
||||||
|
|
||||||
private void appendf(final StringBuilder builder, final String format, final Object... args) {
|
private void appendf(final StringBuilder builder, final String format, final Object... args) {
|
||||||
builder.append(String.format(format, args));
|
builder.append(String.format(format, args));
|
||||||
|
|||||||
@@ -7,12 +7,12 @@ public class InlineDataSeries implements DataSeries{
|
|||||||
private long maxValue;
|
private long maxValue;
|
||||||
private int numValues;
|
private int numValues;
|
||||||
private String title;
|
private String title;
|
||||||
private String id;
|
private int id;
|
||||||
private String inlineData;
|
private String inlineData;
|
||||||
|
private String style;
|
||||||
|
|
||||||
public InlineDataSeries(long maxValue, int numValues, String title,
|
public InlineDataSeries(long maxValue, int numValues, String title,
|
||||||
String id, String inlineData) {
|
int id, String inlineData) {
|
||||||
super();
|
|
||||||
this.maxValue = maxValue;
|
this.maxValue = maxValue;
|
||||||
this.numValues = numValues;
|
this.numValues = numValues;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
@@ -21,10 +21,25 @@ public class InlineDataSeries implements DataSeries{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getId() {
|
public String getIdAsString() {
|
||||||
|
|
||||||
|
return "id"+id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setStyle(String style) {
|
||||||
|
this.style = style;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getStyle() {
|
||||||
|
return style;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
|
|||||||
@@ -74,8 +74,7 @@ public class PercentilePlot implements ConcretePlotter {
|
|||||||
.forEach(
|
.forEach(
|
||||||
groupResult -> {
|
groupResult -> {
|
||||||
try {
|
try {
|
||||||
final String id = "id"
|
final int id = idCounter.getAndIncrement();
|
||||||
+ idCounter.getAndIncrement();
|
|
||||||
|
|
||||||
final FileBackedDataSeries dataSerie = toCsv(
|
final FileBackedDataSeries dataSerie = toCsv(
|
||||||
id, groupResult, tmpDir, dateFrom,
|
id, groupResult, tmpDir, dateFrom,
|
||||||
@@ -127,7 +126,7 @@ public class PercentilePlot implements ConcretePlotter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private FileBackedDataSeries toCsv(String id, GroupResult groupResult,
|
private FileBackedDataSeries toCsv(int id, GroupResult groupResult,
|
||||||
Path tmpDir, OffsetDateTime dateFrom, OffsetDateTime dateTo,
|
Path tmpDir, OffsetDateTime dateFrom, OffsetDateTime dateTo,
|
||||||
PlotSettings plotSettings) throws IOException {
|
PlotSettings plotSettings) throws IOException {
|
||||||
|
|
||||||
|
|||||||
@@ -86,9 +86,9 @@ public class ScatterPlot implements ConcretePlotter {
|
|||||||
try{
|
try{
|
||||||
final CsvSummary csvSummary = toCsv(groupResult, tmpDir, dateFrom, dateTo, plotSettings);
|
final CsvSummary csvSummary = toCsv(groupResult, tmpDir, dateFrom, dateTo, plotSettings);
|
||||||
|
|
||||||
final int id = idCounter.getAndIncrement();
|
final int id = idCounter.incrementAndGet();
|
||||||
final String title = ConcretePlotter.title(groupResult.getGroupedBy(), csvSummary.getValues());
|
final String title = ConcretePlotter.title(groupResult.getGroupedBy(), csvSummary.getValues());
|
||||||
final DataSeries dataSerie = new FileBackedDataSeries("id"+id, title, csvSummary, GnuplotLineType.Points);
|
final DataSeries dataSerie = new FileBackedDataSeries(id, title, csvSummary, GnuplotLineType.Points);
|
||||||
if (dataSerie.getValues() > 0) {
|
if (dataSerie.getValues() > 0) {
|
||||||
dataSeries.add(dataSerie);
|
dataSeries.add(dataSerie);
|
||||||
}
|
}
|
||||||
@@ -106,6 +106,7 @@ public class ScatterPlot implements ConcretePlotter {
|
|||||||
final Limit limitBy = plotSettings.getLimitBy();
|
final Limit limitBy = plotSettings.getLimitBy();
|
||||||
int limit = plotSettings.getLimit();
|
int limit = plotSettings.getLimit();
|
||||||
DataSeries.sortAndLimit(dataSeries, limitBy, limit);
|
DataSeries.sortAndLimit(dataSeries, limitBy, limit);
|
||||||
|
DataSeries.setColors(dataSeries);
|
||||||
|
|
||||||
final Path outputFile = Files.createTempFile(outputDir, "out", ".png");
|
final Path outputFile = Files.createTempFile(outputDir, "out", ".png");
|
||||||
final Gnuplot gnuplot = new Gnuplot(tmpBaseDir);
|
final Gnuplot gnuplot = new Gnuplot(tmpBaseDir);
|
||||||
|
|||||||
Reference in New Issue
Block a user