Testing adding horizontal lines

This commit is contained in:
ProfMobius committed 2014-03-22 18:48:12 +01:00
1 parent e623a9d88c
commit 15fdb8dac2
2 files changed
+12 -13

No files matched your search

+11 -12
View File
@@ -14,6 +14,7 @@ import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.NumberAxis;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.plot.ValueMarker;
import org.jfree.chart.plot.XYPlot;
import org.jfree.data.category.DefaultCategoryDataset;
import org.jfree.data.xy.DefaultTableXYDataset;
@@ -143,27 +144,25 @@ public class DataCache {
xyData.add(i, timingTickGraphData.get(i));
}
/*
double[] values = this.timingTickGraphData.getValues();
for (int i = 0; i < values.length; i++)
xyData.add(i, values[i]);
*/
XYSeriesCollection dataset = new XYSeriesCollection();
dataset.addSeries(xyData);
//JFreeChart chart = ChartFactory.createXYLineChart("", "Seconds", "Update Time [ms]", dataset, PlotOrientation.VERTICAL, false, false, false);
JFreeChart chart = ChartFactory.createXYAreaChart("", "Seconds", "Update Time [ms]", dataset, PlotOrientation.VERTICAL, false, false, false);
chart.setBackgroundPaint(new Color(255,255,255,0));
XYPlot xyPlot = chart.getXYPlot();
xyPlot.getRendererForDataset(dataset).setSeriesPaint(0, Color.BLUE);
((NumberAxis)xyPlot.getRangeAxis()).setRange(0.0, 50.0 * (MathHelper.floor_double(xyData.getMaxY() / 50.0D) + 1));
for (double y = 50.0; y < 250.0; y += 50.0){
ValueMarker marker = new ValueMarker(y);
marker.setPaint(Color.black);
xyPlot.addRangeMarker(marker);
}
Double verticalScale = 50.0 * (MathHelper.floor_double(xyData.getMaxY() / 50.0D) + 1);
((NumberAxis)xyPlot.getRangeAxis()).setRange(0.0, verticalScale);
Dimension dim = SwingUI.instance().getLblSummaryTickChart().getSize();
//System.out.printf("%s %s\n", dim.height, dim.width);
BufferedImage image = chart.createBufferedImage(dim.width,dim.height);
SwingUI.instance().getLblSummaryTickChart().setIcon(new ImageIcon(image));
}
+1 -1
View File
@@ -6,7 +6,7 @@ public class Packets {
public static byte REQ_CHUNKS = 0x02; // C => S //Not used right now
public static byte TICKETS = 0x03; // S => C
public static byte CHUNKS = 0x04; // S => C
public static byte MODMEANTIME = 0x07; // S => C
public static byte MODMEANTIME = 0x07; // S => C
public static byte CLIENT_CMD = 0x08;
public static byte DATA_OVERLAY_CHUNK_ENTITIES = 0x09;
public static byte DATA_LIST_GENERAL = 0x10;