1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package com.xpn.xwiki.plugin.charts.plots

File XYPlotFactory.java

 

Coverage histogram

../../../../../../img/srcFileCovDistChart0.png
83% of files have more coverage

Code metrics

0
9
3
1
66
34
3
0.33
3
3
1

Classes

Class Line # Actions
XYPlotFactory 37 9 0% 3 12
0.00%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
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    * This class is not used directly but through area, bar and line (there is a sort of dynamic inheritance here)
36    */
 
37    public class XYPlotFactory
38    {
39    private static XYPlotFactory uniqueInstance = new XYPlotFactory();
40   
 
41  0 toggle private XYPlotFactory()
42    {
43    // empty
44    }
45   
 
46  0 toggle public static XYPlotFactory getInstance()
47    {
48  0 return uniqueInstance;
49    }
50   
 
51  0 toggle 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    }