enhanced graphics computation (avoiding long string parsing for colours)

pull/1/head
orbiter 10 years ago
parent ef813cec91
commit fa2ad101ec

@ -106,9 +106,9 @@ public class NetworkHistory {
final int bottomborder = 20;
final int vspace = height - topborder - bottomborder;
final int leftscale = (maxpeers / 100) * 10;
ChartPlotter chart = new ChartPlotter(width, height, "FFFFFF", "000000", "AAAAAA", leftborder, rightborder, topborder, bottomborder, "YACY NETWORK HISTORY", "IN THE LAST 48 HOURS");
chart.declareDimension(ChartPlotter.DIMENSION_BOTTOM, bottomscale, hspace / (maxtime / bottomscale), -maxtime, "000000", "CCCCCC", "TIME/HOURS");
chart.declareDimension(ChartPlotter.DIMENSION_LEFT, leftscale, vspace * leftscale / maxpeers, 0, "008800", null , "PEERS");
ChartPlotter chart = new ChartPlotter(width, height, 0xFFFFFFl, 0x000000l, 0xAAAAAAl, leftborder, rightborder, topborder, bottomborder, "YACY NETWORK HISTORY", "IN THE LAST 48 HOURS");
chart.declareDimension(ChartPlotter.DIMENSION_BOTTOM, bottomscale, hspace / (maxtime / bottomscale), -maxtime, 0x000000l, 0xCCCCCCl, "TIME/HOURS");
chart.declareDimension(ChartPlotter.DIMENSION_LEFT, leftscale, vspace * leftscale / maxpeers, 0, 0x008800l, null , "PEERS");
// write the data
float x0, x1;

@ -77,7 +77,7 @@ public class NetworkPicture {
int passiveLimit = 1440; // minutes; 1440 = 1 day; 720 = 12 hours; 1440 = 24 hours, 10080 = 1 week;
int potentialLimit = 1440;
int maxCount = 9000;
String bgcolor = NetworkGraph.COL_BACKGROUND;
String bgcolor = Long.toHexString(NetworkGraph.COL_BACKGROUND);
boolean corona = true;
int coronaangle = 0;
long communicationTimeout = -1;
@ -134,7 +134,7 @@ public class NetworkPicture {
communicationTimeout,
env.getConfig(SwitchboardConstants.NETWORK_NAME, "unspecified"),
env.getConfig("network.unit.description", "unspecified"),
bgcolor,
Long.parseLong(bgcolor, 16),
cyc), "png");
lastAccessSeconds = System.currentTimeMillis() / 1000;

@ -46,7 +46,7 @@ public class imagetest {
img.dot(620, 200, 90, true, 100);
img.setColor(RasterPlotter.RED);
img.arc(300, 270, 30, 70, 100);
img.setColor(Long.parseLong("330000", 16));
img.setColor(0x330000);
img.arc(220, 110, 50, 90, 30, 110);
img.arc(210, 120, 50, 90, 30, 110);
img.setColor(RasterPlotter.GREY);
@ -57,7 +57,7 @@ public class imagetest {
img.setColor(i);
img.dot(10 + 14 * (int) (i / 16), 200 + 14 * (int) (i % 16), 6, true, 100);
}
img.setColor(Long.parseLong("008000", 16));
img.setColor(0x008000);
img.dot(10 + 14 * 8, 200 + 14 * 8, 90, true, 100);
/*
for (long r = 0; r < 256; r = r + 16) {
@ -68,9 +68,9 @@ public class imagetest {
}
}
}*/
img.setColor(Long.parseLong("0000A0", 16));
img.setColor(0x0000A0);
img.arc(550, 400, 40, 81, 100);
img.setColor(Long.parseLong("010100", 16));
img.setColor(0x010100);
for (int i = 0; i <= 360; i++) {
img.arc(550, 400, 40, 41 + i/9, 0, i);
}

@ -446,11 +446,11 @@ final class memprofiler extends Thread {
public memprofiler(final int width, final int height, final int expectedTimeSeconds, final File outputFile) {
this.outputFile = outputFile;
final int expectedKilobytes = 20 * 1024;//(Runtime.getRuntime().totalMemory() / 1024);
this.memChart = new ChartPlotter(width, height, "FFFFFF", "000000", "000000", 50, 20, 20, 20, "MEMORY CHART FROM EXECUTION AT " + new Date(), null);
this.memChart = new ChartPlotter(width, height, 0xFFFFFFl, 0x000000l, 0x000000l, 50, 20, 20, 20, "MEMORY CHART FROM EXECUTION AT " + new Date(), null);
final int timescale = 10; // steps with each 10 seconds
final int memscale = 1024;
this.memChart.declareDimension(ChartPlotter.DIMENSION_BOTTOM, timescale, (width - 40) * timescale / expectedTimeSeconds, 0, "FFFFFF", "555555", "SECONDS");
this.memChart.declareDimension(ChartPlotter.DIMENSION_LEFT, memscale, (height - 40) * memscale / expectedKilobytes, 0, "FFFFFF", "555555", "KILOBYTES");
this.memChart.declareDimension(ChartPlotter.DIMENSION_BOTTOM, timescale, (width - 40) * timescale / expectedTimeSeconds, 0, 0xFFFFFFl, 0x555555l, "SECONDS");
this.memChart.declareDimension(ChartPlotter.DIMENSION_LEFT, memscale, (height - 40) * memscale / expectedKilobytes, 0, 0xFFFFFFl, 0x555555l, "KILOBYTES");
this.run = true;
this.start = System.currentTimeMillis();
}

@ -59,27 +59,27 @@ public class NetworkGraph {
private static int shortestName = 10;
private static int longestName = 30;
public static final String COL_BACKGROUND = "FFFFFF";
public static final String COL_DHTCIRCLE = "004018";
private static final String COL_HEADLINE = "FFFFFF";
private static final String COL_ACTIVE_DOT = "000040";
private static final String COL_ACTIVE_LINE = "113322";
private static final String COL_ACTIVE_TEXT = "226644";
private static final String COL_PASSIVE_DOT = "201010";
private static final String COL_PASSIVE_LINE = "443333";
private static final String COL_PASSIVE_TEXT = "663333";
private static final String COL_POTENTIAL_DOT = "002000";
private static final String COL_POTENTIAL_LINE = "224422";
private static final String COL_POTENTIAL_TEXT = "336633";
private static final String COL_MYPEER_DOT = "FF0000";
private static final String COL_MYPEER_LINE = "FFAAAA";
private static final String COL_MYPEER_TEXT = "FFCCCC";
private static final String COL_DHTOUT = "440000";
private static final String COL_DHTIN = "008800";
private static final String COL_BORDER = "000000";
private static final String COL_NORMAL_TEXT = "000000";
private static final String COL_LOAD_BG = "F7F7F7";
public static final long COL_BACKGROUND = 0xFFFFFF;
public static final long COL_DHTCIRCLE = 0x004018;
private static final long COL_HEADLINE = 0xFFFFFF;
private static final long COL_ACTIVE_DOT = 0x000040;
private static final long COL_ACTIVE_LINE = 0x113322;
private static final long COL_ACTIVE_TEXT = 0x226644;
private static final long COL_PASSIVE_DOT = 0x201010;
private static final long COL_PASSIVE_LINE = 0x443333;
private static final long COL_PASSIVE_TEXT = 0x663333;
private static final long COL_POTENTIAL_DOT = 0x002000;
private static final long COL_POTENTIAL_LINE = 0x224422;
private static final long COL_POTENTIAL_TEXT = 0x336633;
private static final long COL_MYPEER_DOT = 0xFF0000;
private static final long COL_MYPEER_LINE = 0xFFAAAA;
private static final long COL_MYPEER_TEXT = 0xFFCCCC;
private static final long COL_DHTOUT = 0x440000;
private static final long COL_DHTIN = 0x008800;
private static final long COL_BORDER = 0x000000;
private static final long COL_NORMAL_TEXT = 0x000000;
private static final long COL_LOAD_BG = 0xF7F7F7;
/** Private constructor to avoid instantiation of utility class. */
private NetworkGraph() { }
@ -176,7 +176,7 @@ public class NetworkGraph {
return eventPicture;
}
public static RasterPlotter getNetworkPicture(final SeedDB seedDB, final int width, final int height, final int passiveLimit, final int potentialLimit, final int maxCount, final int coronaangle, final long communicationTimeout, final String networkName, final String networkTitle, final String bgcolor, final int cyc) {
public static RasterPlotter getNetworkPicture(final SeedDB seedDB, final int width, final int height, final int passiveLimit, final int potentialLimit, final int maxCount, final int coronaangle, final long communicationTimeout, final String networkName, final String networkTitle, final long bgcolor, final int cyc) {
return drawNetworkPicture(seedDB, width, height, passiveLimit, potentialLimit, maxCount, coronaangle, communicationTimeout, networkName, networkTitle, bgcolor, cyc);
}
@ -185,7 +185,7 @@ public class NetworkGraph {
final int passiveLimit, final int potentialLimit,
final int maxCount, final int coronaangle,
final long communicationTimeout,
final String networkName, final String networkTitle, final String color_back,
final String networkName, final String networkTitle, final long color_back,
final int cyc) {
final RasterPlotter.DrawMode drawMode = (RasterPlotter.darkColor(color_back)) ? RasterPlotter.DrawMode.MODE_ADD : RasterPlotter.DrawMode.MODE_SUB;
@ -197,7 +197,7 @@ public class NetworkGraph {
final int outerradius = maxradius - 20;
// draw network circle
networkPicture.setColor(Long.parseLong(COL_DHTCIRCLE, 16));
networkPicture.setColor(COL_DHTCIRCLE);
networkPicture.arc(width / 2, height / 2, innerradius - 20, innerradius + 20, 100);
//System.out.println("Seed Maximum distance is " + yacySeed.maxDHTDistance);
@ -288,7 +288,7 @@ public class NetworkGraph {
}
// draw description
networkPicture.setColor(Long.parseLong(COL_HEADLINE, 16));
networkPicture.setColor(COL_HEADLINE);
PrintTool.print(networkPicture, 2, 6, 0, "YACY NETWORK '" + networkName.toUpperCase() + "'", -1);
PrintTool.print(networkPicture, 2, 14, 0, networkTitle.toUpperCase(), -1);
PrintTool.print(networkPicture, width - 2, 6, 0, "SNAPSHOT FROM " + new Date().toString().toUpperCase(), 1);
@ -300,17 +300,16 @@ public class NetworkGraph {
return networkPicture;
}
private static void drawNetworkPictureDHT(final RasterPlotter img, final int centerX, final int centerY, final int innerradius, final Seed mySeed, final Seed otherSeed, final String colorLine, final int coronaangle, final boolean out, final int cyc) {
private static void drawNetworkPictureDHT(final RasterPlotter img, final int centerX, final int centerY, final int innerradius, final Seed mySeed, final Seed otherSeed, final long colorLine, final int coronaangle, final boolean out, final int cyc) {
// find positions (== angle) of the two peers
final int angleMy = cyc + (int) (360.0d * Distribution.horizontalDHTPosition(ASCII.getBytes(mySeed.hash)) / DOUBLE_LONG_MAX_VALUE);
final int angleOther = cyc + (int) (360.0d * Distribution.horizontalDHTPosition(ASCII.getBytes(otherSeed.hash)) / DOUBLE_LONG_MAX_VALUE);
Long colorLine_l = Long.parseLong(colorLine, 16);
// paint the line from my peer to the inner border of the network circle
img.arcLine(centerX, centerY, innerradius, innerradius - 20, angleMy, !out, colorLine_l, null, 12, (coronaangle < 0) ? -1 : coronaangle / 30, 2, true);
img.arcLine(centerX, centerY, innerradius, innerradius - 20, angleMy, !out, colorLine, null, 12, (coronaangle < 0) ? -1 : coronaangle / 30, 2, true);
// paint the line from the other peer to the inner border of the network circle
img.arcLine(centerX, centerY, innerradius, innerradius - 20, angleOther, out, colorLine_l, null, 12, (coronaangle < 0) ? -1 : coronaangle / 30, 2, true);
img.arcLine(centerX, centerY, innerradius, innerradius - 20, angleOther, out, colorLine, null, 12, (coronaangle < 0) ? -1 : coronaangle / 30, 2, true);
// paint a line between the two inner border points of my peer and the other peer
img.arcConnect(centerX, centerY, innerradius - 20, angleMy, angleOther, out, colorLine_l, 100, null, 100, 12, (coronaangle < 0) ? -1 : coronaangle / 30, 2, true, otherSeed.getName(), colorLine_l);
img.arcConnect(centerX, centerY, innerradius - 20, angleMy, angleOther, out, colorLine, 100, null, 100, 12, (coronaangle < 0) ? -1 : coronaangle / 30, 2, true, otherSeed.getName(), colorLine);
}
private static class drawNetworkPicturePeerJob {
@ -318,14 +317,14 @@ public class NetworkGraph {
private final RasterPlotter img;
private final int centerX, centerY, innerradius, outerradius, coronaangle;
private final Seed seed;
private final String colorDot, colorLine, colorText;
private final long colorDot, colorLine, colorText;
private final double cyc;
//public drawNetworkPicturePeerJob() {} // used to produce a poison pill
public drawNetworkPicturePeerJob(
final RasterPlotter img, final int centerX, final int centerY,
final int innerradius, final int outerradius,
final Seed seed,
final String colorDot, final String colorLine, final String colorText,
final long colorDot, final long colorLine, final long colorText,
final int coronaangle,
final double cyc) {
this.img = img;
@ -349,15 +348,15 @@ public class NetworkGraph {
int linelength = 20 + this.outerradius * (20 * (name.length() - shortestName) / (longestName - shortestName) + Math.abs(this.seed.hash.hashCode() % 20)) / 80;
if (linelength > this.outerradius) linelength = this.outerradius;
int dotsize = 2 + (int) (this.seed.getLinkCount() / 2000000L);
if (this.colorDot.equals(COL_MYPEER_DOT)) dotsize = dotsize + 4;
if (this.colorDot == COL_MYPEER_DOT) dotsize = dotsize + 4;
if (dotsize > 18) dotsize = 18;
// draw dot
this.img.setColor(Long.parseLong(this.colorDot, 16));
this.img.setColor(this.colorDot);
this.img.arcDot(this.centerX, this.centerY, this.innerradius, angle, dotsize);
// draw line to text
this.img.arcLine(this.centerX, this.centerY, this.innerradius + 18, this.innerradius + linelength, angle, true, Long.parseLong(this.colorLine, 16), Long.parseLong("444444", 16), 12, this.coronaangle / 30, 0, true);
this.img.arcLine(this.centerX, this.centerY, this.innerradius + 18, this.innerradius + linelength, angle, true, this.colorLine, 0x444444l, 12, this.coronaangle / 30, 0, true);
// draw text
this.img.setColor(Long.parseLong(this.colorText, 16));
this.img.setColor(this.colorText);
PrintTool.arcPrint(this.img, this.centerX, this.centerY, this.innerradius + linelength, angle, name);
// draw corona around dot for crawling activity

@ -74,17 +74,17 @@ public class ProfilingGraph {
final int vspace = height - topborder - bottomborder;
final int hspace = width - leftborder - rightborder;
final int maxtime = 600;
ChartPlotter chart = new ChartPlotter(width, height, "FFFFFF", "000000", "AAAAAA", leftborder, rightborder, topborder, bottomborder, "YACY PEER PERFORMANCE: MAIN MEMORY, WORD CACHE AND PAGES/MINUTE (PPM)", subline);
chart.declareDimension(ChartPlotter.DIMENSION_BOTTOM, bottomscale, hspace / (maxtime / bottomscale), -maxtime, "000000", "CCCCCC", "TIME/SECONDS");
chart.declareDimension(ChartPlotter.DIMENSION_LEFT, leftscale, vspace * leftscale / maxwords, 0, "008800", null , "WORDS IN INDEXING CACHE");
ChartPlotter chart = new ChartPlotter(width, height, 0xFFFFFFl, 0x000000l, 0xAAAAAAl, leftborder, rightborder, topborder, bottomborder, "YACY PEER PERFORMANCE: MAIN MEMORY, WORD CACHE AND PAGES/MINUTE (PPM)", subline);
chart.declareDimension(ChartPlotter.DIMENSION_BOTTOM, bottomscale, hspace / (maxtime / bottomscale), -maxtime, 0x000000l, 0xCCCCCCl, "TIME/SECONDS");
chart.declareDimension(ChartPlotter.DIMENSION_LEFT, leftscale, vspace * leftscale / maxwords, 0, 0x008800l, null , "WORDS IN INDEXING CACHE");
if (showMemory) {
chart.declareDimension(ChartPlotter.DIMENSION_RIGHT, rightscale, vspace * rightscale / maxmbytes, 0, "0000FF", "CCCCCC", "MEMORY/MEGABYTE");
chart.declareDimension(ChartPlotter.DIMENSION_RIGHT, rightscale, vspace * rightscale / maxmbytes, 0, 0x0000FFl, 0xCCCCCCl, "MEMORY/MEGABYTE");
} else {
chart.declareDimension(ChartPlotter.DIMENSION_RIGHT, rightscale, vspace * rightscale / Math.max(1, maxppm), 0, "FF0000", "CCCCCC", "INDEXING SPEED/PAGES PER MINUTE");
chart.declareDimension(ChartPlotter.DIMENSION_RIGHT, rightscale, vspace * rightscale / Math.max(1, maxppm), 0, 0xFF0000l, 0xCCCCCCl, "INDEXING SPEED/PAGES PER MINUTE");
}
chart.declareDimension(ChartPlotter.DIMENSION_ANOT0, anotscale, vspace * anotscale / maxppm, 0, "008800", null , "PPM [PAGES/MINUTE]");
chart.declareDimension(ChartPlotter.DIMENSION_ANOT1, vspace / 6, vspace / 6, 0, "888800", null , "URL");
chart.declareDimension(ChartPlotter.DIMENSION_ANOT2, 1, 1, 0, "888800", null , "PING");
chart.declareDimension(ChartPlotter.DIMENSION_ANOT0, anotscale, vspace * anotscale / maxppm, 0, 0x008800l, null , "PPM [PAGES/MINUTE]");
chart.declareDimension(ChartPlotter.DIMENSION_ANOT1, vspace / 6, vspace / 6, 0, 0x888800l, null , "URL");
chart.declareDimension(ChartPlotter.DIMENSION_ANOT2, 1, 1, 0, 0x888800l, null , "PING");
// draw chart
long time;

@ -50,11 +50,11 @@ public class ChartPlotter extends RasterPlotter {
private final int[] scales = new int[]{0,0,0,0,0,0,0,0};
private final int[] pixels = new int[]{0,0,0,0,0,0,0,0};
private final int[] offsets = new int[]{0,0,0,0,0,0,0,0};
private final String[] colnames = new String[]{"FFFFFF","FFFFFF","FFFFFF","FFFFFF","FFFFFF","FFFFFF","FFFFFF","FFFFFF"};
private final String[] colscale = new String[]{null,null,null,null,null,null,null,null};
private final Long[] colnames = new Long[]{0xFFFFFFl,0xFFFFFFl,0xFFFFFFl,0xFFFFFFl,0xFFFFFFl,0xFFFFFFl,0xFFFFFFl,0xFFFFFFl};
private final Long[] colscale = new Long[]{null,null,null,null,null,null,null,null};
private final String[] tablenames = new String[]{"","","","","","","",""};
public ChartPlotter(final int width, final int height, final String backgroundColor, final String foregroundColor, final String lightColor,
public ChartPlotter(final int width, final int height, final Long backgroundColor, final Long foregroundColor, final Long lightColor,
final int leftborder, final int rightborder, final int topborder, final int bottomborder,
final String name, final String subline) {
super(width, height, RasterPlotter.DrawMode.MODE_REPLACE, backgroundColor);
@ -66,11 +66,11 @@ public class ChartPlotter extends RasterPlotter {
//this.backgroundColor = backgroundColor;
//this.foregroundColor = foregroundColor;
if (name != null) {
if (foregroundColor != null) this.setColor(Long.parseLong(foregroundColor, 16));
if (foregroundColor != null) this.setColor(foregroundColor);
PrintTool.print(this, width / 2 - name.length() * 3, 6, 0, name, -1);
}
if (subline != null) {
if (lightColor != null) this.setColor(Long.parseLong(lightColor, 16));
if (lightColor != null) this.setColor(lightColor);
PrintTool.print(this, width / 2 - subline.length() * 3, 14, 0, subline, -1);
}
}
@ -85,7 +85,7 @@ public class ChartPlotter extends RasterPlotter {
* @param colorScale the colour of the line drawing for the vertical scale
* @param name printed on the vertical bar
*/
public void declareDimension(final int dimensionType, final int scale, final int pixelperscale, final int offset, final String colorNaming, final String colorScale, final String name) {
public void declareDimension(final int dimensionType, final int scale, final int pixelperscale, final int offset, final Long colorNaming, final Long colorScale, final String name) {
this.scales[dimensionType] = scale;
this.pixels[dimensionType] = pixelperscale;
this.offsets[dimensionType] = offset;
@ -126,24 +126,22 @@ public class ChartPlotter extends RasterPlotter {
* @param colorScale the colour of the line drawing for the vertical scale
* @param name printed on the vertical bar
*/
private void drawHorizontalScale(final boolean top, final int scale, final int pixelperscale, final int offset, final String colorNaming, final String colorScale, final String name) {
private void drawHorizontalScale(final boolean top, final int scale, final int pixelperscale, final int offset, final Long colorNaming, final Long colorScale, final String name) {
final int y = (top) ? this.topborder : this.height - this.bottomborder;
int x = this.leftborder;
int s = offset;
Long colorScale_l = colorScale == null ? null : Long.parseLong(colorScale, 16);
Long colorNaming_l = colorNaming == null ? null : Long.parseLong(colorNaming, 16);
while (x < this.width - this.rightborder) {
if ((colorScale != null) && (x > this.leftborder) && (x < (this.width - this.rightborder))) {
setColor(colorScale_l);
setColor(colorScale);
line(x, this.topborder, x, this.height - this.bottomborder, 100);
}
setColor(colorNaming_l);
setColor(colorNaming);
line(x, y - 3, x, y + 3, 100);
PrintTool.print(this, x, (top) ? y - 3 : y + 9, 0, Integer.toString(s), -1);
x += pixelperscale;
s += scale;
}
setColor(colorNaming_l);
setColor(colorNaming);
PrintTool.print(this, this.width - this.rightborder, (top) ? y - 9 : y + 15, 0, name, 1);
line(this.leftborder - 4, y, this.width - this.rightborder + 4, y, 100);
}
@ -158,7 +156,7 @@ public class ChartPlotter extends RasterPlotter {
* @param colorScale the colour of the line drawing for the vertical scale
* @param name printed on the vertical bar
*/
private void drawVerticalScale(final boolean left, final int scale, final int pixelperscale, final int offset, final String colorNaming, final String colorScale, final String name) {
private void drawVerticalScale(final boolean left, final int scale, final int pixelperscale, final int offset, final Long colorNaming, final Long colorScale, final String name) {
assert pixelperscale > 0;
assert scale > 0;
final int x = (left) ? this.leftborder : this.width - this.rightborder;
@ -166,14 +164,12 @@ public class ChartPlotter extends RasterPlotter {
int s = offset;
String s1;
int s1max = 0;
Long colorScale_l = colorScale == null ? null : Long.parseLong(colorScale, 16);
Long colorNaming_l = colorNaming == null ? null : Long.parseLong(colorNaming, 16);
while (y > this.topborder) {
if ((colorScale != null) && (y > this.topborder) && (y < (this.height - this.bottomborder))) {
setColor(colorScale_l);
setColor(colorScale);
line(this.leftborder, y, this.width - this.rightborder, y, 100);
}
setColor(colorNaming_l);
setColor(colorNaming);
line(x - 3, y, x + 3, y, 100);
s1 = (s >= 1000000 && s % 10000 == 0) ? Integer.toString(s / 1000000) + "M" : (s >= 1000 && s % 1000 == 0) ? Integer.toString(s / 1000) + "K" : Integer.toString(s);
if (s1.length() > s1max) s1max = s1.length();
@ -181,27 +177,27 @@ public class ChartPlotter extends RasterPlotter {
y -= pixelperscale;
s += scale;
}
setColor(colorNaming_l);
setColor(colorNaming);
PrintTool.print(this, (left) ? x - s1max * 6 - 6 : x + s1max * 6 + 9, this.topborder, 90, name, 1);
line(x, this.topborder - 4, x, this.height - this.bottomborder + 4, 100);
}
public static void main(final String[] args) {
System.setProperty("java.awt.headless", "true");
final String bg = "FFFFFF";
final String fg = "000000";
final String scale = "CCCCCC";
final String green = "008800";
final String blue = "0000FF";
final long bg = 0xFFFFFF;
final long fg = 0x000000;
final long scale = 0xCCCCCC;
final long green = 0x008800;
final long blue = 0x0000FF;
final ChartPlotter ip = new ChartPlotter(660, 240, bg, fg, fg, 30, 30, 20, 20, "PEER PERFORMANCE GRAPH: PAGES/MINUTE and USED MEMORY", "");
ip.declareDimension(DIMENSION_BOTTOM, 60, 60, -600, fg, scale, "TIME/SECONDS");
//ip.declareDimension(DIMENSION_TOP, 10, 40, "000000", null, "count");
ip.declareDimension(DIMENSION_LEFT, 50, 40, 0, green, scale , "PPM [PAGES/MINUTE]");
ip.declareDimension(DIMENSION_RIGHT, 100, 20, 0, blue, scale, "MEMORY/MEGABYTE");
ip.setColor(Long.parseLong(green, 16));
ip.setColor(green);
ip.chartDot(DIMENSION_BOTTOM, DIMENSION_LEFT, -160, 100, 5, null, 0);
ip.chartLine(DIMENSION_BOTTOM, DIMENSION_LEFT, -160, 100, -130, 200);
ip.setColor(Long.parseLong(blue, 16));
ip.setColor(blue);
ip.chartDot(DIMENSION_BOTTOM, DIMENSION_RIGHT, -50, 300, 2, null, 0);
ip.chartLine(DIMENSION_BOTTOM, DIMENSION_RIGHT, -80, 100, -50, 300);
//ip.print(100, 100, 0, "TEXT", true);

Loading…
Cancel
Save