=== 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 2011-04-18 12:06:28 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java 2011-05-02 12:54:28 +0000 @@ -48,50 +48,61 @@ private static final long serialVersionUID = 2570074075484545534L; public static final String DIMENSION_PERIOD = "period"; + public static final String DIMENSION_ORGANISATIONUNIT = "organisationUnit"; + public static final String DIMENSION_INDICATOR = "indicator"; - + public static final String TYPE_BAR = "bar"; + public static final String TYPE_BAR3D = "bar3d"; + public static final String TYPE_LINE = "line"; + public static final String TYPE_LINE3D = "line3d"; + public static final String TYPE_PIE = "pie"; + public static final String TYPE_PIE3D = "pie3d"; public static final String SIZE_NORMAL = "normal"; + public static final String SIZE_WIDE = "wide"; + public static final String SIZE_TALL = "tall"; - + private int id; - + private String title; - + private String type; - + private String size; - + private String dimension; - + private Boolean hideLegend; - + private Boolean verticalLabels; - + private Boolean horizontalPlotOrientation; - + private Boolean regression; - + private Boolean targetLine; private Double targetLineValue; + private String targetLineLabel; + private List indicators = new ArrayList(); private List periods = new ArrayList(); - + private List organisationUnits = new ArrayList(); - + private RelativePeriods relatives; - + private Boolean userOrganisationUnit; // ------------------------------------------------------------------------- @@ -101,38 +112,38 @@ private transient I18nFormat format; private List relativePeriods = new ArrayList(); - + private List allPeriods = new ArrayList(); - + private OrganisationUnit organisationUnit; - + private List allOrganisationUnits = new ArrayList(); - + // ------------------------------------------------------------------------- // Constructors // ------------------------------------------------------------------------- public Chart() - { + { } - + public Chart( String title ) { this.title = title; } - + public void init() { allPeriods.addAll( periods ); allPeriods.addAll( relativePeriods ); allOrganisationUnits.addAll( organisationUnits ); - + if ( organisationUnit != null ) { allOrganisationUnits.add( organisationUnit ); } } - + // ------------------------------------------------------------------------- // hashCode, equals, toString // ------------------------------------------------------------------------- @@ -150,22 +161,22 @@ { return true; } - + if ( object == null ) { return false; } - + if ( getClass() != object.getClass() ) { return false; } - + Chart other = (Chart) object; - + return title.equals( other.getTitle() ); } - + @Override public String toString() { @@ -180,32 +191,32 @@ { return this.type != null && this.type.equals( type ); } - + public boolean isSize( String size ) { return this.size != null && this.size.equals( size ); } - + public boolean isDimension( String dimension ) { return this.dimension != null && this.dimension.equals( dimension ); } - + public boolean isHideLegend() { return hideLegend != null && hideLegend; } - + public boolean isVerticalLabels() { return verticalLabels != null && verticalLabels; } - + public boolean isHorizontalPlotOrientation() { return horizontalPlotOrientation != null && horizontalPlotOrientation; } - + public boolean isRegression() { return regression != null && regression; @@ -215,17 +226,17 @@ { return targetLine != null && targetLine; } - + public int getWidth() { return isSize( SIZE_WIDE ) ? 1000 : 700; } - + public int getHeight() { return isSize( SIZE_TALL ) ? 800 : 500; } - + public boolean isUserOrganisationUnit() { return userOrganisationUnit != null && userOrganisationUnit; @@ -239,12 +250,12 @@ { return title; } - + public void setName( String name ) { this.title = name; } - + // ------------------------------------------------------------------------- // Getters and setters // ------------------------------------------------------------------------- @@ -353,12 +364,26 @@ { this.targetLineValue = targetLineValue; } - + public Double getTargetLineValue() { return targetLineValue; } - + + public void setTargetLineLabel( String targetLineLabel ) + { + this.targetLineLabel = targetLineLabel; + } + + public String getTargetLineLabel() + { + if(targetLineLabel == null || targetLineLabel.length() == 0) { + targetLineLabel = "Target Line"; + } + + return targetLineLabel; + } + public List getIndicators() { return indicators; === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2011-04-24 15:50:02 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2011-05-02 12:54:28 +0000 @@ -227,7 +227,7 @@ executeSql( "ALTER TABLE aggregateddatavalue DROP COLUMN modified"); executeSql( "ALTER TABLE aggregatedindicatorvalue DROP COLUMN modified "); executeSql( "UPDATE indicatortype SET indicatornumber=false WHERE indicatornumber is null" ); - + // remove outdated relative periods executeSql( "ALTER TABLE reporttable DROP COLUMN last3months" ); @@ -279,6 +279,9 @@ executeSql( "ALTER TABLE datavaluearchive DROP CONSTRAINT fk_datavaluearchive_sourceid" ); executeSql( "ALTER TABLE organisationunit DROP CONSTRAINT fke509dd5ef1c932ed" ); executeSql( "DROP TABLE source CASCADE" ); + + // add columns to chart + executeSql( "ALTER TABLE chart ADD COLUMN targetlinelabel varchar(255)" ); log.info( "Tables updated" ); } === 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 2011-04-21 15:15:12 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java 2011-05-02 12:54:28 +0000 @@ -80,9 +80,13 @@ import org.hisp.dhis.user.User; import org.jfree.chart.ChartFactory; import org.jfree.chart.JFreeChart; +import org.jfree.chart.LegendItem; +import org.jfree.chart.LegendItemCollection; +import org.jfree.chart.LegendItemSource; import org.jfree.chart.axis.CategoryAxis; import org.jfree.chart.axis.CategoryLabelPositions; import org.jfree.chart.axis.NumberAxis; +import org.jfree.chart.block.Arrangement; import org.jfree.chart.labels.StandardPieSectionLabelGenerator; import org.jfree.chart.plot.CategoryPlot; import org.jfree.chart.plot.DatasetRenderingOrder; @@ -100,6 +104,7 @@ import org.jfree.chart.title.TextTitle; import org.jfree.data.category.CategoryDataset; import org.jfree.data.category.DefaultCategoryDataset; +import org.jfree.ui.RectangleInsets; import org.jfree.util.TableOrder; import org.springframework.transaction.annotation.Transactional; @@ -539,17 +544,21 @@ plot.setRenderer( 1, lineRenderer ); } + JFreeChart jFreeChart = new JFreeChart( chart.getTitle(), titleFont, plot, !chart.isHideLegend() ); + if ( chart.isTargetLine() ) { Marker marker = new ValueMarker( chart.getTargetLineValue() ); marker.setPaint( Color.BLACK ); - marker.setStroke( new BasicStroke( 1.2f ) ); + marker.setStroke( new BasicStroke( 1.1f ) ); + marker.setLabel( chart.getTargetLineLabel() ); + marker.setLabelOffset( new RectangleInsets( -10, 40, 0, 0 ) ); + marker.setLabelFont( subTitleFont ); plot.addRangeMarker( marker ); } - JFreeChart jFreeChart = new JFreeChart( chart.getTitle(), titleFont, plot, !chart.isHideLegend() ); - + if ( subTitle ) { jFreeChart.addSubtitle( getSubTitle( chart, chart.getFormat() ) ); === modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml' --- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml 2011-04-24 12:17:55 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml 2011-05-02 12:54:28 +0000 @@ -32,6 +32,8 @@ + + === modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/defaultForm.vm' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/defaultForm.vm 2011-03-20 21:45:37 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/defaultForm.vm 2011-05-02 12:54:28 +0000 @@ -38,34 +38,39 @@ #set( $count = $count + 1 ) - $encoder.htmlEncode( $dataElement.name ) + $encoder.htmlEncode( $dataElement.name ) + + #foreach( $optionCombo in $optionCombos ) - #set( $minMax = false ) - #set( $minMax = $minMaxMap.get( "$dataElement.id:$optionCombo.id" ) ) - #set( $dataValue = false ) - #set( $dataValue = $dataValueMap.get( "$dataElement.id:$optionCombo.id" ) ) - #set( $dataEntryId = "value[$dataElement.id].value:value[$optionCombo.id].value" ) - #set( $minMaxError = false ) - #if( $dataElement.type == "int" && $dataValue && $minMax ) - #if( $integer.parseInt( $dataValue.value ) < $minMax.min || $integer.parseInt( $dataValue.value ) > $minMax.max ) - #set( $minMaxError = true ) - #end - #end - - - #if( $dataElement.type == "bool" ) - - - #else - - #end - - #set( $tabIndex = $tabIndex + 1 ) + #set( $minMax = false ) + #set( $minMax = $minMaxMap.get( "$dataElement.id:$optionCombo.id" ) ) + #set( $dataValue = false ) + #set( $dataValue = $dataValueMap.get( "$dataElement.id:$optionCombo.id" ) ) + #set( $dataEntryId = "value[$dataElement.id].value:value[$optionCombo.id].value" ) + #set( $minMaxError = false ) + #if( $dataElement.type == "int" && $dataValue && $minMax ) + #if( $integer.parseInt( $dataValue.value ) < $minMax.min || $integer.parseInt( $dataValue.value ) > $minMax.max ) + #set( $minMaxError = true ) + #end + #end + + + + + + #if( $dataElement.type == "bool" ) + + + #else + + #end + + #set( $tabIndex = $tabIndex + 1 ) #end #end === modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/history.vm' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/history.vm 2011-03-18 12:29:01 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/history.vm 2011-05-02 12:54:28 +0000 @@ -22,9 +22,9 @@ -

$i18n.getString( "dataelement_comment" )

+

$i18n.getString( "dataelement_comment" )

#if( $showComment == 'true' ) - ##comment + ##comment #end - +

$i18n.getString( "followup" )

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/SaveChartAction.java' --- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/SaveChartAction.java 2011-04-14 13:06:10 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/SaveChartAction.java 2011-05-02 12:54:28 +0000 @@ -166,6 +166,12 @@ this.targetLineValue = targetLineValue; } + private String targetLineLabel; + + public void setTargetLineLabel( String targetLineLabel ) { + this.targetLineLabel = targetLineLabel; + } + private boolean userOrganisationUnit; public void setUserOrganisationUnit( boolean userOrganisationUnit ) @@ -277,6 +283,7 @@ chart.setRegression( regression ); chart.setTargetLine( targetLine ); chart.setTargetLineValue( targetLineValue ); + chart.setTargetLineLabel( targetLineLabel ); chart.setUserOrganisationUnit( userOrganisationUnit ); chart.setIndicators( indicators ); chart.setPeriods( periods ); === modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties 2011-04-18 12:06:28 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties 2011-05-02 12:54:28 +0000 @@ -205,6 +205,7 @@ include_regression= Include regression include_target_line= Include target line target_line_value= Target line value +target_line_label= Target line label select = Select criteria = Criteria this_indicator_and_periods = This indicator and periods === modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartForm.vm' --- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartForm.vm 2011-04-18 12:06:28 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartForm.vm 2011-05-02 12:54:28 +0000 @@ -2,11 +2,18 @@ jQuery(document).ready(function() { if( jQuery("#targetLine").attr("checked") !== true ) { - jQuery("#targetLineValueTr").hide(); + jQuery("#targetLineValue").attr("disabled", "disabled"); + jQuery("#targetLineLabel").attr("disabled", "disabled"); } - + jQuery("#targetLine").change(function() { - jQuery("#targetLineValueTr").toggle(); + if(jQuery("#targetLineValue").attr("disabled")) { + jQuery("#targetLineValue").removeAttr("disabled"); + jQuery("#targetLineLabel").removeAttr("disabled"); + } else { + jQuery("#targetLineValue").attr("disabled", "disabled"); + jQuery("#targetLineLabel").attr("disabled", "disabled"); + } }); }); @@ -85,10 +92,14 @@ - + + + + + #if ( $currentUser && $currentUser.hasOrganisationUnit() )