how-to-get-a-x-axis-label-value-by-parameter-in-bar-chart [message #1058527] |
Tue, 14 May 2013 08:03  |
Eclipse User |
|
|
|
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 #1058874 is a reply to message #1058777] |
Wed, 15 May 2013 09:47   |
Eclipse User |
|
|
|
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 09:50] by Moderator
|
|
|
|
|
|
|
|
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 10:01   |
Eclipse User |
|
|
|
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
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04568 seconds