Getting Rid of Colour Patch on Top of Stacked Columns in Business Graphs

In case of three dimensional business graphs built in web dynpro java applications, if the data for top block in the stacked columns is zero, then it will be represented as a patch of colour. This is absolutely correct and it actually represent a block with 0% data. Still few of us might not like to see such patch of colours on the graphs. So we can get rid of this by means of some work around as explained below in this blog.

Let us consider the graph built for the below data,

`String [] caterories = {"2008","2009","2010","2011"};int [] series1 = {35, 45, 40, 35};int [] series2 = {10, 5, 10, 15};int [] series3 = {20, 30, 30, 20};int [] series4 = {5, 10, 0, 0};`

Below is the 3D graph built for the above mentioned data. As it is evient from the graph, series4 has no data for last two categories and hence it is represented as patch of colour in the last two columns.

We can get rid of this patch of colour by simply changing the type of attribute bound to the series point from Integer to String, and populate “null” into it if the series data is zero. This is possible only if the graph is built using Series and Point combination but not with SimpleSeries. Below is the 3D graph built for the same data, after changing the type of attribute from “Integer” to “String”.

Below is the node structure and code to build the graph as shown above. Va_Value is the context attribute bound to the value property of the NumericValue added under Series_Point of the BusinessGraphics UI

```Vn_Series (collection Cardinality: 0 to n, Selection Cardinality: 0 to 1) --Vn_Point (singleton = false, Collection Cardi': 0 to n, Selection Cardi': 0 to 1)     --Va_Value (String)``` IPrivateTestView.IVn_CategoriesElement elCategoriesElement = null;IPrivateTestView.IVn_SeriesElement elSeries1Element = null;IPrivateTestView.IVn_SeriesElement elSeries2Element = null;IPrivateTestView.IVn_SeriesElement elSeries3Element = null;IPrivateTestView.IVn_SeriesElement elSeries4Element = null;IPrivateTestView.IVn_PointElement elPointElement = null;      String [] caterories = {"2008","2009","2010","2011"};int [] manuf = {35, 45, 40, 35};int [] damaged = {10, 5, 10, 15};int [] sold = {20, 30, 30, 20};int [] unsold = {5, 10, 0, 0}; elSeries1Element = wdContext.createAndAddVn_SeriesElement();elSeries2Element = wdContext.createAndAddVn_SeriesElement();elSeries3Element = wdContext.createAndAddVn_SeriesElement();elSeries4Element = wdContext.createAndAddVn_SeriesElement();      for (int index = 0; index<4; index++) {    elCategoriesElement = wdContext.createAndAddVn_CategoriesElement();    elCategoriesElement.setVa_Category(caterories[index]);     elPointElement =            elSeries1Element.nodeVn_Point().createAndAddVn_PointElement();    if(manuf[index] == 0){          elPointElement.setVa_Value(null);    }    else{          elPointElement.setVa_Value(manuf[index]+"");    }      elPointElement =           elSeries2Element.nodeVn_Point().createAndAddVn_PointElement();    if(damaged[index] == 0){           elPointElement.setVa_Value(null);    }    else{           elPointElement.setVa_Value(damaged[index]+"");    }      elPointElement =             elSeries3Element.nodeVn_Point().createAndAddVn_PointElement();    if(sold[index] == 0){           elPointElement.setVa_Value(null);    }    else{           elPointElement.setVa_Value(sold[index]+"");    }       elPointElement =            elSeries4Element.nodeVn_Point().createAndAddVn_PointElement();    if(unsold[index] == 0){           elPointElement.setVa_Value(null);    }    else{           elPointElement.setVa_Value(unsold[index]+"");    }}
``````