Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Adding comments to the graph generated by BIRT.(I have a requirement where clients will add comments to the graph generated by BIRT..)
Adding comments to the graph generated by BIRT. [message #853621] Mon, 23 April 2012 07:20 Go to next message
Debarshi Dasgupta is currently offline Debarshi DasguptaFriend
Messages: 25
Registered: April 2012
Junior Member
Hello All,

My requirement is to allow users to add comments on the chart generated by BIRT. Please suggest me some possible solutions to implement the same.

My platform details are as follows :

BIRT runtime version : 3_7_2
Server : Tomcat 6/WAS 6
Java : 1.5

I am trying to use BIRT with jsf4birt so that I can integrate BIRT with my existing applications (most of them are using jsf 1.2).

Thanks in advance !!
Re: Adding comments to the graph generated by BIRT. [message #854321 is a reply to message #853621] Mon, 23 April 2012 21:59 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

I do not know of an easy solution to this. The chart engine is either
generating an image or an svg file depending on the chart output type
selected. If you used client side javascript you could add text
elements around the chart but when you exported these to pdf they would
be lost.

Jason

On 4/23/2012 3:20 AM, Debarshi Dasgupta wrote:
> Hello All,
>
> My requirement is to allow users to add comments on the chart generated
> by BIRT. Please suggest me some possible solutions to implement the same.
>
> My platform details are as follows :
>
> BIRT runtime version : 3_7_2
> Server : Tomcat 6/WAS 6
> Java : 1.5
> I am trying to use BIRT with jsf4birt so that I can integrate BIRT with
> my existing applications (most of them are using jsf 1.2).
>
> Thanks in advance !!
Re: Adding comments to the graph generated by BIRT. [message #854678 is a reply to message #854321] Tue, 24 April 2012 06:38 Go to previous messageGo to next message
Debarshi Dasgupta is currently offline Debarshi DasguptaFriend
Messages: 25
Registered: April 2012
Junior Member
Hi Jason,

Thanks for the reply.

My requirement is allow users to add comments on the chart generated and retain the comments in a database so that they can be displayed on load next time some one views the same report.

It is fine with me if comments are not displayed in the pdf reports.

Please suggest me a feasible solution for the same. Please share some links where you have posted about tooltip.
Re: Adding comments to the graph generated by BIRT. [message #854970 is a reply to message #854678] Tue, 24 April 2012 12:00 Go to previous messageGo to next message
Debarshi Dasgupta is currently offline Debarshi DasguptaFriend
Messages: 25
Registered: April 2012
Junior Member
I tried to implement the same by using interactivity.

package dao;
public class GetComment {
	public GetComment()
	{
		System.out.println("Inside getToolTipComment ");
	}
	public String getToolTipComment()
	{
		System.out.println("Inside getToolTipComment ");
		return "comments";
	}
}


And in the layout design for the X axis created an Interactivity
Event : Mouse Click
Action : Show Tooltip
Cursor : Auto
In the tool tip text mentioned below mentioned code :

<%@ page import="dao.*" %>
<% GetComment demo = new GetComment(); %>
alert(<%demo.GetComment();%>);


The alert message is displayed but the message is empty. Actually I wanted to fetch details from database.

Re: Adding comments to the graph generated by BIRT. [message #855161 is a reply to message #854678] Tue, 24 April 2012 15:09 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

I really do not have an example of this. But take a look at this post
to get an idea of how to call some client side script from a chart.
http://birtworld.blogspot.com/2010/05/more-on-chart-interactivity.html
Maybe you could call a servlet from the client side script to add some
comments to a db. What do you need on tooltips?

Jason

On 4/24/2012 2:38 AM, Debarshi Dasgupta wrote:
> Hi Jason,
>
> Thanks for the reply.
>
> My requirement is allow users to add comments on the chart generated and
> retain the comments in a database so that they can be displayed on load
> next time some one views the same report.
>
> It is fine with me if comments are not displayed in the pdf reports.
> Please suggest me a feasible solution for the same. Please share some
> links where you have posted about tooltip.
Re: Adding comments to the graph generated by BIRT. [message #870724 is a reply to message #855161] Wed, 09 May 2012 13:12 Go to previous messageGo to next message
Debarshi Dasgupta is currently offline Debarshi DasguptaFriend
Messages: 25
Registered: April 2012
Junior Member
Hi Jason,

Now I am trying to do the same using Labels. I want to display the label while rendering the chart and the label will come from a database.

Example is as follows

Customer Name Transactions Comments
A 10 Premium
B 20 Basic
C 30 Gold

Can you please suggest a way if I render a chart with the following parameter :

X Axis : Customer Name
Y Axis : Transactions
Label : Comments

My dataset query is like this :

select Customer_Name,Transactions,Comments from sample_table;


[Updated on: Wed, 09 May 2012 13:13]

Report message to a moderator

Re: Adding comments to the graph generated by BIRT. [message #870821 is a reply to message #870724] Wed, 09 May 2012 19:08 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

You should be able to do this with a hidden table and some script. Take
a look at the attached example.

Jason

On 5/9/2012 9:13 AM, Debarshi Dasgupta wrote:
> Hi Jason,
>
> Now I am trying to do the same using Labels. I want to display the label
> while rendering the chart and the label will come from a database.
>
> Example is as follows
>
> Customer Name Transactions Comments A 10 Premium B 20 Basic C 30 Gold
>
> Can you please suggest a way if I render a chart with the following
> parameter :
>
> X Axis : Customer Name
> Y Axis : Transactions Label : Comments
> My dataset query is like this :
> select Customer_Name,Transactions,Comments sample_table;
>
>
>
Re: Adding comments to the graph generated by BIRT. [message #870822 is a reply to message #870724] Wed, 09 May 2012 19:08 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

You should be able to do this with a hidden table and some script. Take
a look at the attached example.

Jason

On 5/9/2012 9:13 AM, Debarshi Dasgupta wrote:
> Hi Jason,
>
> Now I am trying to do the same using Labels. I want to display the label
> while rendering the chart and the label will come from a database.
>
> Example is as follows
>
> Customer Name Transactions Comments A 10 Premium B 20 Basic C 30 Gold
>
> Can you please suggest a way if I render a chart with the following
> parameter :
>
> X Axis : Customer Name
> Y Axis : Transactions Label : Comments
> My dataset query is like this :
> select Customer_Name,Transactions,Comments sample_table;
>
>
>
Re: Adding comments to the graph generated by BIRT. [message #870823 is a reply to message #870724] Wed, 09 May 2012 19:08 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

You should be able to do this with a hidden table and some script. Take
a look at the attached example.

Jason

On 5/9/2012 9:13 AM, Debarshi Dasgupta wrote:
> Hi Jason,
>
> Now I am trying to do the same using Labels. I want to display the label
> while rendering the chart and the label will come from a database.
>
> Example is as follows
>
> Customer Name Transactions Comments A 10 Premium B 20 Basic C 30 Gold
>
> Can you please suggest a way if I render a chart with the following
> parameter :
>
> X Axis : Customer Name
> Y Axis : Transactions Label : Comments
> My dataset query is like this :
> select Customer_Name,Transactions,Comments sample_table;
>
>
>
Re: Adding comments to the graph generated by BIRT. [message #870824 is a reply to message #870724] Wed, 09 May 2012 19:08 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

You should be able to do this with a hidden table and some script. Take
a look at the attached example.

Jason

On 5/9/2012 9:13 AM, Debarshi Dasgupta wrote:
> Hi Jason,
>
> Now I am trying to do the same using Labels. I want to display the label
> while rendering the chart and the label will come from a database.
>
> Example is as follows
>
> Customer Name Transactions Comments A 10 Premium B 20 Basic C 30 Gold
>
> Can you please suggest a way if I render a chart with the following
> parameter :
>
> X Axis : Customer Name
> Y Axis : Transactions Label : Comments
> My dataset query is like this :
> select Customer_Name,Transactions,Comments sample_table;
>
>
>
Re: Adding comments to the graph generated by BIRT. [message #870825 is a reply to message #870724] Wed, 09 May 2012 19:08 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

You should be able to do this with a hidden table and some script. Take
a look at the attached example.

Jason

On 5/9/2012 9:13 AM, Debarshi Dasgupta wrote:
> Hi Jason,
>
> Now I am trying to do the same using Labels. I want to display the label
> while rendering the chart and the label will come from a database.
>
> Example is as follows
>
> Customer Name Transactions Comments A 10 Premium B 20 Basic C 30 Gold
>
> Can you please suggest a way if I render a chart with the following
> parameter :
>
> X Axis : Customer Name
> Y Axis : Transactions Label : Comments
> My dataset query is like this :
> select Customer_Name,Transactions,Comments sample_table;
>
>
>
Re: Adding comments to the graph generated by BIRT. [message #870826 is a reply to message #870724] Wed, 09 May 2012 19:08 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

You should be able to do this with a hidden table and some script. Take
a look at the attached example.

Jason

On 5/9/2012 9:13 AM, Debarshi Dasgupta wrote:
> Hi Jason,
>
> Now I am trying to do the same using Labels. I want to display the label
> while rendering the chart and the label will come from a database.
>
> Example is as follows
>
> Customer Name Transactions Comments A 10 Premium B 20 Basic C 30 Gold
>
> Can you please suggest a way if I render a chart with the following
> parameter :
>
> X Axis : Customer Name
> Y Axis : Transactions Label : Comments
> My dataset query is like this :
> select Customer_Name,Transactions,Comments sample_table;
>
>
>
Re: Adding comments to the graph generated by BIRT. [message #870827 is a reply to message #870724] Wed, 09 May 2012 19:08 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

You should be able to do this with a hidden table and some script. Take
a look at the attached example.

Jason

On 5/9/2012 9:13 AM, Debarshi Dasgupta wrote:
> Hi Jason,
>
> Now I am trying to do the same using Labels. I want to display the label
> while rendering the chart and the label will come from a database.
>
> Example is as follows
>
> Customer Name Transactions Comments A 10 Premium B 20 Basic C 30 Gold
>
> Can you please suggest a way if I render a chart with the following
> parameter :
>
> X Axis : Customer Name
> Y Axis : Transactions Label : Comments
> My dataset query is like this :
> select Customer_Name,Transactions,Comments sample_table;
>
>
>
Re: Adding comments to the graph generated by BIRT. [message #870829 is a reply to message #870724] Wed, 09 May 2012 19:08 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

You should be able to do this with a hidden table and some script. Take
a look at the attached example.

Jason

On 5/9/2012 9:13 AM, Debarshi Dasgupta wrote:
> Hi Jason,
>
> Now I am trying to do the same using Labels. I want to display the label
> while rendering the chart and the label will come from a database.
>
> Example is as follows
>
> Customer Name Transactions Comments A 10 Premium B 20 Basic C 30 Gold
>
> Can you please suggest a way if I render a chart with the following
> parameter :
>
> X Axis : Customer Name
> Y Axis : Transactions Label : Comments
> My dataset query is like this :
> select Customer_Name,Transactions,Comments sample_table;
>
>
>
Re: Adding comments to the graph generated by BIRT. [message #870831 is a reply to message #870724] Wed, 09 May 2012 19:08 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

You should be able to do this with a hidden table and some script. Take
a look at the attached example.

Jason

On 5/9/2012 9:13 AM, Debarshi Dasgupta wrote:
> Hi Jason,
>
> Now I am trying to do the same using Labels. I want to display the label
> while rendering the chart and the label will come from a database.
>
> Example is as follows
>
> Customer Name Transactions Comments A 10 Premium B 20 Basic C 30 Gold
>
> Can you please suggest a way if I render a chart with the following
> parameter :
>
> X Axis : Customer Name
> Y Axis : Transactions Label : Comments
> My dataset query is like this :
> select Customer_Name,Transactions,Comments sample_table;
>
>
>
Re: Adding comments to the graph generated by BIRT. [message #870873 is a reply to message #870831] Thu, 10 May 2012 06:54 Go to previous messageGo to next message
Debarshi Dasgupta is currently offline Debarshi DasguptaFriend
Messages: 25
Registered: April 2012
Junior Member
Hi Jason,

Thank you for the attached example. I am trying to display the comments as label with a Line graph. As suggested I have added a table and checked the hide visibility option.

My query for the data set is as follows :

select month,A,B,C,D,COMMENT,SEQ
from PILOTTABLE
order by SEQ

I am not clear where to add the script mentioned. I am adding the screen shot of my current report and along with the rptdesign file.
Re: Adding comments to the graph generated by BIRT. [message #870880 is a reply to message #870873] Thu, 10 May 2012 07:14 Go to previous messageGo to next message
Debarshi Dasgupta is currently offline Debarshi DasguptaFriend
Messages: 25
Registered: April 2012
Junior Member
Hi Jason I tried adding the following tag as you have used in the shared example.

I have four series in my chart

X Axis : Month
Y Axis
Series 1. A
Series 2. B
Series 3. C (Using this series as Lower Limit)
Series 4. D (Using this series as Upper Limit)

There is another column selected "comments" which I want to display as Series Label for points of intersection between A,Month.

Example
Customer Name Transactions Comments
A 10 Premium
B 20 Basic
C 30 Gold

Point A,10 will show a series label as "Premium"
Point B,20 will show a series label as "Basic"

<property name="comments">

But it is not working for me. Probably I am unable to use the script in the proper fashion.

    <property name="comments">Copyright (c) 2007 &lt;&lt;Your Company Name here>>

Select Chart Type
		Chart Type: Line
		Subtype: Overlay

Select Data
		Category Series: row["MONTH"]
		Value Series-1: row["A"]
		Value Series-2: row["B"]
		Value Series-2: row["COMMENT"]

Format Chart
		Series->Series Palette->Remove first two colors
		Series->Value Series - 1: 
							Tick Show Labels
							Tick Use Palette as Line Color: False
							Series Line Color: Cream (249, 225, 191)
		                              Marks->Marks: Triangle
		Series->Value Series - 2: 
							Tick Show Labels
							Tick Use Palette as Line Color: False
							Series Line Color: Cream (249, 225, 191)
		                              Marks->Marks: Triangle
		Chart Area: Chart Title: Overlay Line Chart
		Chart Area->Axis->X-Axis: Gridlines->Ticks Style: Below
		                                Y-Axis: Gridlines->Ticks Style: Left
		                     Plot: Area Within Axes->Background: RGB(255, 255, 225)
                                 Legend: untick Visible</property>

[Updated on: Thu, 10 May 2012 07:34]

Report message to a moderator

Re: Adding comments to the graph generated by BIRT. [message #871075 is a reply to message #870880] Thu, 10 May 2012 17:28 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

In the example I posted the first script is on the table detail rows
oncreate event. It has this script:

var var1 = this.getRowData().getColumnValue("series2");
var var2 = this.getRowData().getColumnValue("category");
reportContext.setPersistentGlobalVariable(var2,var1);

All this does is store a persistent variable named by the category with
a value that I want to access later. In this case my category has to be
unique. The second script is on the chart .

function beforeDrawDataPointLabel( dph, label, icsc )
{

var mycat = dph.getBaseDisplayValue();
var current = label.getCaption().getValue();
var ser2val =
icsc.getExternalContext().getScriptable().getPersistentGlobalVariable(mycat);
label.getCaption().setValue(current + "--" + ser2val);
}

The getBaseDisplayValue gets my unique category name and then I use this
to look up the variable I stored earlier.

Jason

On 5/10/2012 3:14 AM, Debarshi Dasgupta wrote:
> Hi Jason I tried adding the following tag as you have used in the shared
> example
> <property name="comments">
>
> But it is not working for me. Probably I am unable to use the script in
> the proper fashion.
>
>
> <property name="comments">Copyright (c) 2007 <<Your Company Name here>>
>
> Select Chart Type
> Chart Type: Line
> Subtype: Overlay
>
> Select Data
> Category Series: row["MONTH"]
> Value Series-1: row["A"]
> Value Series-2: row["B"]
> Value Series-2: row["COMMENT"]
>
> Format Chart
> Series->Series Palette->Remove first two colors
> Series->Value Series - 1: Tick Show Labels
> Tick Use Palette as Line Color: False
> Series Line Color: Cream (249, 225, 191)
> Marks->Marks: Triangle
> Series->Value Series - 2: Tick Show Labels
> Tick Use Palette as Line Color: False
> Series Line Color: Cream (249, 225, 191)
> Marks->Marks: Triangle
> Chart Area: Chart Title: Overlay Line Chart
> Chart Area->Axis->X-Axis: Gridlines->Ticks Style: Below
> Y-Axis: Gridlines->Ticks Style: Left
> Plot: Area Within Axes->Background: RGB(255, 255, 225)
> Legend: untick Visible
> ==============================================================
>
> Stacked Line Chart
> Select Chart Type
> Chart Type: Line
> Subtype: Stacked
>
> Select Data
> Category Series: row["MONTH"]
> Value Series-1: row["A"]
> Value Series-2: row["B"]
> Value Series-2: row["COMMENT"]
>
> Format Chart
> Series->Series Palette->Remove first two colors
> Series->Value Series - 1: Tick Show Labels
> Tick Use Palette as Line Color: False
> Series Line Color: Cream (249, 225, 191)
> Marks->Marks: Triangle
> Series->Value Series - 2: Tick Show Labels
> Tick Use Palette as Line Color: False
> Series Line Color: Cream (249, 225, 191)
> Marks->Marks: Triangle
> Chart Area: Chart Title: Stacked Line Chart
> Chart Area->Axis->X-Axis: Gridlines->Ticks Style: Below
> Y-Axis: Gridlines->Ticks Style: Left
> Plot: Area Within Axes->Background: RGB(255, 255, 225)
> Legend: untick Visible
> ==============================================================
>
> Percent Stacked Line Chart
> Select Chart Type
> Chart Type: Line
> Subtype: Percent Stacked
>
> Select Data
> Category Series: row["MONTH"]
> Value Series-1: row["A"]
> Value Series-2: row["B"]
> Value Series-2: row["COMMENT"]
>
> Format Chart
> Series->Series Palette->Remove first two colors
> Series->Value Series - 1: Tick Show Labels
> Tick Use Palette as Line Color: False
> Series Line Color: Cream (249, 225, 191)
> Marks->Marks: Triangle
> Series->Value Series - 2: Tick Show Labels
> Tick Use Palette as Line Color: False
> Series Line Color: Cream (249, 225, 191)
> Marks->Marks: Triangle
> Chart Area: Chart Title: Percent Stacked Line Chart
> Chart Area->Axis->X-Axis: Gridlines->Ticks Style: Below
> Y-Axis: Gridlines->Ticks Style: Left
> Plot: Area Within Axes->Background: RGB(255, 255, 225)
> Legend->Ticks Visible: False
> ==============================================================
> 3D Line Chart
> Select Chart Type
> Chart Type: Line
> Dimension: 3D
>
> Select Data
> Category Series: row["MONTH"]
> Value Series-1: row["A"]
> Value Series-2: row["B"]
> Value Series-2: row["COMMENT"]
>
> Format Chart
> Series->Series Palette->Remove first color
> Series->Value Series - 1: Tick Show Labels
> Series Line Color: Cream (249, 225, 191)
> Marks->Marks: Triangle
> Series->Value Series - 2: Tick Show Labels
> Series Line Color: Cream (249, 225, 191)
> Marks->Marks: Triangle
> Chart Area: Chart Title: 3D Line Chart
> Chart Area->Axis->Rotation X Y Z( -10, 25, 0 )</property>
>
Re: Adding comments to the graph generated by BIRT. [message #871142 is a reply to message #871075] Fri, 11 May 2012 06:55 Go to previous messageGo to next message
Debarshi Dasgupta is currently offline Debarshi DasguptaFriend
Messages: 25
Registered: April 2012
Junior Member
Hi Jason,

Followed your steps and it worked for me.

Thank you !!
Re: Adding comments to the graph generated by BIRT. [message #871151 is a reply to message #871142] Fri, 11 May 2012 07:25 Go to previous messageGo to next message
Debarshi Dasgupta is currently offline Debarshi DasguptaFriend
Messages: 25
Registered: April 2012
Junior Member
Hi Jason,

One question here can we create multiple "PersistentGlobalVariable"?

Request you to please share a link where we can learn BIRT scripting.
Re: Adding comments to the graph generated by BIRT. [message #871254 is a reply to message #871151] Fri, 11 May 2012 16:15 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Absolutely. You can also using something like a hashmap as well. The
only caveat is that is must be serializable.

http://www.eclipse.org/birt/phoenix/deploy/reportScripting.php

Jason

On 5/11/2012 3:25 AM, Debarshi Dasgupta wrote:
> Hi Jason,
>
> One question here can we create multiple "PersistentGlobalVariable"?
>
> Request you to please share a link where we can learn BIRT scripting.
Previous Topic:Problem in previewing report in Birt designer 3.7 in Eclipse Indigo
Next Topic:Report max generation time
Goto Forum:
  


Current Time: Thu Mar 28 21:37:28 GMT 2024

Powered by FUDForum. Page generated in 0.04636 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top