Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » how-to-get-a-x-axis-label-value-by-parameter-in-bar-chart
how-to-get-a-x-axis-label-value-by-parameter-in-bar-chart [message #1058527] Tue, 14 May 2013 12:03 Go to next message
4040 4040 is currently offline 4040 4040Friend
Messages: 78
Registered: February 2013
Member
in this script we are getting baseAxes value according to parameter


function beforeGeneration(chart, icsc)

{
importPackage( Packages.org.eclipse.birt.chart.model.attribute.impl );
importPackage( Packages.org.eclipse.birt.chart.model.attribute );
xAxis = chart.getBaseAxes()[0];
if ( xAxis.getType() == AxisType.DATE_TIME_LITERAL){
var groupparm = icsc.getExternalContext().getScriptable().getParameterValue("pDateGrouping");
if( groupparm == "Days")
{
xAxis.setFormatSpecifier( JavaDateFormatSpecifierImpl.create("MM/dd/yyyy") );
}
else if( groupparm == "Years" )
{
xAxis.setFormatSpecifier( JavaDateFormatSpecifierImpl.create("yyyy") );
}
else if( groupparm == "Months" )
{
xAxis.setFormatSpecifier( JavaDateFormatSpecifierImpl.create("MM/yy") );
}
else if( groupparm == "Quarters" ){
xAxis.setFormatSpecifier( JavaDateFormatSpecifierImpl.create("'Q'Q/yy") );
}

}

}

my requirement


function beforeGeneration(chart, icsc)

{
importPackage( Packages.org.eclipse.birt.chart.model.attribute.impl );
importPackage( Packages.org.eclipse.birt.chart.model.attribute );
xAxis = chart.getBaseAxes()[0];

if ( xAxis.getType() == AxisType.TEXT_LITERAL){
var groupparm = icsc.getExternalContext().getScriptable().getParameterValue("geography");
if( groupparm == "zone")
{
xAxis.?( ?.create("?") );
}
else if( groupparm == "state" )
{
xAxis.?( ?.create("?") );
}
else if( groupparm == "city" )
{
xAxis.?( ?.create("?") );
}

}


like wise i have one table in that many columns are there zone,state,city,...its go on
so now my doubt is
for example:

if i click option "zone" in list box i have get value in bar chart south,west,east,north in x-axis and corresponding net sale in y axis....

if i click option "state" in list box i have get value in bar chart tamilnadu,kerala,chennai, in x-axis and corresponding net sale in y axis....



thanks in advance..............
Re: how-to-get-a-x-axis-label-value-by-parameter-in-bar-chart [message #1058777 is a reply to message #1058527] Wed, 15 May 2013 03:32 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

You could create a chart for each option and drop the unneeded ones. You could change your chart query based on the selection and make the column names generic so that you can use the same chart and same dataSet. If I'm misunderstanding, is there any way you could create a simple example design that I can run, so I can see exactly what you're trying to do?

Michael

Developer Evangelist, Silanis
Re: how-to-get-a-x-axis-label-value-by-parameter-in-bar-chart [message #1058874 is a reply to message #1058777] Wed, 15 May 2013 13:47 Go to previous messageGo to next message
4040 4040 is currently offline 4040 4040Friend
Messages: 78
Registered: February 2013
Member
here i attached is a model example ...
like wise

my requirement


function beforeGeneration(chart, icsc)

{
importPackage( Packages.org.eclipse.birt.chart.model.attribute.impl );
importPackage( Packages.org.eclipse.birt.chart.model.attribute );
xAxis = chart.getBaseAxes()[0];

if ( xAxis.getType() == AxisType.TEXT_LITERAL){
var groupparm = icsc.getExternalContext().getScriptable().getParameterValue("geography");
if( groupparm == "zone")
{
xAxis.?( ?.create("?") );
}
else if( groupparm == "state" )
{
xAxis.?( ?.create("?") );
}
else if( groupparm == "city" )
{
xAxis.?( ?.create("?") );
}

}


like wise i have one table in that many columns are there zone,state,city,...its go on
so now my doubt is
for example:

if i click option "zone" in list box i have get value in bar chart south,west,east,north in x-axis and corresponding net sale in y axis....

if i click option "state" in list box i have get value in bar chart tamilnadu,kerala,chennai, in x-axis and corresponding net sale in y axis....

can u create a sample report for this....

how to change chart query based on the selection and make the column names generic

its urgent requirement

[Updated on: Wed, 15 May 2013 13:50]

Report message to a moderator

Re: how-to-get-a-x-axis-label-value-by-parameter-in-bar-chart [message #1059076 is a reply to message #1058874] Thu, 16 May 2013 14:32 Go to previous messageGo to next message
4040 4040 is currently offline 4040 4040Friend
Messages: 78
Registered: February 2013
Member
kindly reply for my last topic


please help

thank in advance...
Re: how-to-get-a-x-axis-label-value-by-parameter-in-bar-chart [message #1059122 is a reply to message #1059076] Thu, 16 May 2013 20:29 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

What's your BIRT version?

EDIT: Nevermind. I didn't see the example attached above. Smile


Michael

Developer Evangelist, Silanis

[Updated on: Fri, 17 May 2013 00:24]

Report message to a moderator

Re: how-to-get-a-x-axis-label-value-by-parameter-in-bar-chart [message #1059141 is a reply to message #1058527] Fri, 17 May 2013 00:39 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

Take a look at the modified design attached. In the original query, I alias the fields, as you did in your original dataSet. I then use the parameter value to modify the query in the beforeOpen to change the field brought in under the xaxis alias.

The chart is set up to use the fields xaxis and yaxis, so it doesn't care what the query is. Hope this helps.



Michael

Developer Evangelist, Silanis
Re: how-to-get-a-x-axis-label-value-by-parameter-in-bar-chart [message #1059320 is a reply to message #1059141] Fri, 17 May 2013 13:58 Go to previous messageGo to next message
4040 4040 is currently offline 4040 4040Friend
Messages: 78
Registered: February 2013
Member
thank u.....i need exactly this is........

And again one doubut for me.....

i attached a sample report and and mine report
just compare and clarify a doubt ....

please...help me

thank in advance...



Re: how-to-get-a-x-axis-label-value-by-parameter-in-bar-chart [message #1059409 is a reply to message #1059320] Sat, 18 May 2013 04:45 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

Can you explain more about what you're wanting me to look at? Thanks.

Michael

Developer Evangelist, Silanis
Re: how-to-get-a-x-axis-label-value-by-parameter-in-bar-chart [message #1059567 is a reply to message #1059409] Mon, 20 May 2013 14:01 Go to previous messageGo to next message
4040 4040 is currently offline 4040 4040Friend
Messages: 78
Registered: February 2013
Member
hi thanks for reply....

my requirement is:
1)geography-------->listbox

2) country------------cascading parameter
zone
state
city
...etc


3)to drop table

like 1) bill
2)sale
3)etc....


my question is when i select in geography value and i have to drop a table

and then again i will select from cascading paramter and i will drop same table


i have run both by separate it run ......good


when i combine in same report it cant be run....so it possible to exceute in same report


i have used a to drop a table in before factory


a = reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("apc");
b = reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("aspb");
c = reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("bill");
d = reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("aspd");
e=reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("sale");
f=reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("walkin");

if (params["Table"].value == "APC")
{

b.drop();
c.drop();
d.drop();
e.drop();
f.drop();
}
if (params["Table"].value == "ASPB")
{
a.drop();
c.drop();
d.drop();
e.drop();
f.drop();
}
if (params["Table"].value == "BILL")
{
a.drop();
b.drop();
d.drop();
e.drop();
f.drop();
}
if (params["Table"].value == "ASPD")
{
a.drop();
b.drop();
c.drop();
e.drop();
f.drop();
}
if (params["Table"].value == "SALE")
{
a.drop();
b.drop();
c.drop();
d.drop();
f.drop();
}
if (params["Table"].value == "WALKIN")
{
a.drop();
b.drop();
c.drop();
d.drop();
e.drop();
}


for Geography: i have pass parameter by this
<method name="beforeOpen"><![CDATA[


if(params["Geography"].value =="STATE_NAME")
{
this.queryText = this.queryText.replace("ZONE_NAME","STATE_NAME");
}
else if(params["Geography"].value =="CITY_NAME")
{
this.queryText = this.queryText.replace("ZONE_NAME","CITY_NAME");
}
else if(params["Geography"].value =="AREA_MANAGER")
{
this.queryText = this.queryText.replace("ZONE_NAME","AREA_MANAGER");
}
else if(params["Geography"].value =="outlet_name")
{
this.queryText = this.queryText.replace("ZONE_NAME","outlet_name");
}


]]></method>


for country,city,state i have pass parameter by this:

<method name="beforeOpen"><![CDATA[var Varcoun;
var Varzone;
var Varstate;
var Varcity;
var Vararea;
var Varoutlet;
var txtcoun;
var txtzone;
var txtstate;
var txtcity;
var txtarea;
var txtoutlet;

if(params["country"]==' All country')
{
Varcoun= '%'
txtcoun= ' LIKE ';
}
else
{
Varcoun = params["country"]
txtcoun = ' = ';
}
if(params["zone"]==' All zone')
{
Varzone= '%'
txtzone= ' LIKE ';
}
else
{
Varzone = params["zone"]
txtzone = ' = ';
}
if(params["state"]==' All state')
{
Varstate = '%'
txtstate = ' LIKE ';
}
else
{
Varstate = params["state"]
txtstate = ' = ';
}
if(params["city"]==' All city')
{
Varcity = '%'
txtcity = ' LIKE '
}
else
{
Varcity = params["city"]
txtcity = ' = ';
}
if(params["Area Manager"]==' All manager')
{
Vararea = '%'
txtarea = ' LIKE ';
}
else
{
Vararea = params["Area Manager"]
txtarea = ' = ';
}

if(params["outlet"]==' All outlet')
{
Varoutlet = '%'
txtoutlet = ' LIKE ';
}
else
{
Varoutlet = params["outlet"]
txtoutlet = ' = ';
}


this.queryText = this.queryText.replace
("/**a**/",
" AND COUNTRY_NAME"+ txtcoun + "'"+ Varcoun +
"'AND ZONE_NAME"+ txtzone + "'"+ Varzone +
"'AND STATE_NAME"+ txtstate+ "'"+ Varstate +
"'AND CITY_NAME"+ txtcity+ "'"+ Varcity +
"'AND AREA_MANAGER"+ txtarea + "'"+ Vararea +
"'AND OUTLET_NAME"+ txtoutlet+ "'"+ Varoutlet +"'"+
"GROUP BY TRAN_DATE,COUNTRY_NAME,zone_name,STATE_NAME,CITY_NAME,AREA_MANAGER,OUTLET_NAME,CAFE_TYPE_ID"
);

kindly help me...

thank in advance





Re: how-to-get-a-x-axis-label-value-by-parameter-in-bar-chart [message #1059640 is a reply to message #1059567] Tue, 21 May 2013 05:16 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

Can you attach your design? Better yet, can you create a sample showing the issue with the sample database? This way I can see your setup and run the report.

Michael

Developer Evangelist, Silanis
Re: how-to-get-a-x-axis-label-value-by-parameter-in-bar-chart [message #1059950 is a reply to message #1059640] Wed, 22 May 2013 10:27 Go to previous message
4040 4040 is currently offline 4040 4040Friend
Messages: 78
Registered: February 2013
Member
No Message Body

[Updated on: Wed, 22 May 2013 10:30]

Report message to a moderator

Previous Topic:Multi level Pie Chart
Next Topic:Postscript Level BIRT 2.2RC2
Goto Forum:
  


Current Time: Fri Apr 19 18:23:18 GMT 2024

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

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

Back to the top