dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #30947
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15736: EV, favorites + DV, trend line bug fixed.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 15736 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-06-17 18:05:09 +0200
message:
EV, favorites + DV, trend line bug fixed.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventchart/EventChart.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventchart/EventChart.hbm.xml
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventChartController.java
dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/core.js
dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/app.js
dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/core.js
dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/core.js
dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/plugin.js
--
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/eventchart/EventChart.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventchart/EventChart.java 2014-06-17 06:38:01 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventchart/EventChart.java 2014-06-17 13:24:01 +0000
@@ -34,43 +34,34 @@
import org.hisp.dhis.common.BaseAnalyticalObject;
import org.hisp.dhis.common.BaseIdentifiableObject;
-import org.hisp.dhis.common.DimensionalObject;
import org.hisp.dhis.common.DxfNamespaces;
import org.hisp.dhis.common.IdentifiableObject;
-import org.hisp.dhis.common.IdentifiableObjectUtils;
-import org.hisp.dhis.common.NameableObject;
import org.hisp.dhis.common.view.DetailedView;
import org.hisp.dhis.common.view.DimensionalView;
import org.hisp.dhis.common.view.ExportView;
import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.period.Period;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramStage;
import org.hisp.dhis.user.User;
-import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonView;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
/**
* @author Jan Henrik Overland
*/
-@JacksonXmlRootElement( localName = "eventchart", namespace = DxfNamespaces.DXF_2_0 )
+
public class EventChart
extends BaseAnalyticalObject
{
- private static final long serialVersionUID = 2570074075484545534L;
-
- public static final String SIZE_NORMAL = "normal";
-
- public static final String SIZE_WIDE = "wide";
-
- public static final String SIZE_TALL = "tall";
+
+ public static final String COUNT_TYPE_EVENTS = "events";
+
+ public static final String COUNT_TYPE_TRACKED_ENTITY_INSTANCES = "tracked_entity_instances";
public static final String TYPE_COLUMN = "column";
@@ -96,20 +87,22 @@
private Date endDate;
- private String dataType;
+ private String type;
+
+ private List<String> columnDimensions = new ArrayList<String>();
+
+ private List<String> rowDimensions = new ArrayList<String>();
private List<String> filterDimensions = new ArrayList<String>();
+ private boolean hideEmptyRows;
+
+ private String countType;
+
private String domainAxisLabel;
private String rangeAxisLabel;
- private String series;
-
- private String category;
-
- private String countType;
-
private boolean hideLegend;
private boolean regression;
@@ -130,8 +123,6 @@
private boolean showData;
- private boolean hideEmptyRows;
-
private Double rangeAxisMaxValue;
private Double rangeAxisMinValue;
@@ -141,36 +132,20 @@
private Integer rangeAxisDecimals;
// -------------------------------------------------------------------------
- // Transient properties
- // -------------------------------------------------------------------------
-
- private transient I18nFormat format;
-
- private transient List<Period> relativePeriods = new ArrayList<Period>();
-
- private transient User user;
-
- private transient List<OrganisationUnit> organisationUnitsAtLevel = new ArrayList<OrganisationUnit>();
-
- private transient List<OrganisationUnit> organisationUnitsInGroups = new ArrayList<OrganisationUnit>();
-
- // -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
public EventChart()
{
- setAutoFields();
}
public EventChart( String name )
{
- this();
this.name = name;
}
// -------------------------------------------------------------------------
- // Init
+ // AnalyticalObject
// -------------------------------------------------------------------------
@Override
@@ -178,62 +153,20 @@
List<OrganisationUnit> organisationUnitsAtLevel, List<OrganisationUnit> organisationUnitsInGroups,
I18nFormat format )
{
- this.user = user;
- this.relativePeriodDate = date;
- this.relativeOrganisationUnit = organisationUnit;
- this.organisationUnitsAtLevel = organisationUnitsAtLevel;
- this.organisationUnitsInGroups = organisationUnitsInGroups;
- this.format = format;
- }
-
- // -------------------------------------------------------------------------
- // Logic
- // -------------------------------------------------------------------------
-
- public List<NameableObject> series()
- {
- DimensionalObject object = getDimensionalObject( series, relativePeriodDate, user, true,
- organisationUnitsAtLevel, organisationUnitsInGroups, format );
-
- return object != null ? object.getItems() : null;
- }
-
- public List<NameableObject> category()
- {
- DimensionalObject object = getDimensionalObject( category, relativePeriodDate, user, true,
- organisationUnitsAtLevel, organisationUnitsInGroups, format );
-
- return object != null ? object.getItems() : null;
- }
-
- public List<NameableObject> filters()
- {
- List<NameableObject> filterItems = new ArrayList<NameableObject>();
-
- for ( String filter : filterDimensions )
- {
- DimensionalObject object = getDimensionalObject( filter, relativePeriodDate, user, true,
- organisationUnitsAtLevel, organisationUnitsInGroups, format );
-
- if ( object != null )
- {
- filterItems.addAll( object.getItems() );
- }
- }
-
- return filterItems;
- }
-
- public String generateTitle()
- {
- return IdentifiableObjectUtils.join( filters() );
}
@Override
public void populateAnalyticalProperties()
{
- columns.addAll( getDimensionalObjectList( series ) );
- rows.addAll( getDimensionalObjectList( category ) );
+ for ( String column : columnDimensions )
+ {
+ columns.addAll( getDimensionalObjectList( column ) );
+ }
+
+ for ( String row : rowDimensions )
+ {
+ rows.addAll( getDimensionalObjectList( row ) );
+ }
for ( String filter : filterDimensions )
{
@@ -241,81 +174,6 @@
}
}
- public List<OrganisationUnit> getAllOrganisationUnits()
- {
- if ( transientOrganisationUnits != null && !transientOrganisationUnits.isEmpty() )
- {
- return transientOrganisationUnits;
- }
- else
- {
- return organisationUnits;
- }
- }
-
- public OrganisationUnit getFirstOrganisationUnit()
- {
- List<OrganisationUnit> units = getAllOrganisationUnits();
- return units != null && !units.isEmpty() ? units.iterator().next() : null;
- }
-
- public List<Period> getAllPeriods()
- {
- List<Period> list = new ArrayList<Period>();
-
- list.addAll( relativePeriods );
-
- for ( Period period : periods )
- {
- if ( !list.contains( period ) )
- {
- list.add( period );
- }
- }
-
- return list;
- }
-
- /**
- * Sets all dimensions for this chart.
- *
- * @param series the series dimension.
- * @param category the category dimension.
- * @param filter the filter dimension.
- */
- public void setDimensions( String series, String category, String filter )
- {
- this.series = series;
- this.category = category;
- this.filterDimensions.clear();
- this.filterDimensions.add( filter );
- }
-
- public boolean isDataType( String dataType )
- {
- return this.dataType != null && this.dataType.equalsIgnoreCase( dataType );
- }
-
- public boolean isTargetLine()
- {
- return targetLineValue != null;
- }
-
- public boolean isBaseLine()
- {
- return baseLineValue != null;
- }
-
- public int getWidth()
- {
- return 700;
- }
-
- public int getHeight()
- {
- return 500;
- }
-
// -------------------------------------------------------------------------
// Getters and setters properties
// -------------------------------------------------------------------------
@@ -377,72 +235,48 @@
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
- public String getDataType()
- {
- return dataType;
- }
-
- public void setDataType( String dataType )
- {
- this.dataType = dataType;
- }
-
- @JsonProperty
- @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
- @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
- public String getDomainAxisLabel()
- {
- return domainAxisLabel;
- }
-
- public void setDomainAxisLabel( String domainAxisLabel )
- {
- this.domainAxisLabel = domainAxisLabel;
- }
-
- @JsonProperty
- @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
- @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
- public String getRangeAxisLabel()
- {
- return rangeAxisLabel;
- }
-
- public void setRangeAxisLabel( String rangeAxisLabel )
- {
- this.rangeAxisLabel = rangeAxisLabel;
- }
-
- @JsonProperty
- @JsonView( { DetailedView.class, ExportView.class } )
- @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
- public String getSeries()
- {
- return series;
- }
-
- public void setSeries( String series )
- {
- this.series = series;
- }
-
- @JsonProperty
- @JsonView( { DetailedView.class, ExportView.class } )
- @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
- public String getCategory()
- {
- return category;
- }
-
- public void setCategory( String category )
- {
- this.category = category;
+ public String getType()
+ {
+ return type;
+ }
+
+ public void setType( String type )
+ {
+ this.type = type;
+ }
+
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlElementWrapper( localName = "columnDimensions", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlProperty( localName = "column", namespace = DxfNamespaces.DXF_2_0 )
+ public List<String> getColumnDimensions()
+ {
+ return columnDimensions;
+ }
+
+ public void setColumnDimensions( List<String> columnDimensions )
+ {
+ this.columnDimensions = columnDimensions;
+ }
+
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlElementWrapper( localName = "rowDimensions", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlProperty( localName = "row", namespace = DxfNamespaces.DXF_2_0 )
+ public List<String> getRowDimensions()
+ {
+ return rowDimensions;
+ }
+
+ public void setRowDimensions( List<String> rowDimensions )
+ {
+ this.rowDimensions = rowDimensions;
}
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlElementWrapper( localName = "filterDimensions", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "filterDimension", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlProperty( localName = "filter", namespace = DxfNamespaces.DXF_2_0 )
public List<String> getFilterDimensions()
{
return filterDimensions;
@@ -456,6 +290,19 @@
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public boolean isHideEmptyRows()
+ {
+ return hideEmptyRows;
+ }
+
+ public void setHideEmptyRows( boolean hideEmptyRows )
+ {
+ this.hideEmptyRows = hideEmptyRows;
+ }
+
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public String getCountType()
{
return countType;
@@ -469,6 +316,32 @@
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public String getDomainAxisLabel()
+ {
+ return domainAxisLabel;
+ }
+
+ public void setDomainAxisLabel( String domainAxisLabel )
+ {
+ this.domainAxisLabel = domainAxisLabel;
+ }
+
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public String getRangeAxisLabel()
+ {
+ return rangeAxisLabel;
+ }
+
+ public void setRangeAxisLabel( String rangeAxisLabel )
+ {
+ this.rangeAxisLabel = rangeAxisLabel;
+ }
+
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public boolean isHideLegend()
{
return hideLegend;
@@ -495,6 +368,45 @@
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public boolean isHideTitle()
+ {
+ return hideTitle;
+ }
+
+ public void setHideTitle( boolean hideTitle )
+ {
+ this.hideTitle = hideTitle;
+ }
+
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public boolean isHideSubtitle()
+ {
+ return hideSubtitle;
+ }
+
+ public void setHideSubtitle( Boolean hideSubtitle )
+ {
+ this.hideSubtitle = hideSubtitle;
+ }
+
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public String getTitle()
+ {
+ return this.title;
+ }
+
+ public void setTitle( String title )
+ {
+ this.title = title;
+ }
+
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public Double getTargetLineValue()
{
return targetLineValue;
@@ -547,45 +459,6 @@
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
- public boolean isHideTitle()
- {
- return hideTitle;
- }
-
- public void setHideTitle( boolean hideTitle )
- {
- this.hideTitle = hideTitle;
- }
-
- @JsonProperty
- @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
- @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
- public boolean isHideSubtitle()
- {
- return hideSubtitle;
- }
-
- public void setHideSubtitle( Boolean hideSubtitle )
- {
- this.hideSubtitle = hideSubtitle;
- }
-
- @JsonProperty
- @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
- @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
- public String getTitle()
- {
- return this.title;
- }
-
- public void setTitle( String title )
- {
- this.title = title;
- }
-
- @JsonProperty
- @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
- @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public boolean isShowData()
{
return showData;
@@ -599,32 +472,6 @@
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
- public boolean isHideEmptyRows()
- {
- return hideEmptyRows;
- }
-
- public void setHideEmptyRows( boolean hideEmptyRows )
- {
- this.hideEmptyRows = hideEmptyRows;
- }
-
- @JsonProperty
- @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
- @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
- public boolean isRewindRelativePeriods()
- {
- return rewindRelativePeriods;
- }
-
- public void setRewindRelativePeriods( boolean rewindRelativePeriods )
- {
- this.rewindRelativePeriods = rewindRelativePeriods;
- }
-
- @JsonProperty
- @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
- @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public Double getRangeAxisMaxValue()
{
return rangeAxisMaxValue;
@@ -675,34 +522,6 @@
}
// -------------------------------------------------------------------------
- // Getters and setters for transient properties
- // -------------------------------------------------------------------------
-
- @JsonIgnore
- public I18nFormat getFormat()
- {
- return format;
- }
-
- @JsonIgnore
- public void setFormat( I18nFormat format )
- {
- this.format = format;
- }
-
- @JsonIgnore
- public List<Period> getRelativePeriods()
- {
- return relativePeriods;
- }
-
- @JsonIgnore
- public void setRelativePeriods( List<Period> relativePeriods )
- {
- this.relativePeriods = relativePeriods;
- }
-
- // -------------------------------------------------------------------------
// Merge with
// -------------------------------------------------------------------------
@@ -719,31 +538,35 @@
programStage = eventChart.getProgramStage();
startDate = eventChart.getStartDate();
endDate = eventChart.getEndDate();
+ type = eventChart.getType();
+
+ columnDimensions.clear();
+ columnDimensions.addAll( eventChart.getColumnDimensions() );
+
+ rowDimensions.clear();
+ rowDimensions.addAll( eventChart.getRowDimensions() );
+
+ filterDimensions.clear();
+ filterDimensions.addAll( eventChart.getFilterDimensions() );
+
+ hideEmptyRows = eventChart.isHideEmptyRows();
+ countType = eventChart.getCountType();
domainAxisLabel = eventChart.getDomainAxisLabel();
- rangeAxisLabel = eventChart.getRangeAxisLabel();
- countType = eventChart.getCountType();
- dataType = eventChart.getDataType();
- series = eventChart.getSeries();
- category = eventChart.getCategory();
+ rangeAxisLabel = eventChart.getRangeAxisLabel();
hideLegend = eventChart.isHideLegend();
- regression = eventChart.isRegression();
+ regression = eventChart.isRegression();
hideTitle = eventChart.isHideTitle();
hideSubtitle = eventChart.isHideSubtitle();
- title = eventChart.getTitle();
+ title = eventChart.getTitle();
targetLineValue = eventChart.getTargetLineValue();
targetLineLabel = eventChart.getTargetLineLabel();
baseLineValue = eventChart.getBaseLineValue();
- baseLineLabel = eventChart.getBaseLineLabel();
+ baseLineLabel = eventChart.getBaseLineLabel();
showData = eventChart.isShowData();
- hideEmptyRows = eventChart.isHideEmptyRows();
- rewindRelativePeriods = eventChart.isRewindRelativePeriods();
rangeAxisMaxValue = eventChart.getRangeAxisMaxValue();
rangeAxisMinValue = eventChart.getRangeAxisMinValue();
rangeAxisSteps = eventChart.getRangeAxisSteps();
rangeAxisDecimals = eventChart.getRangeAxisDecimals();
-
- filterDimensions.clear();
- filterDimensions.addAll( eventChart.getFilterDimensions() );
}
}
}
=== 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 2014-06-16 09:50:27 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2014-06-17 13:24:01 +0000
@@ -153,6 +153,7 @@
executeSql( "ALTER TABLE indicator DROP COLUMN alternativename" );
executeSql( "ALTER TABLE orgunitgroup DROP COLUMN image" );
executeSql( "ALTER TABLE report DROP COLUMN usingorgunitgroupsets" );
+ executeSql( "ALTER TABLE eventchart DROP COLUMN datatype" );
executeSql( "DROP INDEX datamart_crosstab" );
@@ -424,6 +425,10 @@
executeSql( "update organisationunit set haspatients = false where haspatients is null" );
executeSql( "update dataset set expirydays = 0 where expirydays is null" );
executeSql( "update expression set nullifblank = true where nullifblank is null" );
+ executeSql( "update eventchart set hidelegend = false where hidelegend is null" );
+ executeSql( "update eventchart set regression = false where regression is null" );
+ executeSql( "update eventchart set hidetitle = false where hidetitle is null" );
+ executeSql( "update eventchart set hidesubtitle = false where hidesubtitle is null" );
// move timelydays from system setting => dataset property
executeSql( "update dataset set timelydays = 15 where timelydays is null" );
=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventchart/EventChart.hbm.xml'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventchart/EventChart.hbm.xml 2014-06-17 06:38:01 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventchart/EventChart.hbm.xml 2014-06-17 13:24:01 +0000
@@ -71,20 +71,6 @@
<property name="userOrganisationUnitGrandChildren" />
- <property name="showData" />
-
- <property name="hideEmptyRows" />
-
- <property name="rewindRelativePeriods" />
-
- <property name="rangeAxisMaxValue" />
-
- <property name="rangeAxisMinValue" />
-
- <property name="rangeAxisSteps" />
-
- <property name="rangeAxisDecimals" />
-
<many-to-one name="program" class="org.hisp.dhis.program.Program"
column="programid" not-null="true" foreign-key="fk_eventchart_programid" />
@@ -95,7 +81,21 @@
<property name="endDate" />
- <property name="dataType" not-null="true" />
+ <property name="type" not-null="true" />
+
+ <list name="columnDimensions" table="eventchart_columns">
+ <cache usage="read-write" />
+ <key column="eventchartid" foreign-key="fk_eventchart_columns_eventchartid" />
+ <list-index column="sort_order" base="0" />
+ <element type="string" column="dimension" />
+ </list>
+
+ <list name="rowDimensions" table="eventchart_rows">
+ <cache usage="read-write" />
+ <key column="eventchartid" foreign-key="fk_eventchart_rows_eventchartid" />
+ <list-index column="sort_order" base="0" />
+ <element type="string" column="dimension" />
+ </list>
<list name="filterDimensions" table="eventchart_filters">
<cache usage="read-write" />
@@ -104,11 +104,41 @@
<element type="string" column="dimension" />
</list>
+ <property name="showData" />
+
+ <property name="hideEmptyRows" />
+
+ <property name="rangeAxisMaxValue" />
+
+ <property name="rangeAxisMinValue" />
+
+ <property name="rangeAxisSteps" />
+
+ <property name="rangeAxisDecimals" />
+
<property name="countType" />
- <property name="sortOrder" />
-
- <property name="topLimit" />
+ <property name="domainAxisLabel" />
+
+ <property name="rangeAxisLabel" />
+
+ <property name="hideLegend" />
+
+ <property name="regression" />
+
+ <property name="hideTitle" />
+
+ <property name="hideSubtitle" />
+
+ <property name="title" />
+
+ <property name="targetLineValue" />
+
+ <property name="targetLineLabel" />
+
+ <property name="baseLineValue" />
+
+ <property name="baseLineLabel" />
<!-- Access properties -->
<property name="externalAccess" />
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventChartController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventChartController.java 2014-06-16 16:20:38 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventChartController.java 2014-06-17 13:24:01 +0000
@@ -169,18 +169,12 @@
{
dimensionService.mergeAnalyticalObject( eventChart );
+ eventChart.getColumnDimensions().clear();
+ eventChart.getRowDimensions().clear();
eventChart.getFilterDimensions().clear();
-
- if ( eventChart.getColumns() != null )
- {
- eventChart.setSeries( toDimension( eventChart.getColumns().get( 0 ).getDimension() ) );
- }
- if ( eventChart.getRows() != null )
- {
- eventChart.setCategory( toDimension( eventChart.getRows().get( 0 ).getDimension() ) );
- }
-
+ eventChart.getColumnDimensions().addAll( getDimensions( eventChart.getColumns() ) );
+ eventChart.getRowDimensions().addAll( getDimensions( eventChart.getRows() ) );
eventChart.getFilterDimensions().addAll( getDimensions( eventChart.getFilters() ) );
if ( eventChart.getProgram() != null )
=== modified file 'dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/core.js 2014-06-16 11:35:09 +0000
+++ dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/core.js 2014-06-17 14:36:09 +0000
@@ -432,6 +432,12 @@
layout.rows = config.rows;
layout.filters = config.filters;
+ // dates
+ if (config.startDate && config.endDate) {
+ layout.startDate = config.startDate;
+ layout.endDate = config.endDate;
+ }
+
// properties
layout.showTotals = Ext.isBoolean(config.totals) ? config.totals : (Ext.isBoolean(config.showTotals) ? config.showTotals : true);
layout.showSubTotals = Ext.isBoolean(config.subtotals) ? config.subtotals : (Ext.isBoolean(config.showSubTotals) ? config.showSubTotals : true);
=== modified file 'dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/app.js 2014-06-16 13:51:41 +0000
+++ dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/app.js 2014-06-17 15:44:02 +0000
@@ -1783,17 +1783,28 @@
if (ns.app.layout) {
favorite = Ext.clone(ns.app.layout);
-
- // sync
- favorite.totals = favorite.showTotals;
- delete favorite.showTotals;
-
- favorite.subtotals = favorite.showSubTotals;
- delete favorite.showSubTotals;
-
- delete favorite.type;
+
+ // server sync
+ favorite.showData = favorite.showValues;
+ delete favorite.showValues;
+
+ favorite.regression = favorite.showTrendLine;
+ delete favorite.showTrendLine;
+
+ favorite.targetLineLabel = favorite.targetLineTitle;
+ delete favorite.targetLineTitle;
+
+ favorite.baseLineLabel = favorite.baseLineTitle;
+ delete favorite.baseLineTitle;
+
+ favorite.domainAxisLabel = favorite.domainAxisTitle;
+ delete favorite.domainAxisTitle;
+
+ favorite.rangeAxisLabel = favorite.rangeAxisTitle;
+ delete favorite.rangeAxisTitle;
+
+ delete favorite.id;
delete favorite.parentGraphMap;
- delete favorite.id;
delete favorite.displayName;
delete favorite.access;
delete favorite.lastUpdated;
@@ -1848,7 +1859,7 @@
ns.app.stores.eventChart.loadStore();
- ns.app.shareButton.enable();
+ //ns.app.shareButton.enable();
window.destroy();
}
@@ -1865,7 +1876,7 @@
if (id && name) {
Ext.Ajax.request({
- url: ns.core.init.contextPath + '/api/eventCharts/' + id + '.json?viewClass=dimensional&links=false',
+ url: ns.core.init.contextPath + '/api/eventCharts/' + id + '.json?fields=' + ns.core.conf.url.analysisFields.join(','),
method: 'GET',
failure: function(r) {
ns.core.web.mask.show();
@@ -1876,7 +1887,7 @@
eventChart.name = name;
Ext.Ajax.request({
- url: ns.core.init.contextPath + '/api/eventCharts/' + eventReport.id,
+ url: ns.core.init.contextPath + '/api/eventCharts/' + eventChart.id,
method: 'PUT',
headers: {'Content-Type': 'application/json'},
params: Ext.encode(eventChart),
@@ -2092,7 +2103,7 @@
ns.app.stores.eventChart.loadStore();
- ns.app.shareButton.enable();
+ //ns.app.shareButton.enable();
}
});
}
@@ -2145,7 +2156,7 @@
url: ns.core.init.contextPath + '/api/eventCharts/' + record.data.id,
method: 'DELETE',
success: function() {
- ns.app.stores.eventReport.loadStore();
+ ns.app.stores.eventChart.loadStore();
}
});
}
@@ -2608,7 +2619,7 @@
handler: function() {
if (textArea.getValue()) {
Ext.Ajax.request({
- url: ns.core.init.contextPath + '/api/interpretations/eventReports/' + ns.app.layout.id,
+ url: ns.core.init.contextPath + '/api/interpretations/eventCharts/' + ns.app.layout.id,
method: 'POST',
params: textArea.getValue(),
headers: {'Content-Type': 'text/html'},
@@ -4604,7 +4615,7 @@
ns.app.downloadButton.enable();
if (layout.id) {
- ns.app.shareButton.enable();
+ //ns.app.shareButton.enable();
}
//ns.app.statusBar.setStatus(layout, response);
@@ -4643,6 +4654,8 @@
if (!(view.startDate && view.endDate)) {
return;
}
+
+ map['pe'] = [{dimension: 'pe'}];
}
else if (periodMode.getValue() === 'periods') {
map['pe'] = [periods.getDimension()];
@@ -4664,8 +4677,8 @@
// other
- map['longitude'] = [{dimension: 'longitude'}];
- map['latitude'] = [{dimension: 'latitude'}];
+ //map['longitude'] = [{dimension: 'longitude'}];
+ //map['latitude'] = [{dimension: 'latitude'}];
// dimensions
@@ -5346,48 +5359,22 @@
}
Ext.Ajax.request({
- url: init.contextPath + '/api/eventCharts/' + id + '.json?viewClass=dimensional&links=false',
+ url: init.contextPath + '/api/eventCharts/' + id + '.json?fields=' + conf.url.analysisFields.join(','),
failure: function(r) {
web.mask.hide(ns.app.centerRegion);
alert(r.responseText);
},
success: function(r) {
- var config = Ext.decode(r.responseText);
-
- // sync
- config.showTotals = config.totals;
- delete config.totals;
-
- config.showSubTotals = config.subtotals;
- delete config.subtotals;
-
- if (config.startDate) {
- config.startDate = config.startDate.substr(0,10);
- }
-
- if (config.endDate) {
- config.endDate = config.endDate.substr(0,10);
- }
-
- config.paging = {
- page: 1,
- pageSize: 100
- };
-
- if (config.topLimit && config.sortOrder) {
- config.sorting = {
- id: 1,
- direction: config.sortOrder == 1 ? 'DESC' : 'ASC'
- };
- }
-
- web.report.getData(config, true);
+ var layoutConfig = Ext.decode(r.responseText),
+ layout = api.layout.Layout(layoutConfig);
+
+ web.report.getData(layout, true);
}
});
};
- web.report.getData = function(view, isUpdateGui) {
- var paramString = web.analytics.getParamString(view);
+ web.report.getData = function(layout, isUpdateGui) {
+ var paramString = web.analytics.getParamString(layout);
// show mask
web.mask.show(ns.app.centerRegion);
@@ -5417,11 +5404,11 @@
return;
}
- web.mask.show(ns.app.centerRegion, 'Creating table..');
+ web.mask.show(ns.app.centerRegion, 'Error while creating table..');
ns.app.paramString = paramString;
- web.report.createReport(view, response, isUpdateGui);
+ web.report.createReport(layout, response, isUpdateGui);
}
});
};
@@ -5441,6 +5428,8 @@
xResponse = service.response.aggregate.getExtendedResponse(xLayout, response);
xLayout = getSXLayout(xLayout, xResponse);
+ web.mask.show(ns.app.centerRegion, 'Error while rendering chart..');
+
chart = web.report.aggregate.createChart(layout, xLayout, xResponse, ns.app.centerRegion);
//if (layout.sorting) {
@@ -5449,8 +5438,6 @@
//table = getHtml(xLayout, xResponse);
//}
- web.mask.show(ns.app.centerRegion, 'Rendering chart..');
-
// timing
ns.app.dateRender = new Date();
=== modified file 'dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/core.js 2014-06-16 11:41:00 +0000
+++ dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/core.js 2014-06-17 14:58:39 +0000
@@ -203,6 +203,43 @@
dv1: ['#94ae0a', '#0b3b68', '#a61120', '#ff8809', '#7c7474', '#a61187', '#ffd13e', '#24ad9a', '#a66111', '#414141', '#4500c4', '#1d5700']
}
};
+
+ conf.url = {
+ analysisFields: [
+ '*',
+ 'program[id,name]',
+ 'programStage[id,name]',
+ 'columns[dimension,filter,items[id,name]]',
+ 'rows[dimension,filter,items[id,name]]',
+ 'filters[dimension,filter,items[id,name]]',
+ '!lastUpdated',
+ '!href',
+ '!created',
+ '!publicAccess',
+ '!rewindRelativePeriods',
+ '!userOrganisationUnit',
+ '!userOrganisationUnitChildren',
+ '!userOrganisationUnitGrandChildren',
+ '!externalAccess',
+ '!access',
+ '!relativePeriods',
+ '!columnDimensions',
+ '!rowDimensions',
+ '!filterDimensions',
+ '!user',
+ '!organisationUnitGroups',
+ '!itemOrganisationUnitGroups',
+ '!userGroupAccesses',
+ '!indicators',
+ '!dataElements',
+ '!dataElementOperands',
+ '!dataElementGroups',
+ '!dataSets',
+ '!periods',
+ '!organisationUnitLevels',
+ '!organisationUnits'
+ ]
+ };
}());
// api
@@ -460,7 +497,7 @@
return;
}
- if (!config.rows) {
+ if (!config.rows && !config.startDate && !config.endDate) {
alert('No category items selected');
return;
}
@@ -490,15 +527,15 @@
}
// layout
+ layout.columns = config.columns;
+ layout.rows = config.rows;
+ layout.filters = config.filters;
+
layout.type = config.type;
-
layout.program = config.program;
layout.programStage = config.programStage;
-
- layout.columns = config.columns;
- layout.rows = config.rows;
- layout.filters = config.filters;
+ // dates
if (config.startDate && config.endDate) {
layout.startDate = config.startDate;
layout.endDate = config.endDate;
@@ -530,6 +567,8 @@
layout.parentGraphMap = Ext.isObject(config.parentGraphMap) ? config.parentGraphMap : null;
+ layout.legend = Ext.isObject(config.legend) ? config.legend : null;
+
//layout.sorting = Ext.isObject(config.sorting) && Ext.isDefined(config.sorting.id) && Ext.isString(config.sorting.direction) ? config.sorting : null;
//layout.sortOrder = Ext.isNumber(config.sortOrder) ? config.sortOrder : 0;
//layout.topLimit = Ext.isNumber(config.topLimit) ? config.topLimit : 0;
@@ -1811,16 +1850,16 @@
// analytics
web.analytics = {};
- web.analytics.getParamString = function(view, format) {
+ web.analytics.getParamString = function(layout, format) {
var paramString,
- dimensions = Ext.Array.clean([].concat(view.columns || [], view.rows || [])),
+ dimensions = Ext.Array.clean([].concat(layout.columns || [], layout.rows || [])),
ignoreKeys = ['longitude', 'latitude'],
nameItemsMap;
- paramString = '/api/analytics/events/aggregate/' + view.program.id + '.' + (format || 'json') + '?';
+ paramString = '/api/analytics/events/aggregate/' + layout.program.id + '.' + (format || 'json') + '?';
// stage
- paramString += 'stage=' + view.programStage.id;
+ paramString += 'stage=' + layout.programStage.id;
// dimensions
if (dimensions) {
@@ -1849,9 +1888,9 @@
}
// filters
- if (view.filters) {
- for (var i = 0, dim; i < view.filters.length; i++) {
- dim = view.filters[i];
+ if (layout.filters) {
+ for (var i = 0, dim; i < layout.filters.length; i++) {
+ dim = layout.filters[i];
paramString += '&filter=' + dim.dimension;
@@ -1870,29 +1909,8 @@
}
// dates
- if (view.startDate && view.endDate) {
- paramString += '&startDate=' + view.startDate + '&endDate=' + view.endDate;
- }
-
- // hierarchy
- paramString += view.showHierarchy ? '&hierarchyMeta=true' : '';
-
- // limit
- if (view.dataType === 'aggregated_values' && (view.sortOrder && view.topLimit)) {
- paramString += '&limit=' + view.topLimit + '&sortOrder=' + (view.sortOrder < 0 ? 'ASC' : 'DESC');
- }
-
- // sorting
- if (view.dataType === 'individual_cases' && view.sorting) {
- if (view.sorting.id && view.sorting.direction) {
- paramString += '&' + view.sorting.direction.toLowerCase() + '=' + view.sorting.id;
- }
- }
-
- // paging
- if (view.dataType === 'individual_cases' && view.paging) {
- paramString += view.paging.pageSize ? '&pageSize=' + view.paging.pageSize : '';
- paramString += view.paging.page ? '&page=' + view.paging.page : '';
+ if (layout.startDate && layout.endDate) {
+ paramString += '&startDate=' + layout.startDate + '&endDate=' + layout.endDate;
}
return paramString;
@@ -1965,9 +1983,9 @@
};
web.report.aggregate.createChart = function(layout, xLayout, xResponse, centerRegion) {
- var columnIds = xLayout.columns[0].ids,
+ var columnIds = xLayout.columns[0] ? xLayout.columns[0].ids : [],
replacedColumnIds = support.prototype.str.replaceAll(Ext.clone(columnIds), '.', ''),
- rowIds = xLayout.rows[0].ids,
+ rowIds = xLayout.rows[0] ? xLayout.rows[0].ids : [],
replacedRowIds = support.prototype.str.replaceAll(Ext.clone(rowIds), '.', ''),
filterIds = function() {
var ids = [];
@@ -2059,8 +2077,9 @@
regression = new SimpleRegression();
key = conf.finals.data.trendLine + replacedColumnIds[i];
- for (var j = 0; j < data.length; j++) {
- regression.addData(j, data[j][replacedColumnIds[i]]);
+ for (var j = 0, value; j < data.length; j++) {
+ value = data[j][replacedColumnIds[i]];
+ regression.addData(j, parseFloat(value));
}
for (var j = 0; j < data.length; j++) {
@@ -2325,7 +2344,7 @@
field: store.rangeFields,
font: conf.chart.style.fontFamily,
renderer: function(n) {
- return n === '0.0' ? '-' : n;
+ return n === '0.0' ? '' : n;
}
};
}
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/core.js 2014-06-16 13:20:22 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/core.js 2014-06-17 14:48:42 +0000
@@ -1774,8 +1774,9 @@
regression = new SimpleRegression();
key = conf.finals.data.trendLine + columnIds[i];
- for (var j = 0; j < data.length; j++) {
- regression.addData(j, data[j][columnIds[i]]);
+ for (var j = 0, value; j < data.length; j++) {
+ value = data[j][replacedColumnIds[i]];
+ regression.addData(j, parseFloat(value));
}
for (var j = 0; j < data.length; j++) {
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/plugin.js'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/plugin.js 2014-06-16 15:43:42 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/plugin.js 2014-06-17 14:58:39 +0000
@@ -1805,8 +1805,9 @@
regression = new SimpleRegression();
key = conf.finals.data.trendLine + columnIds[i];
- for (var j = 0; j < data.length; j++) {
- regression.addData(j, data[j][columnIds[i]]);
+ for (var j = 0, value; j < data.length; j++) {
+ value = data[j][replacedColumnIds[i]];
+ regression.addData(j, parseFloat(value));
}
for (var j = 0; j < data.length; j++) {