1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package com.xpn.xwiki.plugin.charts.plots; |
21 |
|
|
22 |
|
import org.jfree.chart.axis.NumberAxis; |
23 |
|
import org.jfree.chart.plot.Plot; |
24 |
|
import org.jfree.chart.plot.XYPlot; |
25 |
|
import org.jfree.chart.renderer.xy.XYItemRenderer; |
26 |
|
import org.jfree.data.xy.XYDataset; |
27 |
|
|
28 |
|
import com.xpn.xwiki.plugin.charts.ChartCustomizer; |
29 |
|
import com.xpn.xwiki.plugin.charts.exceptions.DataSourceException; |
30 |
|
import com.xpn.xwiki.plugin.charts.exceptions.GenerateException; |
31 |
|
import com.xpn.xwiki.plugin.charts.params.ChartParams; |
32 |
|
import com.xpn.xwiki.plugin.charts.source.DataSource; |
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 3 |
Complexity Density: 0.33 |
|
37 |
|
public class XYPlotFactory |
38 |
|
{ |
39 |
|
private static XYPlotFactory uniqueInstance = new XYPlotFactory(); |
40 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
41 |
0 |
private XYPlotFactory()... |
42 |
|
{ |
43 |
|
|
44 |
|
} |
45 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
46 |
0 |
public static XYPlotFactory getInstance()... |
47 |
|
{ |
48 |
0 |
return uniqueInstance; |
49 |
|
} |
50 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
|
51 |
0 |
public Plot create(DataSource dataSource, XYItemRenderer renderer, ChartParams params) throws GenerateException,... |
52 |
|
DataSourceException |
53 |
|
{ |
54 |
0 |
NumberAxis domainAxis = new NumberAxis(); |
55 |
0 |
NumberAxis rangeAxis = new NumberAxis(); |
56 |
0 |
ChartCustomizer.customizeNumberAxis(domainAxis, params, ChartParams.AXIS_DOMAIN_PREFIX); |
57 |
0 |
ChartCustomizer.customizeNumberAxis(rangeAxis, params, ChartParams.AXIS_RANGE_PREFIX); |
58 |
|
|
59 |
0 |
XYDataset dataset = TableXYDatasetFactory.getInstance().create(dataSource, params); |
60 |
|
|
61 |
0 |
XYPlot plot = new XYPlot(dataset, domainAxis, rangeAxis, renderer); |
62 |
|
|
63 |
0 |
ChartCustomizer.customizeXYPlot(plot, params); |
64 |
0 |
return plot; |
65 |
|
} |
66 |
|
} |