cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

[JAVA] Report Generation on clickable piechart

pabobo
Retired

Hi, 

 

I'm currently working on a Java macro to create clickable piecharts in order to generate another report focusing on the details related to the sector the user clicked on. I found the way to make the piechart clickable using ChartDirector documentation and functionnalities, but I still don't know how to generate the report automatically. 

 

I'm trying to make it work as the yellow arrow (circled in red) in the tab of the second chapter of the report called "Functional planning - Geographical analysis" (see screenshot below).

 

Shot.png

 

Does anybody know how to generate a new report the same way, using Java or any Web language?

 

Thank you in advance for you help,

 

 

 



Patrick Bobo
7 Replies

Claudio, Noé, 

 

Thank you very much for those two answers, it helps me a lot ! I might ask some others questions while I'm trying to make it work for my report. 

 

Have a good weekend Man Happy



Patrick Bobo

Hello Patrick and Kevin,

 

Yes, you should handle the click using Javascript to open an analysis.

The logic I recommend you implement is as follows (I suppose you are using Mega 2009 SP5) :

  • the click calls your own javascript function
  • the javascript function should use Mega APIs and end up with a call such as:
    oObject.CallMethod("~2pGyZ5)wCf30[AddPanel]", "~w0(8(wIxC910[Analysis Generic Formatter]", "clientName", sTabId, sXmlAnalysis);
    This line opens a new tab in Mega with the name clientName, displaying the referenced Formatter on object oObject with sXmlAnalysis as a parameter

You can have a look at ~w0(8(wIxC910[Analysis Generic Formatter] for more information on the existing possibilities (xml analysis, standard existing analysis.). You could also make another, more simple, formatter to handle your specific case.

 

Have a nice week-end

 

Noé

When you click on a place in the generated report you do an event in the browser DOM. Javascript can catch it and execute the code.

To run a new report (not to open - let's say - a new chapter in the previous one) you have to consider at least:

* how you will provide parameters to the new report instance (your request seems to be like a drill-down)

* what is your generation context.

 

For the generation context you have (at least) two options:

* you are inside the desktop

* you are in advisor/anywhere

 

For the desktop, in javascript you have external.megaRoot that provides you a Mega Root javascript object, and you can do whatever you want with the standard APIs.

For Advisor it is more complex, but there are Javascript functions inside Advisor to open a new object, so you can open a new report. But will your report be available? I can't answer.

For Anywhere I'm not sure (never tryed yet), but I think you have a similar context like Advisor.

 

For both Advisor and Anywhere you do not have external.MegaRoot, soory.

 

Claudio Pucci

Just to add a little more context and explination to what Patrick is looking for. If you look at the report ""Functional planning - Geographical analysis" in the demonstration - Adventure repository you have the ability to open a new analysis report by clicking on the "Yellow" arrows as he as highlighted with the red circle in the first post.

 

It is this function he is looking to use - "Click on the arrow and open a new analysis report in a new tab on the workspace"

We can't find any documentation on it and the report is a dll based report so we can't look at the code to see how it's done.

 

Thank you for any help in this area.

 

Kevin Costa

Hi, 

 

This answer you gave me wasn't fully responding to my question. Indeed, I'm looking for the mean of generating a new report from the click on another report. 

 

As I said in the first post, this functionnality already exists in the report ( c.f first post ), and I'd like to add it to my report. I already created my generated report, with a new render to make PieChart clickable. That's the only thing I need now. 

 

So, my question is : Is report generation managed by Javascript? And if so, is it possible to obtain an example of it, to adapt it on my projet ? 

 

Thank you



Patrick Bobo

Hi Noe, 

 

Thank you for your answer, I'll take a look at this !

 

I'll probably finish and reference my renderer before doing anything about the click, but I'll need to take a look at the action I can launch from MEGA APIs. 

 

I'll reply to this post if I have some additional questions!

 

Regards

 

 



Patrick Bobo

nlavallee
MEGA
MEGA

Hello Patrick,

 

The general principle is as follows:

  • You should make use of your ChartDirector code in your own renderer.
    The process of writing and modeling a renderer is detailed in the "Writing Java Analysis Renderers" technical article.
  • You will then reference this renderer in your report, using its megaField, like you would for a standard renderer.

The click itself can launch your own javascript function, where you can call Mega APIs to launch the action of your choice.

 

Don't hesitate if you have more specific questions.

 

Regards