JFreeChart charts appearance when combined with JasperReports - jasper-reports

I use JFreeChart in my java application to display charts like this one:
But after creating a report with JasperReports that chart now looks like this:
And that's not all, this is how a chart looks like inside the first PDF report generated with the app:
And this is how it looks when I generate a second report, without changing anything, just generating it again:
This happens again and again, everytime I restart the application. Charts are ok until I create a report. What's happening?

It looks like JasperReports is using a more prosaic BarPainter in it's ChartTheme, probably to accommodate destinations that handle gradients poorly.
This forum thread suggests applying the desired theme directly to the chart. The createLegacyTheme() method "returns a ChartTheme that doesn't apply any changes to the JFreeChart defaults. It, or something similar, might be worth a try:
StandardChartTheme.createLegacyTheme().apply(chart)

I've moved the edits here as an answer:
The theme problem
Thanks to #trashgod I've tried the following line:
ChartFactory.setChartTheme(StandardChartTheme.createJFreeTheme());
If I use this line before creating charts in my application, reports no longer affect the appearance of them. I think it is enough to put this line just once after report creation.
So now I just have one problem: the first report is different from subsequent reports: charts are different, fonts are bolder and not antialiased...
The Problem of the second report
The pdf issue is not caused by jasper reports nor jfreechart. It is a problem of Adobe Reader. This happens when you have more than one instance of Adobe Reader running (for example, when you have two different files opened).
An example of the problem:
Similar issues:
http://forums.adobe.com/message/4192938
http://forums.adobe.com/thread/902298

Related

Building Blocks not appearing after upgrade to Word 2013

I have a document-level (dotx) customization, with a custom ribbon, and one of the controls in that ribbon is this:
<gallery idMso="CustomGallery1" label="Building Blocks" size="large" />
The only other part that makes this work is the creation of entries under Custom1 in the Building Blocks Organizer. In Word 2010, this would show all the building blocks under the Custom1 category. In Word 2013, it shows the name of each building block briefly, and then all of them are removed and the list is empty:
The building blocks themselves all contain either a document property or document variable.
I have tried the following to resolve this but without success:
Ensured that they are still present by opening the template outside of Visual Studio; they are.
Upgraded the template to the 2013 dotx format.
Re-created the building blocks.
Re-created the entire dotx file, and then re-created the building blocks.
I also tried using other ribbon IDs, they are empty too (they do all have entries) but they display it differently:
There should be four entries there, they exist in my Normal.dotm. The last two controls there, for equations and content controls, do work, except the content control that is inserted displays similar behavior as the Autotext gallery:
I don't know what should be shown in this case but I doubt it's nothing.
Right now I'm assuming that this is just a broken feature in 2013 and will have to replace it with something else. Does anyone know anything to the contrary?
I don't think it is a broken feature, after some struggle, I did get to understand how to use it:
The gallery button in the "toolbar" of a newly added Building Block Gallery Content Control indeed seems empty at first, because it is set to list QuickParts. You have to change it in the properties of the control so that it lists the content of the AutoText Gallery instead (or any other Gallery of Building Blocks you'd like). To do so, either directly click on the Properties button in the Developper tab while the control is selected, or switch to Design Mode so that the Properties appears in the context menu (right-click on the control):
AutoText is "Insertion automatique" in French, the rest you can guess ;)
As far as I could find, it's just a broken feature. There's also a ridiculous memory leak the first time you do a Find and add fields during that find.

How can I set the Navigation tab to bookmarks Panel and Page

I'm generating a report using itext and creating bookmarks in the report. I would like the PDF to open with the bookmark section expanded. I can modify the properties of the document AFTER generation so that this occurs, but the PDF is generated by a batch process, so I want to add this into the generation.
I've tried using addViewerPreference(PdfName, PdfObject) but cannot seem to get this setting to work. I am able to use it to set other initial properties, but not this one.
I'm guessing that either that property isn't supported at all, or is not supported in the version of itext I'm using. I'm still using 2.1.7.

Issue setting data for Radar Chart in iOS charts

I am using the charting library here https://github.com/danielgindi/Charts/ however I am having a couple of issues.
First, I have no idea how to set the data for a radar chart type and second, I have an error when apply the RadarChart to uiview. The error is
Unknown class RadarChartView in Interface Builder file.
The app still runs and I can see an empty uiview.
I have looked at the demo app and through the documentation but I am still unsure how to actually set any data to the chart.
Thanks
If you looked at ChartsDemo app, why you still not unsure how to use it? The code is straightforward. Otherwise I am still copy pasting code from ChartsDemo, which is meaningless.
For the class, you need to choose Charts module for your IB: https://github.com/danielgindi/Charts/issues/59
downloaded library
reembedded it with the option "Embedded Content Contains Swift Code"
In Storyboard where I defined the class for the charts view as "LineChartView", I also have to set the module manually to "Charts".

RGraph: What is causing my pie chart to disappear on-click? (#rgraph)

I'm using the new RGraph beta release, and I can't figure out why this pie chart disappears when you click elsewhere on the page. Here is a screen cast of it happening: http://screencast.com/t/zPRhMqnCKk8.
self.pieChart = new RGraph.Pie('pie_'+self.id,progress)
.Set('shadow', true)
.Set('shadow.color', '#aaa')
.Set('labels',[]) // No labels
.Set('centerx', 50)
.Set('center50', Math.round(h/2))
.Set('radius',Math.round(h/2)-5)
.Set('key',labels)
.Set('key.position.gutter.boxed',false)
.Set('key.position.graph.boxed',false)
.Set('key.position.x',w-140)
.Set('key.position.y',5)
.Set('key.color.shape','circle')
.Set('text.size',8)
.Set('text.color','#555')
.Draw();
I have other charts on the page, and none of them do this. Maybe there is a way to disable click event listeners via Set()?
UPDATE
Richard, the author of RGraph, explained the issue perfectly in his comment. After removing RGraph.common.dynamic.js, my issue was resolved. However, if you need to use dynamic features, this solution may not work for you.
Looks like the Pie chart is being removed from the RGraph ObjectRegistry - which is where objects are held so that they can be redrawn when necessary.
If you don't use dynamic feature you could try excluding RGraph.common.dynamic.js and redraws won't happen when the page is clicked.

Is there a Line of Bar Charting Javascript Library which is free/ Which contains the ability to add a report filter

I've been looking for a javascript library like highcharts or rgraph which contains the ability to add a report filter.
Does anyone know if there is one?
If 'report filtering' = show/hide certain data from the chart. Check this out. i haven't used it myself but looks good: http://code.shutterstock.com/rickshaw/
Also this one looks great too: http://nvd3.org - also powered by the awesome d3.js library