dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #14082
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4645: Added sub title to pie and stacked bar chart
------------------------------------------------------------
revno: 4645
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-09-22 11:15:51 +0200
message:
Added sub title to pie and stacked bar chart
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
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/report/hibernate/Report.hbm.xml
--
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 2011-09-22 07:35:27 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java 2011-09-22 09:15:51 +0000
@@ -27,13 +27,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import org.hisp.dhis.common.ImportableObject;
+import org.hisp.dhis.common.AbstractIdentifiableObject;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.indicator.Indicator;
@@ -45,7 +44,7 @@
* @author Lars Helge Overland
*/
public class Chart
- implements Serializable, ImportableObject
+ extends AbstractIdentifiableObject
{
private static final long serialVersionUID = 2570074075484545534L;
=== 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-09-22 07:43:07 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java 2011-09-22 09:15:51 +0000
@@ -107,7 +107,6 @@
import org.jfree.chart.renderer.category.CategoryItemRenderer;
import org.jfree.chart.renderer.category.LineAndShapeRenderer;
import org.jfree.chart.renderer.category.LineRenderer3D;
-import org.jfree.chart.title.LegendTitle;
import org.jfree.chart.title.TextTitle;
import org.jfree.data.category.CategoryDataset;
import org.jfree.data.category.DefaultCategoryDataset;
@@ -124,8 +123,8 @@
implements ChartService
{
private static final Font titleFont = new Font( "Tahoma", Font.BOLD, 14 );
-
private static final Font subTitleFont = new Font( "Tahoma", Font.PLAIN, 12 );
+ private static final Font labelFont = new Font( "Tahoma", Font.PLAIN, 10 );
private static final String TREND_PREFIX = "Trend - ";
@@ -709,7 +708,7 @@
stackedBarChart = ChartFactory.createStackedBarChart3D( chart.getTitle(), chart.getDomainAxixLabel(),
chart.getRangeAxisLabel(), dataSet, orientation, true, false, false );
}
-
+
CategoryPlot plot = (CategoryPlot) stackedBarChart.getPlot();
plot.setBackgroundPaint( Color.WHITE );
plot.setOutlinePaint( Color.WHITE );
@@ -718,6 +717,8 @@
xAxis.setCategoryLabelPositions( chart.isVerticalLabels() ? CategoryLabelPositions.UP_45
: CategoryLabelPositions.STANDARD );
+ stackedBarChart.getTitle().setFont( titleFont );
+ stackedBarChart.addSubtitle( getSubTitle( chart, chart.getFormat() ) );
stackedBarChart.setAntiAlias( true );
return stackedBarChart;
@@ -738,24 +739,19 @@
!chart.getHideLegend(), false, false );
}
+ multiplePieChart.getTitle().setFont( titleFont );
+ multiplePieChart.addSubtitle( getSubTitle( chart, chart.getFormat() ) );
+ multiplePieChart.getLegend().setItemFont( subTitleFont );
multiplePieChart.setBackgroundPaint( Color.WHITE );
multiplePieChart.setAntiAlias( true );
- TextTitle title = multiplePieChart.getTitle();
- title.setFont( titleFont );
-
- LegendTitle legend = multiplePieChart.getLegend();
- legend.setItemFont( subTitleFont );
-
MultiplePiePlot multiplePiePlot = (MultiplePiePlot) multiplePieChart.getPlot();
JFreeChart pieChart = multiplePiePlot.getPieChart();
pieChart.getTitle().setFont( subTitleFont );
PiePlot piePlot = (PiePlot) pieChart.getPlot();
piePlot.setBackgroundPaint( Color.WHITE );
- piePlot.setShadowXOffset( 0 );
- piePlot.setShadowYOffset( 0 );
- piePlot.setLabelFont( new Font( "Tahoma", Font.PLAIN, 10 ) );
+ piePlot.setLabelFont( labelFont );
piePlot.setLabelGenerator( new StandardPieSectionLabelGenerator( "{2}" ) );
piePlot.setSimpleLabels( true );
piePlot.setIgnoreZeroValues( true );
=== 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-09-07 13:14:46 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml 2011-09-22 09:15:51 +0000
@@ -12,6 +12,8 @@
<generator class="native" />
</id>
+ <property name="uuid" length="40" />
+
<property name="title" not-null="true" unique="true" />
<property name="domainAxixLabel" />
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/report/hibernate/Report.hbm.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/report/hibernate/Report.hbm.xml 2011-09-19 13:34:58 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/report/hibernate/Report.hbm.xml 2011-09-22 09:15:51 +0000
@@ -12,6 +12,8 @@
<generator class="native" />
</id>
+ <property name="uuid" length="40" />
+
<property name="name">
<column name="name" not-null="true" unique="true" length="160" />
</property>