dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #23019
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11196: Made it possible to parameterize png charts
------------------------------------------------------------
revno: 11196
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-06-11 13:55:54 +0200
message:
Made it possible to parameterize png charts
modified:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartController.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-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartController.java 2013-06-08 16:53:04 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartController.java 2013-06-11 11:55:54 +0000
@@ -51,6 +51,7 @@
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.system.util.CodecUtils;
import org.hisp.dhis.user.UserService;
import org.jfree.chart.ChartUtilities;
@@ -159,6 +160,7 @@
@RequestMapping( value = { "/{uid}/data", "/{uid}/data.png" }, method = RequestMethod.GET )
public void getChart( @PathVariable( "uid" ) String uid,
@RequestParam( value = "date", required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date date,
+ @RequestParam( value = "pe", required = false) String pe,
@RequestParam( value = "ou", required = false ) String ou,
@RequestParam( value = "width", defaultValue = "800", required = false ) int width,
@RequestParam( value = "height", defaultValue = "500", required = false ) int height,
@@ -174,6 +176,12 @@
OrganisationUnit unit = ou != null ? organisationUnitService.getOrganisationUnit( ou ) : null;
+ if ( pe != null )
+ {
+ Period period = PeriodType.getPeriodFromIsoString( pe );
+ date = period != null ? period.getStartDate() : date;
+ }
+
JFreeChart jFreeChart = chartService.getJFreeChart( chart, date, unit, i18nManager.getI18nFormat() );
String filename = CodecUtils.filenameEncode( chart.getName() ) + ".png";