cancel
Showing results for 
Search instead for 
Did you mean: 

how to change the Charttype and dimension on runtime (Business Graphics)

Former Member
0 Kudos

Hi,

how can i change the chartType and dimension of a Business Graphics UI during running the application.

Sebastian

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Write this code in "wdDoModify" method...it should work !!!

Regards, Anilkumar

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi,

I think somewhere you are missing the "ContextMapping" and what is the cardinality of the Node ??

If the cardinality is 0..n then you need to add the element to the node again.

Ex:wdContext.Node<<NodeName>>.addElement(<ElementName>);

Regards, Anilkumar

Former Member
0 Kudos
public void onPlugBgIN(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
WDBusinessGraphicsType type  = wdThis.wdGetSimpleGraphicsController().wdGetContext().currentBgContextElement().getBgType();

wdContext.currentBgContextElement().setBgType(type);

I want to set the Value in the onPlugBgIN Method. The user should select his own type and dimension. So i have 2 Views. One to select the type and dimension and one to show the Business Graphic UI.

This code doesn´t work either.

WDBusinessGraphicsType type = null;
wdContext.currentBgContextElement().setBgType(type.LINES);

Former Member
0 Kudos

These properties "dimension" and "chartType" in the BusinessGraphics element are not bindable to the context.

To change such a non-bindable property from an event handler or plug-method, you can store the new value in this method and later set it to the UI element in method wdDoModifyView().

For storing the value you can use a context attribute of the view controller (as shown below).

void onPlugXYZ()
{
  wdContext.currentContextElement()
    .setChartType(WDBusinessGraphicsType.BARS);
}

static void wdDoModifyView(...)
{
  IWDBusinessGraphics gfx = (IWDBusinessGraphics)
    view.getElement("graphicsID");
  gfx.setChartType(
    wdContext.currentContextElement().getChartType()
  );
}

Armin

Former Member
0 Kudos

Hi

Where are you setting the value ??

I mean categoryElement.setBgType(<<Value>>);

Regards, Anilkumar

Former Member
0 Kudos

okay now i can change the chartType frm the wdDoModifyView method. But i am not able to change this Value from a Context Variable.

IPrivateSimpleGraphicsView.IBgContextElement categoryElement;
categoryElement = wdContext.createBgContextElement();
WDBusinessGraphicsType type = null;
type = categoryElement.getBgType();

IWDBusinessGraphics myBG = (IWDBusinessGraphics) view.getElement("BusinessGraphic");

myBG.setChartType(type);

But always the standart Bars chartType is choosen. where my misstake?

Former Member
0 Kudos

How do i get de Business Graphic. It doesn´t work correctly:

IWDBusinessGraphics myBG = (IWDBusinessGraphics) view.getElement("");

view.getElement doesn´t work. I replaced already view against my view Name. But the Method getElement doesn´t exists.

Former Member
0 Kudos

Hi Sebastian,

Try this code


IWDBusinessGraphics myBG = (IWDBusinessGraphics)view.getElement("<Business Graphics id>");
    WDBusinessGraphicsType chartType = null;
    WDBusinessGraphicsDimension dimension = null;
    myBG.setChartType(chartType.SPEEDOMETER);
    myBG.setDimension(dimension.THREE);

Regards,

Jaydeep