1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312
|
Author: Markus Koschany <apo@debian.org>
Author: Julien Plissonneau Duquène <sre4ever@free.fr>
Date: Fri, 21 Oct 2016 17:18:20 +0200
Subject: jfreechart compatibility
Bug-Debian: https://bugs.debian.org/1099290
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=841547
Forwarded: no
Last-Update: 2025-03-29
--- a/src/net/sf/statcvs/charts/SymbolicNameAnnotation.java
+++ b/src/net/sf/statcvs/charts/SymbolicNameAnnotation.java
@@ -21,9 +21,10 @@
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.plot.PlotRenderingInfo;
import org.jfree.chart.plot.XYPlot;
-import org.jfree.text.TextUtilities;
-import org.jfree.ui.RectangleEdge;
-import org.jfree.ui.TextAnchor;
+import org.jfree.chart.text.TextUtils;
+import org.jfree.chart.ui.RectangleEdge;
+import org.jfree.chart.ui.TextAnchor;
+import org.jfree.chart.event.AnnotationChangeListener;
/**
* SymbolicNameAnnotation
@@ -110,7 +111,7 @@
}
g2d.setFont(font);
g2d.setPaint(textPaint);
- TextUtilities.drawRotatedString(symbolicName.getName(), g2d, getArrangedLabelX(symbolicName, dataArea, domainAxis, domainEdge), y1 + 2,
+ TextUtils.drawRotatedString(symbolicName.getName(), g2d, getArrangedLabelX(symbolicName, dataArea, domainAxis, domainEdge), y1 + 2,
TextAnchor.BOTTOM_RIGHT, -Math.PI / 2, TextAnchor.BOTTOM_RIGHT);
}
@@ -131,4 +132,10 @@
private float getNaturalX(final SymbolicName tag, final Rectangle2D dataArea, final ValueAxis domainAxis, final RectangleEdge domainEdge) {
return (float) domainAxis.valueToJava2D(tag.getDate().getTime(), dataArea, domainEdge);
}
-}
\ No newline at end of file
+
+ public void removeChangeListener(AnnotationChangeListener listener) {
+ };
+
+ public void addChangeListener(AnnotationChangeListener listener) {
+ };
+}
--- a/src/net/sf/statcvs/charts/ChartConfigUtil.java
+++ b/src/net/sf/statcvs/charts/ChartConfigUtil.java
@@ -22,9 +22,9 @@
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
import org.jfree.chart.title.TextTitle;
import org.jfree.data.xy.XYDataset;
-import org.jfree.ui.Align;
-import org.jfree.ui.HorizontalAlignment;
-import org.jfree.ui.RectangleEdge;
+import org.jfree.chart.ui.Align;
+import org.jfree.chart.ui.HorizontalAlignment;
+import org.jfree.chart.ui.RectangleEdge;
/**
* @author benoitx
@@ -109,8 +109,8 @@
final Boolean filledShapes = ConfigurationOptions.getConfigBooleanProperty("chart." + chartName + ".filledShapes", "chart.filledShapes",
Boolean.FALSE);
- ((XYLineAndShapeRenderer) renderer).setBaseShapesVisible(showShapes.booleanValue());
- ((XYLineAndShapeRenderer) renderer).setBaseShapesFilled(filledShapes.booleanValue());
+ ((XYLineAndShapeRenderer) renderer).setDefaultShapesVisible(showShapes.booleanValue());
+ ((XYLineAndShapeRenderer) renderer).setDefaultShapesFilled(filledShapes.booleanValue());
}
}
--- a/src/net/sf/statcvs/charts/ModifyAddChartMaker.java
+++ b/src/net/sf/statcvs/charts/ModifyAddChartMaker.java
@@ -24,7 +24,7 @@
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.renderer.category.CategoryItemRenderer;
import org.jfree.data.category.DefaultCategoryDataset;
-import org.jfree.ui.RectangleEdge;
+import org.jfree.chart.ui.RectangleEdge;
/**
* Class for producing the "Author Activity: Modifying/Adding" chart
--- a/src/net/sf/statcvs/charts/ModuleEvolutionChartMaker.java
+++ b/src/net/sf/statcvs/charts/ModuleEvolutionChartMaker.java
@@ -15,14 +15,15 @@
import net.sf.statcvs.util.IntegerMap;
import org.jfree.chart.JFreeChart;
-import org.jfree.chart.axis.ColorBar;
import org.jfree.chart.axis.DateAxis;
+import org.jfree.chart.axis.NumberAxis;
import org.jfree.chart.axis.SymbolAxis;
import org.jfree.chart.axis.ValueAxis;
-import org.jfree.chart.plot.ContourPlot;
-import org.jfree.data.contour.ContourDataset;
-import org.jfree.data.contour.DefaultContourDataset;
-import org.jfree.ui.RectangleEdge;
+import org.jfree.chart.plot.XYPlot;
+import org.jfree.chart.renderer.xy.XYBlockRenderer;
+import org.jfree.chart.ui.RectangleEdge;
+import org.jfree.data.xy.DefaultXYZDataset;
+import org.jfree.data.xy.XYZDataset;
/**
* Class for producing directory pie charts
@@ -57,7 +58,7 @@
public ChartImage toFile() {
- final ContourDataset data = buildDs();
+ final XYZDataset data = buildDs();
if (data == null) {
return null;
@@ -71,14 +72,13 @@
yAxis.setLowerMargin(0.0);
yAxis.setUpperMargin(0.0);
- final ColorBar zAxis = new ColorBar("Commit Activity (%)");
- zAxis.getAxis();
+ final ValueAxis zAxis = new NumberAxis("Commit Activity (%)");
- final ContourPlot plot = new ContourPlot(data, xAxis, yAxis, zAxis);
+ final XYPlot plot = new XYPlot(data, xAxis, yAxis, new XYBlockRenderer());
//plot.setRenderAsPoints(true);
// don't use plot units for ratios when x axis is date
- plot.setDataAreaRatio(0.0);
- plot.setColorBarLocation(RectangleEdge.BOTTOM);
+ //plot.setDataAreaRatio(0.0);
+ //plot.setColorBarLocation(RectangleEdge.BOTTOM);
final JFreeChart chart = new JFreeChart(config.getProjectName(), null, plot, false);
@@ -91,7 +91,7 @@
return this.config.createChartImage(this.fileName, this.title, chart, dim);
}
- private ContourDataset buildDs() {
+ private XYZDataset buildDs() {
final Map mapByDate = new LinkedHashMap();
int max = 0;
final long elapsed = repository.getLastDate().getTime() - repository.getFirstDate().getTime();
@@ -191,9 +191,9 @@
return null;
}
- final Date[] oDateX = new Date[numValues];
- final Double[] oDoubleY = new Double[numValues];
- final Double[] oDoubleZ = new Double[numValues];
+ final double[] oDoubleX = new double[numValues];
+ final double[] oDoubleY = new double[numValues];
+ final double[] oDoubleZ = new double[numValues];
it = mapByDate.keySet().iterator();
for (int x = 0; x < dateCount; x++) {
@@ -212,20 +212,22 @@
final Module group = (Module) it2.next();
final int index = (x * groupCount) + y;
- oDateX[index] = date;
- oDoubleY[index] = new Double(y);
+ oDoubleX[index] = Long.valueOf(date.getTime()).doubleValue();
+ oDoubleY[index] = y;
final double value = map.get(group.getName()) * 100.0 / max;
- oDoubleZ[index] = (value != 0) ? new Double(value) : null;
+ oDoubleZ[index] = value;
}
} else {
for (int y = 0; y < groupCount; y++) {
final int index = (x * groupCount) + y;
- oDateX[index] = date;
- oDoubleY[index] = new Double(y);
- //oDoubleZ[index] = null;
+ oDoubleX[index] = Long.valueOf(date.getTime()).doubleValue();
+ oDoubleY[index] = y;
+ oDoubleZ[index] = 0;
}
}
}
- return new DefaultContourDataset(null, oDateX, oDoubleY, oDoubleZ);
+ final DefaultXYZDataset xyzDs = new DefaultXYZDataset();
+ xyzDs.addSeries(0, new double[][]{oDoubleX, oDoubleY, oDoubleZ});
+ return xyzDs;
}
-}
\ No newline at end of file
+}
--- a/src/net/sf/statcvs/charts/ChartImage.java
+++ b/src/net/sf/statcvs/charts/ChartImage.java
@@ -6,7 +6,7 @@
import java.io.IOException;
import java.util.logging.Logger;
-import org.jfree.chart.ChartUtilities;
+import org.jfree.chart.ChartUtils;
import org.jfree.chart.JFreeChart;
/**
@@ -58,7 +58,7 @@
}
logger.info("writing chart '" + this.title + "' to " + this.fileName);
try {
- ChartUtilities.saveChartAsPNG(new File(rootDirectory + fileName), chart, size.width, size.height);
+ ChartUtils.saveChartAsPNG(new File(rootDirectory + fileName), chart, size.width, size.height);
} catch (final IOException e) {
logger.warning("could not write chart '" + fileName + "': " + e);
}
@@ -93,4 +93,4 @@
public int getHeight() {
return this.size.height;
}
-}
\ No newline at end of file
+}
--- a/src/net/sf/statcvs/charts/CommitScatterChartMaker.java
+++ b/src/net/sf/statcvs/charts/CommitScatterChartMaker.java
@@ -113,7 +113,7 @@
}
private TimeSeries createTimeSeries(final SortedSet revisions) {
- final TimeSeries result = new TimeSeries("Dummy", Second.class);
+ final TimeSeries result = new TimeSeries("Dummy");
final Iterator it = revisions.iterator();
Date lastDate = new Date();
while (it.hasNext()) {
@@ -145,7 +145,7 @@
valueAxis.setRange(0.0, 24.0);
valueAxis.setLabelFont(new Font("SansSerif", Font.PLAIN, 9));
final XYItemRenderer renderer = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES);
- renderer.setShape(new Rectangle(new Dimension(2, 2)));
+ renderer.setDefaultShape(new Rectangle(new Dimension(2, 2)));
final XYPlot result = new XYPlot(new TimeSeriesCollection(series), null, valueAxis, renderer);
result.getRenderer().setSeriesPaint(0, color);
final Iterator it = annotations.iterator();
--- a/src/net/sf/statcvs/charts/DirectoryPieChartMaker.java
+++ b/src/net/sf/statcvs/charts/DirectoryPieChartMaker.java
@@ -90,7 +90,7 @@
plot.setLabelShadowPaint(null);
plot.setLabelOutlinePaint(Color.LIGHT_GRAY);
plot.setForegroundAlpha(0.8f);
- plot.setSectionOutlinePaint(Color.BLACK);
+ plot.setSectionOutlinePaint(0, Color.BLACK);
it = colors.entrySet().iterator();
while (it.hasNext()) {
final Entry entry = (Entry) it.next();
@@ -165,4 +165,4 @@
return result;
}
}
-}
\ No newline at end of file
+}
--- a/src/net/sf/statcvs/charts/TimeLineChartMaker.java
+++ b/src/net/sf/statcvs/charts/TimeLineChartMaker.java
@@ -89,7 +89,7 @@
}
private TimeSeries createTimeSeries(final TimeLine timeLine) {
- final TimeSeries result = new TimeSeries("!??!SERIES_LABEL!??!", Millisecond.class);
+ final TimeSeries result = new TimeSeries("!??!SERIES_LABEL!??!");
final Iterator it = timeLine.getDataPoints().iterator();
while (it.hasNext()) {
final TimePoint timePoint = (TimePoint) it.next();
--- a/src/net/sf/statcvs/output/ChurnPageMaker.java
+++ b/src/net/sf/statcvs/output/ChurnPageMaker.java
@@ -82,7 +82,7 @@
}
final List annotations = SymbolicNameAnnotation.createAnnotations(config.getRepository().getSymbolicNames());
- final TimeSeries timeLine = new TimeSeries(Messages.getString("CHURN_TOUCHED_LINE"), Day.class);
+ final TimeSeries timeLine = new TimeSeries(Messages.getString("CHURN_TOUCHED_LINE"));
for (final Iterator it = changePerRevision.entrySet().iterator(); it.hasNext();) {
final Map.Entry entry = (Entry) it.next();
--- a/src/net/sf/statcvs/reports/LOCSeriesBuilder.java
+++ b/src/net/sf/statcvs/reports/LOCSeriesBuilder.java
@@ -37,7 +37,7 @@
* value of new lines will be counted.
*/
public LOCSeriesBuilder(final String seriesTitle, final boolean countEffective) {
- series = new TimeSeries(seriesTitle, Minute.class);
+ series = new TimeSeries(seriesTitle);
this.countEffective = countEffective;
}
@@ -104,4 +104,4 @@
public int getMaximum() {
return this.maximum;
}
-}
\ No newline at end of file
+}
--- a/src/net/sf/statcvs/charts/ModuleSizePieChartMaker.java
+++ b/src/net/sf/statcvs/charts/ModuleSizePieChartMaker.java
@@ -80,7 +80,7 @@
plot.setLabelShadowPaint(null);
plot.setLabelOutlinePaint(Color.LIGHT_GRAY);
plot.setForegroundAlpha(0.8f);
- plot.setSectionOutlinePaint(Color.BLACK);
+ plot.setSectionOutlinePaint(0, Color.BLACK);
plot.setBackgroundPaint(ChartConfigUtil.getPlotColor(chartName));
chart.setBackgroundPaint(ChartConfigUtil.getBackgroundColor(chartName));
@@ -92,4 +92,4 @@
return this.config.createChartImage(this.fileName, this.title, chart, dim);
}
-}
\ No newline at end of file
+}
|