on 02-20-2009 6:29 AM
Hi all,
I have a query in developing one app which contains Business graphics
1)By selecting the type of a graph from the front end the graph (fro e.g. dropdownbykey/index) the end user should be in a position to see the graph i.e. if he selects Column chart then it should display the graph result in Column chart format or if he selects pie chart the graph output should be pie chart format.
Please do the needful.
Regards,
Suman
Hi Sumankumar,
For achieving this you need to know the value of the dropdown at runtime. I am sure you must have binded the the dropdown with some attribute in the context,
You can get the value of that attribute from the context at the runtime using this code:
String val = wdContext.current<NODE_NAME>().get<ATTRIBUTE_NAME>();
Using this value you set the graph type. For eg:
if(val =="Pie_Chart"){
Display Pie chart;
}
else{
Display Column chart;
}
One advice: You should put each of the chart in separate containers. Doing this will help you hide and unhide the container (logically speaking the graphs), at runtime.
If you need any help on this regrad please let me know.
I hope this will definitely help you!
Thanks and Reagrds
Pravesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Suman,
See what can be done is.. you have visibility parameters defined for each type you have in dropdown. Then bind each visibility parameter to each chart type.
For example:
Visibility_PieChart --> Bind it to teh container of PieChart
Visibility_ColumnChart --> Bind it to teh container of ColumnChart
Visibility_BarGraph --> Bind it to teh container of BarGraph
When you select Something from dropdown and have the value then set the visibility accordingly.
for example if you select the pieChart from dropdown and its value is lets say 1.
then :
if(val == 1){
wdContext.current<NODE_NAME>NodeElement().setVisibility_PieChart(WDVisibility.VISIBLE);
wdContext.current<NODE_NAME>NodeElement().setColumnChart (WDVisibility.NONE);
wdContext.current<NODE_NAME>NodeElement().setBarGraph(WDVisibility.NONE);
}
else if(val ==2){
wdContext.currentRowRepeterNodeElement().setVisibility_PieChart(WDVisibility.NONE);
wdContext.currentRowRepeterNodeElement().setColumnChart(WDVisibility.VISIBLE);
wdContext.current<NODE_NAME>NodeElement().setBarGraph(WDVisibility.NONE);
}
else if (val ==3){
.. Similarly for bar graph!!!!
}
I hope this clarfies the issue. Please feel free to revert back in case of any doubt.
Thanks and Regards,
Pravesh
Thanks a ton ,
We will try the same and get back to you by EOD or tomorrow with it.
One more query how can we palce all the containers in the same location. So that the end user will not see any change in the location of the chart.
Regards,
Suman.
Edited by: sumankumar kurimilla on Feb 20, 2009 9:41 AM
Hi Suman,
Just place all the containers one below the other at design time.. And at runtime when you will write this code the rendering part will be automatically taken care by the webdynpro framework.
You need not have to worry about the flickering the UI part, as this is the advacntage of webdynpro that at runtime you get the flicker free screens.
Hope my solution helped you!! If problem is solved then kindly close the message as well/
Thanks and Regards,
Pravesh
Honestly I don't know why the chart type has not been made bindable. To overcome this, you could introduce a boolean context attribute "chartTypeChanged" and an attribute "selectedChartType" (DDIC type BusinessGraphicsType).
Use a DropDownByKey UI element and bind property "selectedKey" to "selectedChartType". Assign an action to the "onSelect" event. In the action handler, set "chartTypeChanged" to true.
In method wdDoModifyView() use code like
if ( wdContext.currentContextElement().getChartTypeChanged() )
{
wdContext.currentContextElement().setChartTypeChanged(false);
WDBusinessGraphicsType chartType = WDBusinessGraphicsType.valueOf(wdContext.currentContextElement().getSelectedChartType());
IWDBusinessGraphics gfx = (IWDBusinessGraphics) view.getElement("ID_of_gfx");
gfx.setChartType(chartType);
}
Armin
Dear Pravesh Verma/Armin,
I am using the below code to select the end user the graph type. But when i select the graph type both types of graphs are displaying.
I have created an enumeration type and i bind the same to the value attribute and i bound the same to the drop down by key.
But the dynamic action is not happening. Please do the needful.
String chart_type=wdContext.currentContextElement().getGraph_type();
if(chart_type=="column_chart")
{
wdContext.currentContextElement().setVisibility_Chart_Column(WDVisibility.VISIBLE);
wdContext.currentContextElement().setVisibility_Pie_Chart(WDVisibility.NONE);
}
else if(chart_type =="pie_chart")
{
wdContext.currentContextElement().setVisibility_Pie_Chart(WDVisibility.VISIBLE);
wdContext.currentContextElement().setVisibility_Chart_Column(WDVisibility.NONE);
}
Regards,
Suman
Hi SumanKumar,
Have you created the "Visibility_Chart_Column" and "Visibility_Pie_Chart" attributes and have bind them to respective containers of Chart?
See what you have to do is:
1) Create seperate containers for each chart type.
2) Bind the visible property of the container with respective visiblility attributes.
Then this logic will work fine.
If you require any further help please let me know.
Thanks and Regards,
Pravesh
Hi Pravesh,
I have done all the above mentioned things but still its not working. When i print the chart type its showing correclty. The problem may be with if condition please suggest. I have checked with individual containers by using visibility property its working. But when i check with the if condition its not working.
I have created a enumeration type and the same thing is bound to the DDBK.
Regards,
Suman
Hi Suman,
If you have done all this then I think there could be one possibility that the datatype of the attribute which you have created may not be correct.
Please check what is the datatype. Is it: com.sap.ide.webdynpro.uielementdefinitions.Visibility ?
For creating the visibility attributes you have to set the datatype as defined above. To set this as the datatype of attribute, please follow this:
On the visibility attribute which you have created, Right Click -> Properties -> In the properties Tab -> Click on Type -> There is button with (...) as text-> Click on that - > Select Simple Type -> Under the package (com.sap.ide.webdynpro.uielementdefinitions) -> Select Visibility (2nd last attribute type).
I guess this may be one issue. If this is also not solving the problem then try anotehr approach.
In the if loop directly set the visibility of container.
if(chart_type=="column_chart"){
IWDTransparentContainer tr_Chart_Column = (IWDTransparentContainer)view.getElement("Chart_Column");
IWDTransparentContainer tr_Pie_Chart = (IWDTransparentContainer)view.getElement("Pie_Chart");
tr_Chart_Column.setVisible(WDVisibility.VISIBLE);
tr_Pie_Chart.setVisible(WDVisibility.NONE);
}
I hiope this should fix the issue.
Thanks and Regards,
Pravesh
Hi Pravesh,
my view name sampleapplicationview with that reference i am unable to get the method getelement by intellisence.
(IWDTransparentContainer)view.getElement here at "view" i am getting an error if i paste the same if i give my application name it is not containing the method Getelement.
Where will i get getelement method and what it takes as an argument?.
Please suggest us.
Regards,
Suman
Edited by: sumankumar kurimilla on Feb 24, 2009 10:33 AM
hi
Did you check whether your Trascontainers are responding to the VISIBiLITY
you have written , comment the if conditions and check those ?
if above is working , then make sure that value you have mentioned is same as
in check the CASE-SENSITIVITY , if this is fine ,
change the if condition as
if(charttype.equals("piechart)
{
}
else if(chartype.equals("columanchart")
{
}
hope this should solve your problem ?
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.