how-to-get-a-x-axis-label-value-by-parameter-in-bar-chart [message #1058527] |
Tue, 14 May 2013 12:03 |
4040 4040 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 |
|
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 |
4040 4040 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 #1059141 is a reply to message #1058527] |
Fri, 17 May 2013 00:39 |
|
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 #1059567 is a reply to message #1059409] |
Mon, 20 May 2013 14:01 |
4040 4040 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
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03614 seconds