Giter Site home page Giter Site logo

intive-fdv / dynamicjasper Goto Github PK

View Code? Open in Web Editor NEW
242.0 242.0 128.0 11.63 MB

Dynamic Reports using Jasper Reports

Home Page: http://intive-fdv.github.io/DynamicJasper/

License: GNU Lesser General Public License v3.0

Java 94.63% Shell 0.01% CSS 0.90% JavaScript 0.77% Batchfile 0.01% HTML 3.69%
dynamic-reporting excel pdf reporting

dynamicjasper's People

Contributors

dependabot[bot] avatar geoffgibbs avatar inanutshellus avatar jherkel avatar juanalvarezg avatar lrozenblyum avatar mdaloia avatar mguimaraes avatar oyarzun avatar salk31 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dynamicjasper's Issues

Pull Maven dependencies from and publish artifacts to stable, public Maven repositories.

I'm trying to build jGNash which has a dependency on DynamicJasper. Because http://archiva.fdvs.com.ar/repository/public1/ is down, I tried to build DynamicJasper locally and install into my maven local repository. This doesn't work either because the build for DynamicJasper seems to depend on other artifacts that are hosted on the same server.

[INFO] ------------------------------------------------------------------------
[INFO] Building DynamicJasper 5.0.2
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for net.sourceforge:barbecue:jar:1.1 is missing, no dependency information available
[WARNING] The POM for ar.com.fdvs:DynamicJasper-core-fonts:jar:1.0 is missing, no dependency information available
[WARNING] The POM for ar.com.fdvs:DynamicJasper-test-fonts:jar:1.0 is missing, no dependency information available

Setting up a bintray repository is fairly easy and should solve this problem, thought that's not the only option.

I realize this issue is a duplicate of #5 and #14, but it has a clearer title and those issues can be closed.

Warnings when use setTemplateFile

Hello!

I don't how whether it's a problem or now.

Whenever I use DynamicReportBuilder.setTemplateFile

I start getting a lot of warnings of kind:

[sshexec] 13:15:32,174 WARN [DJJRDesignHelper] Duplicate declaration of parameter : REPORT_CONTEXT
[sshexec] 13:15:32,174 WARN [DJJRDesignHelper] Duplicate declaration of parameter : REPORT_PARAMETERS_MAP
[sshexec] 13:15:32,174 WARN [DJJRDesignHelper] Duplicate declaration of parameter : JASPER_REPORTS_CONTEXT
[sshexec] 13:15:32,174 WARN [DJJRDesignHelper] Duplicate declaration of parameter : JASPER_REPORT
[sshexec] 13:15:32,174 WARN [DJJRDesignHelper] Duplicate declaration of parameter : REPORT_CONNECTION
[sshexec] 13:15:32,174 WARN [DJJRDesignHelper] Duplicate declaration of parameter : REPORT_MAX_COUNT
[sshexec] 13:15:32,174 WARN [DJJRDesignHelper] Duplicate declaration of parameter : REPORT_DATA_SOURCE
[sshexec] 13:15:32,174 WARN [DJJRDesignHelper] Duplicate declaration of parameter : REPORT_SCRIPTLET
[sshexec] 13:15:32,174 WARN [DJJRDesignHelper] Duplicate declaration of parameter : REPORT_LOCALE
[sshexec] 13:15:32,174 WARN [DJJRDesignHelper] Duplicate declaration of parameter : REPORT_RESOURCE_BUNDLE
[sshexec] 13:15:32,174 WARN [DJJRDesignHelper] Duplicate declaration of parameter : REPORT_TIME_ZONE
[sshexec] 13:15:32,174 WARN [DJJRDesignHelper] Duplicate declaration of parameter : REPORT_FORMAT_FACTORY
[sshexec] 13:15:32,175 WARN [DJJRDesignHelper] Duplicate declaration of parameter : REPORT_CLASS_LOADER
[sshexec] 13:15:32,175 WARN [DJJRDesignHelper] Duplicate declaration of parameter : REPORT_URL_HANDLER_FACTORY
[sshexec] 13:15:32,175 WARN [DJJRDesignHelper] Duplicate declaration of parameter : REPORT_FILE_RESOLVER
[sshexec] 13:15:32,175 WARN [DJJRDesignHelper] Duplicate declaration of parameter : REPORT_TEMPLATES
[sshexec] 13:15:32,175 WARN [DJJRDesignHelper] Duplicate declaration of parameter : SORT_FIELDS
[sshexec] 13:15:32,175 WARN [DJJRDesignHelper] Duplicate declaration of parameter : FILTER
[sshexec] 13:15:32,175 WARN [DJJRDesignHelper] Duplicate declaration of parameter : REPORT_VIRTUALIZER
[sshexec] 13:15:32,175 WARN [DJJRDesignHelper] Duplicate declaration of parameter : IS_IGNORE_PAGINATION

This is reproducible even when the template is as simple as empty:

<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="report1" >
</jasperReport>

What is needed to do for those warnings not appear? Thanks!

UTF-8 characters are not displayed

First of all thank you guys for making this amazing tool.
When I try to use any UTF-8 characters (in my case Turkish characters such as ğ - i -ş -ç ..) nothing is displayed where these character should show ( for example kişi word is displayed as kii 'n the output PDF).
I have attempted to solve it by setting DynamicReportBuilder in this way : drb.setDefaultEncoding("UTF-8"); as well as set Style of PDF file as : style.setPdfEncoding("UTF-8"); , I have also tried to add jp.setLocaleCode("tr-TR"); to the JasperPrint . However , none of these worked.
Is there something I can do about this? .
thanks in advance.

Maven releases has no correspondent tags in github

I've started evaluating DynamicJasper, but disapointed that in maven there is a 5.0.7 release but here in github the last tag is for 5.0.4.

How can we see the correspondent source code history for these lasts revision?

Will you start create tags for next releases?

Contact Us form CAPTCHA doesn't work

The CAPTCHA image in your "Contact Us" form in your page footer and on the "professional support" page is broken. The CAPTCHA image doesn't appear. Instead, if you visit the image's URL directly the following error is displayed:

Directory "/home/fdvdj/public_html/wp2/wp-content" is writeable by group.

Sounds bad. ;-)

DynamicJasper does not run with JasperReports 6.2.2

DynamicJasper does not run with JasperReports 6.2.2 due to a ClassNotFoundException. (It still runs with 6.2.0, though…)
Caused by: java.lang.NoClassDefFoundError: net/sf/jasperreports/engine/util/JRProperties
at ar.com.fdvs.dj.core.DynamicJasperHelper.generateJasperReport(DynamicJasperHelper.java:524)
at ar.com.fdvs.dj.core.DynamicJasperHelper.generateJasperReport(DynamicJasperHelper.java:502)
at ar.com.fdvs.dj.core.DynamicJasperHelper.generateJasperPrint(DynamicJasperHelper.java:244)

Can't see how to use arbitrary dataSourceExpression

I think vanilla jrxml lets me put in a fragment of Java. I'd like to do this so I can't create a specific bean.

e.g.
subreport.setDatasource(new DJDataSource("new foo.BarJRDataSource()", ???, DJConstants.DATA_SOURCE_TYPE_COLLECTION));

I think a simple new constant and a tweak to the getDataSourceExpression would allow this quite simply if not too evil?

Many thanks

Sam

DynamicJasper missing test folder when adding it with gradle dependency manager

hi, i have a problem with dynamicJasper.
when i add dynamicJasper to my project with gradle using like:
compile group: 'ar.com.fdvs', name: 'DynamicJasper', version: '5.0.10'

the downloaded library has not test folder so i get : cannot resolve ar.com.fdvs.dj.test.ReportExporter;
because it cannot find dj.test and there is no such folder.
I tried different versions and feven I've downloaded the jar file manually but it is the same.
how do i use this library to get the full package?

pom doesn't have any dependencies?

I downloaded the source so that I could run some of the unit tests, but the pom.xml has no dependencies listed? How would this even build?

Don't use legacy apache-collections (3.2.2)

You should not use the old version of apache-collections (v3.2.2) especially that in the same file uses apaceh-collections4 also.

example in ar.com.fdvs.dj.core.layout.AbstractLayoutManager :

import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.Predicate;
import org.apache.commons.collections4.MultiValuedMap;
import org.apache.commons.collections4.multimap.ArrayListValuedHashMap;

Dynamic Jasper webesite is not working

Hi,
I am new to the DynamicJasper reports. Need help, tutorials and examples.
I am trying to access http://dynamicjasper.com/ but it is not working. Getting "No data received" error every time.
Didn't get dynamic jasper examples on other sites also.
Is it in under maintenance?

Please help?

No reset page number option on Groups

With JapserReports, for Groups there is an option :
isResetPageNumber - If true, when a new group starts, the built-in PAGE_NUMBER variable will be reset. The default value is false.

I don't find this option in DJGroup class, is it possible to add it ? Or maybe there is a workaround ?

Many thx.

I have problems with addAutoText.

I have problems with addAutoText. It is not working at all… it produce a IndexOutOfBound exception with the message of “0”.

I am just adding couple of auto texts to the footer:

drb.addAutoText(AutoText.AUTOTEXT_PAGE_X_OF_Y, AutoText.POSITION_FOOTER, AutoText.ALIGNMENT_RIGHT, 30, 30, atStyle1);
drb.addAutoText(AutoText.AUTOTEXT_CREATED_ON, AutoText.POSITION_FOOTER, AutoText.ALIGNMENT_LEFT, AutoText.PATTERN_DATE_DATE_TIME);

An my previous report definition is quite simple:

DynamicReportBuilder drb = new DynamicReportBuilder();
drb.setTitle(tab.getTitle())
.setSubtitle("Autogenerated Report by TagControl ERC")
.setDetailHeight(15)
.setMargins(30, 20, 30, 15)
.setDefaultStyles(titleStyle, subtitleStyle, headerStyle, detailStyle)
.addStyle(subtitleStyleParent) //register the parent style
.setPrintBackgroundOnOddRows(true);
...
drb.setUseFullPageWidth(true);
drb.setPageSizeAndOrientation(Page.Page_Letter_Landscape());
...

So, if I remove the couple autoTexts the report is created and generated without problems!.. what should I do in order to add couple of lines as page footer (for Page X of Y and creation DateTime)?

Regards,

GET http://dynamicjasper.com ERR_ZERO_SIZE_OBJECT

$curl -v --head http://dynamicjasper.com

  • Rebuilt URL to: http://dynamicjasper.com/
  • Trying 200.58.119.89...
  • Connected to dynamicjasper.com (200.58.119.89) port 80 (#0)

    HEAD / HTTP/1.1
    Host: dynamicjasper.com
    User-Agent: curl/7.47.0
    Accept: /

  • HTTP 1.0, assume close after body
    < HTTP/1.0 502 Bad Gateway
    HTTP/1.0 502 Bad Gateway
    < Server: squid
    Server: squid
    < Date: Fri, 30 Sep 2016 10:26:09 GMT
    Date: Fri, 30 Sep 2016 10:26:09 GMT
    < Content-Type: text/html
    Content-Type: text/html
    < Content-Length: 945
    Content-Length: 945
    < Expires: Fri, 30 Sep 2016 10:26:09 GMT
    Expires: Fri, 30 Sep 2016 10:26:09 GMT
    < X-Squid-Error: ERR_ZERO_SIZE_OBJECT 0
    X-Squid-Error: ERR_ZERO_SIZE_OBJECT 0
    < X-Cache: MISS from gw.centp.ru
    X-Cache: MISS from gw.centp.ru
    < Connection: close
    Connection: close

Can't use markup in setTitle (or setSubTitle)

If i want to put a line break in the title, I thought you could use the 'markup' type of style from jasper reports:

.setTitle("Line 1<br>Line2")

But this doesn't seem to work. putting \n in the place of the br tag breaks the compiler. It seems like you'd need to specify that the style uses markup per this link:
http://jasperreports.sourceforge.net/sample.reference/markup/index.html

But I can't find any way through the DynamicJasper API to specify this property of the style.

AustText is not working properly.

I have a bug to report. Using the latest version 5.0.7.

AustText is not working properly. I have the following code for footer from the examples

drb.addAutoText(“Profile Report”, AutoText.POSITION_FOOTER, AutoText.ALIGNMENT_LEFT, 200);
– The above is working
;drb.addAutoText(AutoText.AUTOTEXT_PAGE_X_OF_Y, AutoText.POSITION_FOOTER, AutoText.ALIGNMENT_CENTER, 30, 30);
– The above is not working. Displaying ‘autote 19’ (19 is no of pages)
;drb.addAutoText(AutoText.AUTOTEXT_CREATED_ON, AutoText.POSITION_FOOTER, AutoText.ALIGNMENT_RIGHT, AutoText.PATTERN_DATE_DATE_TIME);
– The above not working. Displaying ‘autoteext’

Appreciate any help.
Shawn

addImageBanner(byte[] imageData)

A method to add an image banner from an inputstream or byte-array would be greatly appreciated. Currently there is only a method which takes a path-string.
This would help in environments where you put dynamic images stored in a database on a report (like product-logos on a fact-sheet).

Unable to create more than one subreport with charts

I am getting an exception when trying to create a report with 2 subreport which each contain a chart.
It seems to register some parameters without prefixing some unique id for each subreport.

When trying to create the report I get the following exception:

ar.com.fdvs.dj.core.layout.LayoutException: Duplicate declaration of parameter: categoryAxisLabel_chart_0.
    at ar.com.fdvs.dj.core.layout.AbstractLayoutManager.applyLayout(AbstractLayoutManager.java:111)
    at ar.com.fdvs.dj.core.DynamicJasperHelper.generateJasperReport(DynamicJasperHelper.java:557)
    at ar.com.fdvs.dj.core.DynamicJasperHelper.compileOrLoadSubreports(DynamicJasperHelper.java:472)
    at ar.com.fdvs.dj.core.DynamicJasperHelper.generateJasperReport(DynamicJasperHelper.java:549)
    at ar.com.fdvs.dj.core.DynamicJasperHelper.generateJasperReport(DynamicJasperHelper.java:534)
    at jaspertest.JasperTest.createMultipleCharts(JasperTest.java:167)
    at jaspertest.JasperTest.main(JasperTest.java:75)
Caused by: ar.com.fdvs.dj.core.registration.EntitiesRegistrationException: Duplicate declaration of parameter: categoryAxisLabel_chart_0.
    at ar.com.fdvs.dj.util.LayoutUtils.registerCustomExpressionParameter(LayoutUtils.java:120)
    at ar.com.fdvs.dj.util.ExpressionUtils.createAndRegisterExpression(ExpressionUtils.java:214)
    at ar.com.fdvs.dj.domain.chart.plot.BarPlot.transform(BarPlot.java:107)
    at ar.com.fdvs.dj.domain.chart.DJChart.transform(DJChart.java:227)
    at ar.com.fdvs.dj.core.layout.AbstractLayoutManager.createChart(AbstractLayoutManager.java:1151)
    at ar.com.fdvs.dj.core.layout.AbstractLayoutManager.layoutCharts(AbstractLayoutManager.java:924)
    at ar.com.fdvs.dj.core.layout.AbstractLayoutManager.endLayout(AbstractLayoutManager.java:159)
    at ar.com.fdvs.dj.core.layout.ClassicLayoutManager.endLayout(ClassicLayoutManager.java:160)
    at ar.com.fdvs.dj.core.layout.AbstractLayoutManager.applyLayout(AbstractLayoutManager.java:106)
    ... 6 more
Caused by: net.sf.jasperreports.engine.JRException: Duplicate declaration of parameter: categoryAxisLabel_chart_0.
    at net.sf.jasperreports.engine.design.JRDesignDataset.addParameter(JRDesignDataset.java:616)
    at net.sf.jasperreports.engine.design.JRDesignDataset.addParameter(JRDesignDataset.java:601)
    at net.sf.jasperreports.engine.design.JasperDesign.addParameter(JasperDesign.java:810)
    at ar.com.fdvs.dj.util.LayoutUtils.registerCustomExpressionParameter(LayoutUtils.java:118)
    ... 14 more

To reproduce you can use the following example:

 public class JasperTest {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) 
    {
        try {
            createMultipleCharts();
            System.out.println("No error");
        } catch(Exception ex) {
            System.out.println("Expection:");
            System.out.println(ex.getMessage());
            System.out.println(org.apache.commons.lang.exception.ExceptionUtils.getStackTrace(ex));
        }

    }

    public static void createMultipleCharts() throws ClassNotFoundException, JRException
    {
        // Create a dummy style
        Style style = new Style("lala");
        style.setFont(Font.MONOSPACED_BIG);

        DynamicReportBuilder drb = new DynamicReportBuilder();

        // Create columns for the chart only reports
        AbstractColumn chartColumnDate = ColumnBuilder.getNew()
                .setColumnProperty("stringVal", String.class.getName())
                .setTitle("stringVal")
                .setWidth(Integer.valueOf(75))
                .build();
        AbstractColumn chartColumnUniqueVisits = ColumnBuilder.getNew()
                .setColumnProperty("numVal", Integer.class.getName())
                .setTitle("numVal")
                .setWidth(Integer.valueOf(75))
                .build();
        AbstractColumn chartColumnDate2 = ColumnBuilder.getNew()
                .setColumnProperty("stringVal", String.class.getName())
                .setTitle("stringVal")
                .setWidth(Integer.valueOf(75))
                .build();
        AbstractColumn chartColumnUniqueVisits2 = ColumnBuilder.getNew()
                .setColumnProperty("numVal", Integer.class.getName())
                .setTitle("numVal")
                .setWidth(Integer.valueOf(75))
                .build();

        // Fetch the data source
        JRDataSource mainDS = getDummyMapCollectionDataSource();
        JRMapCollectionDataSource subDS1 = getDummyMapCollectionDataSource();
        JRMapCollectionDataSource subDS2 = getDummyMapCollectionDataSource();

        // Add the params and the report to concatenate
        // If collection datasource is defined as param, we need to use the data (collection) instead of the datasource
        Map params = new HashMap();
        params.put("subReportData1", subDS1.getData());
        params.put("subReportData2", subDS2.getData());

        // Create a subreport
        List<DJChart> charts = new ArrayList<DJChart>();
        DJChart chart1_1 = createChart(chartColumnDate, chartColumnUniqueVisits, style);
        DJChart chart1_2 = createChart(chartColumnDate, chartColumnUniqueVisits, style);
        charts.add(chart1_1);
        charts.add(chart1_2);
        List<DJChart> charts2 = new ArrayList<DJChart>();
        DJChart chart2_1 = createChart(chartColumnDate2, chartColumnUniqueVisits2, style);
        charts2.add(chart2_1);
        ArrayList<AbstractColumn> chartColumns1 = new ArrayList<AbstractColumn>();
        chartColumns1.add(chartColumnDate);
        chartColumns1.add(chartColumnUniqueVisits);
        ArrayList<AbstractColumn> chartColumns2 = new ArrayList<AbstractColumn>();
        chartColumns2.add(chartColumnDate2);
        chartColumns2.add(chartColumnUniqueVisits2);
        DynamicReport chartDyn = createTableSubReport(style, chartColumns1, charts, false);
        DynamicReport chartDyn2 = createTableSubReport(style, chartColumns2, charts2, false);

        // Create Subreports instead of using the Dynamic Reports directly
        SubReportBuilder srb = new SubReportBuilder();
        Subreport chartSub = srb
                .setDataSource(DJConstants.DATA_SOURCE_ORIGIN_PARAMETER, DJConstants.DATA_SOURCE_TYPE_COLLECTION, "subReportData1")
                .setDynamicReport(chartDyn, new ClassicLayoutManager())
                .build();

        // Add the reports to the main report
        drb.addConcatenatedReport(chartSub);
        drb.addConcatenatedReport(chartDyn2, new ClassicLayoutManager(), 
                    "subReportData2", DJConstants.DATA_SOURCE_ORIGIN_PARAMETER, DJConstants.DATA_SOURCE_TYPE_COLLECTION, true);

        // Build the dynamic report instance
        DynamicReport dr = drb.setDefaultStyles(style, style, style, style)
                .setTitle("Awesome  Report Title")
                .setSubtitle("This report was generated at " + new Date())
                .setPrintBackgroundOnOddRows(true)
                .setUseFullPageWidth(true)
                .build();


        // Compile, fill and view
        ClassicLayoutManager lm = new ClassicLayoutManager();
        JasperReport jasperReport = DynamicJasperHelper.generateJasperReport(dr, lm, params);
        JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, mainDS);
        JasperViewer.viewReport(jasperPrint);    //finally display the report report
    }

    private static DynamicReport createTableSubReport(Style style, List<AbstractColumn> columns, List<DJChart> charts, Boolean showTable)
    {
        DynamicReportBuilder drb = new DynamicReportBuilder();

        // Add the columns to the report bulder
        for (AbstractColumn column : columns) {
            drb.addColumn(column);
        }

        // Add the columns to the report bulder
        for (DJChart djChart : charts) {
            drb.addChart(djChart);
        }

        // If we want to only show the charts or also the table
        drb.setShowDetailBand(showTable);

        // Build the dynamic report instance
        DynamicReport dr = drb.setDefaultStyles(style, style, style, style) // TODO DO NOT CHECK IN quick hack so that no "Arial" is used, which is currently not available....
                .setTitle("Subreport")
                .setSubtitle("This subreport was generated at " + new Date())
                .setPrintBackgroundOnOddRows(true)
                .setUseFullPageWidth(true)
                .build();
        return dr;
    }

    private static DJChart createChart(AbstractColumn catgeory, AbstractColumn dataSerie, Style style)
    {
        // Do the chart stuff:
        DJAxisFormat categoryAxisFormat = new DJAxisFormat("category");
        categoryAxisFormat.setLabelFont(Font.ARIAL_SMALL);
        categoryAxisFormat.setLabelColor(Color.DARK_GRAY);
        categoryAxisFormat.setTickLabelFont(Font.ARIAL_SMALL);
        categoryAxisFormat.setTickLabelColor(Color.DARK_GRAY);
        categoryAxisFormat.setTickLabelMask("");
        categoryAxisFormat.setLineColor(Color.DARK_GRAY);

        DJAxisFormat valueAxisFormat = new DJAxisFormat("value");
        valueAxisFormat.setLabelFont(Font.ARIAL_SMALL);
        valueAxisFormat.setLabelColor(Color.DARK_GRAY);
        valueAxisFormat.setTickLabelFont(Font.ARIAL_SMALL);
        valueAxisFormat.setTickLabelColor(Color.DARK_GRAY);
        valueAxisFormat.setTickLabelMask("#,##0.0");
        valueAxisFormat.setLineColor(Color.DARK_GRAY);
        valueAxisFormat.setRangeMaxValueExpression(new NumberExpression(new Integer(100000)));

        Random rand = new Random();
        Integer max = 999999999;
        Integer min = 0;
        // nextInt is normally exclusive of the top value,
        // so add 1 to make it inclusive
        int randomNum = rand.nextInt((max - min) + 1) + min;

        // Create the bar chart
        DJChart djChart = new DJBarChartBuilder()
                //chart     
                .setX(20)
                .setY(10)
                .setWidth(500)
                .setHeight(250)
                .setCentered(false)
                .setBackColor(Color.LIGHT_GRAY)
                .setShowLegend(true)
                .setPosition(DJChartOptions.POSITION_HEADER)
                .setTitle("Subreport Chart Title" + rand.nextInt((max - min) + 1) + min)
                .setTitleColor(Color.DARK_GRAY)
                .setTitleFont(Font.ARIAL_BIG_BOLD)
                .setSubtitle("Subreport Chart Subtitle" + rand.nextInt((max - min) + 1) + min)
                .setSubtitleColor(Color.DARK_GRAY)
                .setSubtitleFont(Font.COURIER_NEW_BIG_BOLD)
                .setLegendColor(Color.DARK_GRAY)
                .setLegendFont(Font.COURIER_NEW_MEDIUM_BOLD)
                .setLegendBackgroundColor(Color.WHITE)
                .setLegendPosition(DJChartOptions.EDGE_BOTTOM)
                .setTitlePosition(DJChartOptions.EDGE_TOP)
                .setLineStyle(DJChartOptions.LINE_STYLE_DOTTED)
                .setLineWidth(1)
                .setLineColor(Color.DARK_GRAY)
                .setPadding(5)
                //dataset
                .setCategory((PropertyColumn) catgeory)
                .addSerie(dataSerie, "date")
                //plot
                .setShowTickMarks(true)
                .setShowTickLabels(true)
                .setShowLabels(false)
                .setCategoryAxisFormat(categoryAxisFormat)
                .setValueAxisFormat(valueAxisFormat)
                .build();

        return djChart;
    }

    private static DynamicReport createChartSubReport(AbstractColumn catgeory, AbstractColumn dataSerie, Style style)
    {
        DynamicReportBuilder drb = new DynamicReportBuilder();

        // Do the chart stuff:
        DJAxisFormat categoryAxisFormat = new DJAxisFormat("category");
        categoryAxisFormat.setLabelFont(Font.ARIAL_SMALL);
        categoryAxisFormat.setLabelColor(Color.DARK_GRAY);
        categoryAxisFormat.setTickLabelFont(Font.ARIAL_SMALL);
        categoryAxisFormat.setTickLabelColor(Color.DARK_GRAY);
        categoryAxisFormat.setTickLabelMask("");
        categoryAxisFormat.setLineColor(Color.DARK_GRAY);

        DJAxisFormat valueAxisFormat = new DJAxisFormat("value");
        valueAxisFormat.setLabelFont(Font.ARIAL_SMALL);
        valueAxisFormat.setLabelColor(Color.DARK_GRAY);
        valueAxisFormat.setTickLabelFont(Font.ARIAL_SMALL);
        valueAxisFormat.setTickLabelColor(Color.DARK_GRAY);
        valueAxisFormat.setTickLabelMask("#,##0.0");
        valueAxisFormat.setLineColor(Color.DARK_GRAY);
        valueAxisFormat.setRangeMaxValueExpression(new NumberExpression(new Integer(100000)));

        // Add the columns required for the chart
        drb.addColumn(catgeory);
        drb.addColumn(dataSerie);

        // Create the bar chart
        DJChart djChart = createChart(catgeory, dataSerie, style);
        drb.addChart(djChart);

        // Build the dynamic report instance
        DynamicReport dr = drb.setDefaultStyles(style, style, style, style) // TODO DO NOT CHECK IN quick hack so that no "Arial" is used, which is currently not available....
                .setTitle("Chart tut Subreport")
                .setSubtitle("This subreport was generated at " + new Date())
                .setShowDetailBand(false) // We dont show the columns
                .setUseFullPageWidth(true)
                .build();

        return dr;
    }

    private static AbstractColumn createColumn(String property, Class type,
            String title, int width, Style headerStyle, Style detailStyle, String fieldDescription)
            throws ColumnBuilderException {


        AbstractColumn column = ColumnBuilder.getNew()
                .setColumnProperty(property, type.getName())
                .setTitle(title)
                .setWidth(Integer.valueOf(width))
                .setStyle(detailStyle)
                .setHeaderStyle(headerStyle)
                .setFieldDescription(fieldDescription)
                .build();

        return column;
    }

    public static JRMapCollectionDataSource getDummyMapCollectionDataSource() throws JRException
    {
        // List data source
        List simpleList = new ArrayList();
        for (int i = 0; i < 10; i++) {
            Map simpleMap = new HashMap();
            simpleMap.put("stringVal", "SomeElement" + i);
            simpleMap.put("numVal", i * 10000);
            simpleList.add(simpleMap);
        }

        return new JRMapCollectionDataSource(simpleList);
    }

}

DynamicJasper library used: DynamicJasper-5.0.2
JasperReports library: 6.1.0
Also tested JasperReports library 6.0.0

defaultValueExpression for Parameter?

Possibly me but I can't see how to add a defaultValueExpression to parameter.

JRDesignParameter seems to have it but I can't see DynamicJasper ever setting it.

Any work around?

Thanks

Sam

Maven Repository offline?

HTTP ERROR 500

Problem accessing /repository/public1/. Reason:

INTERNAL_SERVER_ERROR

Caused by:

java.lang.NullPointerException
at java.util.Arrays$ArrayList.(Arrays.java:3357)
at java.util.Arrays.asList(Arrays.java:3343)
at org.apache.maven.archiva.webdav.util.IndexWriter.writeHyperlinks(IndexWriter.java:116)
at org.apache.maven.archiva.webdav.util.IndexWriter.write(IndexWriter.java:70)
at org.apache.maven.archiva.webdav.ArchivaDavResource.spool(ArchivaDavResource.java:223)
at org.apache.jackrabbit.webdav.server.AbstractWebdavServlet.spoolResource(AbstractWebdavServlet.java:422)

Integrating JRXML template

I am using dynamicjasper to integrate JRML template created using IReport 5.6.0. text field passed through parameters not populated in PDF.

DynamicJasper - 5.1.0
JasperReport - 6.4.0
Java - 1.8

Font API inconsistency

As of 5.1.0 the Font constructor only takes an int for size.

setFontSize and getFontSize should be int values only as well.

RTL language strange word behavior

Hello @juanalvarezg ,

I am using Dynamic Jasper to create dynamic reports in Arabic language from within my web application.
I am exporting to PDF, Excel, and word.
There is no problem when generation PDF, and Excel.

the only problem that i have is in word when generation text in Arabic it gives me a strange behavior.
lest suppose i am generating a report with the following text : "عمرو عامر الفارس"
it is printed as "الفارس عامرعمرو "
i dont know what is the problem and why its behaving like this.

please check the following link for an image of the behavior that i mentioned.

Thanks in advance.

Starting page number feature

I made a patch to set the first page number when adding autotext to the FastReportBuilder, if you are interested in this feature I 'll create a pull request

Multi axis Charts

Hi,

Is it currently on your roadmap to implement multiaxis charts using Dynamic Jasper?

What is the best way to implement this currently in a dynamic fashion? I'm considering contributing the solution back.

Cannot add hyperlink to chart series

When add chart to report, from jasper studio, it is possible to add hyperlink to each series. When using dynamic jasper builder, cannot add hyperlink.
To fix this problem, need change the categorydateset.java and related dataset.java, check if the column have hyperlink, and do some operation.

Grouping Issue in Report

We are using Dynamicjasper 5.0.9 version for reporting purpose(Even tried the older versions). but we have a grouping issue in the repport, however this work fine with jvm 1.7 but not with jvm1.8. I am attaching the documents for your refrence.

Thanks
Thomas Joy
withjvm1.7.pdf
withjvm1.8.pdf

Unable to set Excel column width

According to this article, I should be able to set column widths that are used during Excel export, using this property:

<property name="net.sf.jasperreports.export.xls.column.width" value="110"/>

I've tried setting it as a field property like this:

public static AbstractColumn getStringColumn(String field, String title, int width) throws ColumnBuilderException {
        return ColumnBuilder.getNew()
        .setColumnProperty(field, String.class.getName())
        .addFieldProperty("net.sf.jasperreports.export.xls.column.width", "200")
        .setTitle(title)
        .setWidth(width)
        .build();    
}

but nothing happens. How should I be setting the element level property?

Note that setting the column width ratio property on report level works, using this:

<property name="net.sf.jasperreports.export.xls.column.width.ratio" value="1.25f"/>

Ability to add Crosstabs to summary

Currently, crosstabs can only be added via groups.

I would like to be able to add them to a summary, but I don't believe that this is currently possible.

CustomExpression in sub-SubReport

It appears one cannot have a CustomExpression within a sub-sub-report.

I've augmented the SubReportRecursive2Test to demonstrate the issue. See inanutshellus@040cae1.

The problem appears to be that DJ is attempting to pull the custom expression from the pojo, rather than the DJ column. This causes DJ to blow up with Error retrieving field value from bean : customExpression_for_DJR_1234_COLUMN_0.

DynamicJasperHelper.generateJasperReport vs. DynamicJasperHelper.generateJasperPrint - ConditionalStyles problem

Can someone explain me why ConditionStyles not working if we first generate JasperReport from DynamicReport and later fill report and create JasperPrint object?

In ConditionalStyleReportTest2 report is generated by:

JasperPrint jp = DynamicJasperHelper.generateJasperPrint(dynamicReport, getLayoutManager(), ds);

After generation, we can display this report using:

JasperViewer.viewReport(jp);

But If I modify this test and add this code to the end of test() method I get two reports one with style another without.

//Paste this code after exporter.exportReport(); in test() method
JasperViewer.viewReport(jp);
try {
    JasperReport jr = DynamicJasperHelper.generateJasperReport(drb.build(), getLayoutManager(), new HashMap());
    JasperPrint jasperPrint = JasperFillManager.fillReport(jr, new HashMap<String, Object>(), new    JRBeanCollectionDataSource(list));
    JasperViewer.viewReport(jasperPrint);
} catch (JRException e) {
    e.printStackTrace();
}

Is there some reason why styles are not supported when JasperReport is created?

No release announcement about latest releases?

I'm used to seeing a blog post on dynamicjasper.com when you release a new version, but nothing since 5.0.4?

Also - what is the latest version of JasperReports that is now supported?
Last it was v6.0.3 - I need functionality provided in 6.2.2 however... supported?

How can I hide labels in Pie Chart?

I'd like to be able to hide the labels in a pie chart, while leaving the legend as it is, but it seems there is no way to do that. Any suggestion?

Maven Repository

Hey,
I just want to ask why you don´t publish your repo to the official maven repository?
Its not very cool to first bind in your nexus so that I can use the maven dependency.

I took a quick look how you can publish to the offizial repo and it really don´t seems to be that hard.

Greetz

Watermark is covered by row fill, images and other elements

Hi,

Is there any way (or any plans to add the functionality) to add a watermark on top of the report instead of as a background? I need it to render over the different report elements and not be occluded by a row background for example.

Thanks

pdf export problem

I am using dynamicjasper 5.0.4 with primefaces 5.3 and jsf 2.2 I tried to use different versions of itext library and others libraries but i get many errors I want to know the most appropriate version For use with these technology

thanks
Doaa

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.