dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #23969
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11691: PNG charts, impl support for radar charts
------------------------------------------------------------
revno: 11691
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2013-08-18 22:23:08 +0200
message:
PNG charts, impl support for radar charts
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java 2013-08-15 11:30:31 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java 2013-08-18 20:23:08 +0000
@@ -72,6 +72,7 @@
public static final String TYPE_LINE = "line";
public static final String TYPE_AREA = "area";
public static final String TYPE_PIE = "pie";
+ public static final String TYPE_RADAR = "radar"; // Spider web
private String domainAxisLabel;
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java 2013-08-15 11:30:31 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java 2013-08-18 20:23:08 +0000
@@ -34,6 +34,7 @@
import static org.hisp.dhis.chart.Chart.TYPE_PIE;
import static org.hisp.dhis.chart.Chart.TYPE_STACKED_BAR;
import static org.hisp.dhis.chart.Chart.TYPE_STACKED_COLUMN;
+import static org.hisp.dhis.chart.Chart.TYPE_RADAR;
import static org.hisp.dhis.common.DimensionalObject.DIMENSION_SEP;
import static org.hisp.dhis.system.util.ConversionUtils.getArray;
@@ -90,6 +91,7 @@
import org.jfree.chart.plot.MultiplePiePlot;
import org.jfree.chart.plot.PiePlot;
import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.chart.plot.SpiderWebPlot;
import org.jfree.chart.plot.ValueMarker;
import org.jfree.chart.renderer.category.AreaRenderer;
import org.jfree.chart.renderer.category.BarRenderer;
@@ -550,6 +552,10 @@
{
return getStackedBarChart( chart, dataSets[0], true );
}
+ else if ( chart.isType( TYPE_RADAR ) )
+ {
+ return getRadarChart( chart, dataSets[0] );
+ }
else
{
throw new IllegalArgumentException( "Illegal or no chart type: " + chart.getType() );
@@ -623,6 +629,20 @@
return areaChart;
}
+ private JFreeChart getRadarChart( Chart chart, CategoryDataset dataSet )
+ {
+ SpiderWebPlot plot = new SpiderWebPlot( dataSet, TableOrder.BY_ROW );
+ plot.setBackgroundPaint( Color.WHITE );
+ plot.setOutlinePaint( Color.WHITE );
+ plot.setLabelFont( labelFont );
+
+ JFreeChart jFreeChart = new JFreeChart( chart.getName(), titleFont, plot, !chart.isHideLegend() );
+ jFreeChart.setAntiAlias( true );
+ jFreeChart.setBackgroundPaint( Color.WHITE );
+
+ return jFreeChart;
+ }
+
private JFreeChart getStackedBarChart( Chart chart, CategoryDataset dataSet, boolean horizontal )
{
JFreeChart stackedBarChart = ChartFactory.createStackedBarChart( chart.getName(), chart.getDomainAxisLabel(),