Buisness graphics dynamic PIE chart event id

HI all,
I'm trying to create dynamic PIE chart :
Link to sdn document *
First I declared in the context node a table ( 0…n )
PIE – 0…N  with attributes :
Categorty – type string
Series – type i
Then I'm creating the business graphics :
DATA:lr_graph TYPE REF TO cl_wd_business_graphics,
lr_cat TYPE REF TO cl_wd_category,
lr_series TYPE REF TO cl_wd_simple_series,
lr_container TYPE REF TO cl_wd_uielement_container,
lr_flow TYPE REF TO cl_wd_flow_data.
lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
lr_graph = cl_wd_business_graphics=>new_business_graphics(
bind_series_source = 'NODE_DYN'
chart_type = cl_wd_business_graphics=>e_chart_type-pie
height = 340
width = 750
id = 'GRAPH' ).
lr_flow = cl_wd_flow_data=>new_flow_data( element = lr_graph ).
lr_container->add_child( lr_graph ) .
wd_this->value_cs ?= lr_graph.
wd_this->mr_view ?= view.
Now I'm creating the category and series :
wd_this->value_cs =? Lr_graph
wd_this->mr_view ?= view.
Series :
DATA: lr_bgr_ss TYPE REF TO cl_wd_simple_series.
lr_bgr_ss = cl_wd_simple_series=>new_simple_series(
bind_value = ‘NODE_DYN.SERIES’
label = ‘Series_1’
event_id = ‘Series_1’
id       = ‘Series_1’
view = wd_this->mr_view ).
Wd_this->value_cs->add_series( lr_bgr_ss ).
Category :
DATA: lr_bgr_cs TYPE REF TO cl_wd_category.
lr_bgr_cs = cl_wd_category=>new_category(
view = wd_this->mr_view
event_id = ‘Series_1’
id       = ‘Series_1’
bind_description = 'NODE_DYN.CATEGORY').
wd_this->value_cs->set_category( lr_bgr_cs ).
Now I'm binding the data :
Data : ls_pie type wd_this->element_pie.
Data : lt_pie type table of element_pie.
ls_pie-category = 'test_category1'.
ls_pie-series = '34'.
Append ls_pie to lt_pie.
ls_pie-category = 'test_category2'.
ls_pie-series = '73'.
Append ls_pie to lt_pie.
Data : lo_nd_pie type ref to if_Wd_context_node.
Data : lo_el_pie type ref to if_wd_context_element.
Lo_nd_pie = wd_context->get_child_node(
Name = wd_this-> wdctx_pie.
The above is the only way that I succeeded to create 2 categories for the pie chart but I cant isolate the event id for every category.
I tried also to create another series with the same id and other event id but still got the same problem.
Please suggest a solution for creating dynamic pie chart with event id for every category or series .
Regards,
Arie.

Hi Rama,
Thank you for your reply ,
I added the BIND_EVEND_ID = 'NODE_DYN.SERIES'  and it worked fine.
I'm trying now to get rid of the static context element.
I've declared the following :
DATA : NODE_INFO TYPE REF TO IF_WD_CONTEXT_NODE_INFO ,
              STRUCT_TYPE TYPE REF TO CL_ABAP_STRUCDESCR ,
              TABLE_TYPE REF TO CL_ABAPDESCR=>COMPONENT_TABLE,
             COMP LIKE LINE OF COMP_TAB.
COMP-NAME = 'CATEGORY'.
COMP_TYPE ?= CL_ABAP_DATADESCR=>DESCRIBE_BY_NAME( 'STRING' ).
APPEND COMP TO COMP_TAB.
COMP-NAME = 'SERIES'.
COMP_TYPE ?= CL_ABAP_DATADESCR=>DESCRIBE_BY_NAME( 'I' ).
APPEND COMP TO COMP_TAB.
STRUCT_TYPE = CL_ABAP_STRUCTDESCR=>CREATE( COMP_TAB ).
NODE_INFO = WD_CONTEXT->GET_NODE_INFO( ).
NODE_INFO = NODE_INFO->ADD_NEW_CHILD_NODE (
NAME = 'NODE_DYN'
IS_MANDTORY = ABAP_FALSE
IS_MULTIPLE = ABAP_TRUE
STATIC_ELEMENT_RTTI = STRUCT_TYPE
IS_STATIC = ABAP_FALSE) .
FIELD-SYMBOLS  <TABLE> TYPE TABLE.
FIELD-SYMBOLS  <WA> TYPE WA.
DATA : TABLE TYPE REF TO DATA.
DATA : WA TYPE REF TO DATA.
CREATE DATA TABLE LIKE TABLE OF STRUCT_TYPE.
ASSIGN TABLE->* TO TABLE.
TODO ?? - Add data to FS <TABLE>
*Binding :
DATA : DYN_NODE TYPE REF TO IF_WD_CONTEXT_NODE.
DYN_NODE = WD_CONTEXT->GET_CHILD_NODE( NAME = 'NODE_DYN').
DYN_NODE->BIND_TABLE( <TABLE> ).
How do I append data to FS <table> with the relevant components ?
Is there any  other efficient way to append the data and bind  ?
Regards,
Arie.

Similar Messages

  • How can we create dynamic pie chart in jsp

    hi im a new jsp programmer and i just want to know how can i create dynamic pie chart in jsp

    http://sourceforge.net/projects/jfreechart
    - Saish

  • Dynamic Pie Chart in Smart Form

    Hi Frn's ,
      How can i show the dynamic Pie chart in Smartform .
    Thanks and Regards
    Priyank Dixit

    Hi,
    Refer to this link [How to display pie chart in smart forms|Re: how to display pie chart in smart forms]

  • Dynamic pie chart

    Hi,
    I would to create a chart that looks like a pie chart, in the form of a clock.  I am struggling to come up with a good way to do this.
    The clock represents 24 hours.
    Each element (slice of the pie) within the chart represents a scheduled event, for example:
                7a-8a   Morning show
                8a-9a   Break
                9a-10a  Morning show
                10a-11a Break
                11a-12n  Morning show
                12n-1P  Break
                1p-2p    Afternoon show
                2p-3p    Break
                3p-4p    Afternoon show
                4p-5p    Break
                5p-6p    Afternoon show
                6p-7p    Break
                7p-8p    Evening show
                etc.... to fill 24 hours
    If there were 24 elements within the day, there would be 24 pie slices, regardless if there were duplicate elements.
    I would want to color code the same events within the day.
    All the Morning Show pieces of the pie would be one color, all the Afternoon Show pieces would be another
    Color;  all the Break events would be another color.
    To complicate matters, the number of slices will vary.  One client might have slices be as small as 30 seconds, another an hour.
    My plan was to build the chart dynamically..have each pie slice be uniquely named ("break7"), and its value be a % of the total.  Set the color based on a part of the name ("break"), setting the value for that color as >= to 0.  I have yet to figure out how to do tags for each pie slice.
    my questions are
    1) can I get into the chart from vs2008, cr2008 sp2, and vb.net and set these values?
    2) any thoughts/suggestions on a better way to create this chart?

    This will not be a trivial undertaking and to be honest, I am not sure if it is possible.
    1) The place to start is with the designer. Can you actually create such a report there? If not, you will not be able to do so at runtime either. If you need help creating such a chart, post your query to the [Crystal Reports Design|SAP Crystal Reports; forum. Also, once the chart is created in the designer, it will probably be much easier to modify it on the fly as opposed to creating it from scratch in code.
    2) You will not be able to use the CR SDK for .NET as the APIs that control the charts are limited. See KBase [1425910  - What are the limitations of modifying a chart in a Visual Studio .NET application?|http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_dev/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes.do] for more details.
    3) You will have to use the RAS InProc SDK for .NET. Links that will help you get started with RAS:
    Forum post [CR2008 - Set chart titles during run time|Re: CR2008 - Set chart titles during run time;
    Article [How to Use The RAS SDK .NET With In-Process RAS Server|http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/10b840c0-623f-2b10-03b5-9d1913866b32]
    [NET RAS SDK Samples|https://wiki.sdn.sap.com/wiki/display/BOBJ/NETRASSDK+Samples]
    [rassdk_net_dg_12_en.chm (developer help)|http://help.sap.com/businessobject/product_guides/boexir31/en/rassdk_net_dg_12_en.chm]
    Ludek
    Follow us on Twitter http://twitter.com/SAPCRNetSup

  • Dynamic Pie Charts

    Hi all,
    I have found (in the jdc) that it seems to be difficult to create a dynamic (data coming from db) Pie chart using JSP page. I did a beans that create basic Bar charts. Is there any way to do the same for a pie charts ? (without commercial solutions).
    I'll prefer a Beans instead of a applet, but at least this solutions can be take.
    Thanks a lot
    STF

    HiLearningSTF,
    Here I am giving you sample code below:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title>Pie Bean</title>
    </head>
    <body>
    <h2>Pie Chart Bean Example</h2>
    <%@ page import="com.sas.graphics.chart.*" %>
    <%@ include file="Sampledata.inc" %>
    &ltjsp:useBean id="pie" class="com.sas.servlet.beans.graphics.html.Pie"
    scope="session">
    </jsp:useBean>
    <%
    // Set the model
    pie.setModelInterface(dataModel);
    pie.setTitle("Product Sales");
    pie.setPieLabelType( com.sas.graphics.chart.PieLabelTypes.SECTOR_WEIGHT );
    DiscreteColorLegendStyle discreteLegendStyle = pie.getSectorLegendStyle();
    discreteLegendStyle.setColorScheme(com.sas.graphics.chart.ColorSchemeTypes.INDUSTRY );
    discreteLegendStyle.setVisible( false );
    PolarLegendStyle polarLegendStyle = pie.getWeightLegendStyle();
    polarLegendStyle.setStartAngle( 180.0D );
    // Output the Pie
    pie.setHeight(300);
    pie.setWidth(400);
    pie.setRequest(request);
    pie.write(out);
    %>
    </body>
    </html>
    I hope this will help you out.
    Regards,
    TirumalaRao.
    Developer TechnicalSupport,
    sunMicroSystem,India.

  • Regarding Business Graphics : Type Pie Chart

    Hello Experts,
    I am using the business graphics of type Pie Chart. I get the data properly displayed in the form a pie chart pir ture. But only thing missing here is, i dont get to see what percentage or the number of each part of pie.
    Example:
    I have a scenario where i want show the number or percentage on the parts of pie chart. It can be like a mouse over display or a plan static disply on each part of pie.
    Is this possible.. if yes .. kindly suggest.
    Thanks,
    Naresh

    Hi,
    Go through the following link.
    [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/ca932ebc-0901-0010-68a0-b4dd81a4bf81]
    It gives a step by step procedure for creating business graphics in WDA.
    Hope it helps.
    Thanks.

  • Dynamic Pie Chart: Counting the number of instances for each value

    Hello my name is Tim and I am at a roadblock concerning a chart for a dashboard design.
    I have a list with two fields:
    Platform and Status. The list is customized in InfoPath. The
    Platform field is located on the form as a drop-down menu with 6 entries.
    Status is a choice field with 3 selection that is updated through the lifespan of the project (once item created, it is updated to "In process", once the project is closed, the field is updated to "closed."
    My hurdle is viewing these dynamically in a Pie Chart. I am  trying to display the number of project's "In process" for each Platform. So, if Platform A has 6 projects "In process" and Platform B has 3 projects "In process"
    how can this be displayed in a pie chart?
    At the moment, I figured there are two options: Chart View WebPart or importing an Excel  worksheet.
    Any ideas or solution on how to accomplish this?
    -Tim Dempsey

    Three options:
    1. Create a list that holds your statuses. Then in your original list, create a lookup to the status list. In your status list, make a lookup to the lookup. This creates a circular reference which, for whatever reason, returns a count. You can then connect
    a chart web part to this. Repeat for the other column.
    2. Go to your sharepoint list and export to spreadsheet. Save the file. This is a query file that you can use as a data connection. From that file, set it to auto-update and then create a chart from a pivot table. Then use Excel Services Web Part to display
    the file.
    3. The other option is to use Google Charts API. Connect to the list, run some jQuery and JavaScript and then export out a chart. Pretty cool tool.
    Andy Wessendorf SharePoint Developer II | Rackspace [email protected]

  • Dynamic Pie charts in smartforms

    Hi All,
    I need to print a pie chart dynamically in smart forms.
    I have seen all the threads available on this.
    Can anyone guide me step by step process of doing this.

    Hi,
    Refer to GFW_PROG* programs.
    thanks,
    sama

  • Pie Chart changing data provider ?

    Iv created a pie chart to which the dataprovider is often going to change , the problem is how can i draw the pie chart when the datprovider changes as currently the chart is drawn when the dataprovider hasnt been set and thereforee nothing is displayed?
    Thanks Chris

    <fx:Script>
            <![CDATA[
                import mx.rpc.events.ResultEvent;
                import mx.collections.XMLListCollection;          
                import mx.events.ListEvent;
                import mx.controls.Alert;
                [Bindable]
                public var stats_list:XMLList;
                [Bindable]
                public var stats_list_collection:XMLListCollection;
                //Handler for stats list xml.           
                public function stats_result(event:ResultEvent):void
                    stats_list=event.result.stats
                    stats_list_collection=new XMLListCollection(stats_list);                                                             
            ]]>
        </fx:Script>
    <mx:PieChart id="piechart" dataProvider="{stats_list_collection}" showDataTips="true" color="#000000" name="Dynamic Pie Chart" right="0" left="0" top="40" bottom="10">
                <mx:series>
                    <mx:PieSeries explodeRadius=".1" labelPosition="callout" displayName="Series 1" field="value" nameField="type" fills="{[sc1, sc2, sc3, sc4]}"/>
                </mx:series>
    </mx:PieChart>
    Chris,
    I posted some information above that might be of some use to you.  Note that my PieChart dataProvider is: stats_list_collection 
    When the function "stats_result" is triggered it changes the data for the PieChart and I reset the value of stats_list_collection.  When that happens it changes the PieChart to contain the new values from your XMLListCollection.  Basically the way this application was setup is to have a dropdown that a user selects and option from and it populates the data in the PieChart depending on their selection.
    Another way of doing this (if you don't want to just update the dataProvider's content) is:
    <fx:Script>
             <![CDATA[
                  //pseudo code
              var dataprovider1:SOMETYPE = SOMETHING;
              var dataprovider2:SOMETYPE = SOMETHING;
              var dataprovider3:SOMETYPE = SOMETHING;
                public function WHATEVER YOU WANT THE TRIGGER TO BE(event:ResultEvent):void
                        switch(SOME CONDITION)
                             case "case 1":    piechart.dataProvider = dataprovider1;
                                                      break;
                             case "case 2":    piechart.dataProvider = dataprovider2;
                                                      break;
                             case "case 3":    piechart.dataProvider = dataprovider3;
                                                      break;
             ]]>
         </fx:Script>
    <mx:PieChart  id="piechart">
                <mx:series>
                     <mx:PieSeries explodeRadius=".1" labelPosition="callout"  displayName="Series 1" field="value" nameField="type" fills="{[sc1, sc2,  sc3, sc4]}"/>
                </mx:series>
    </mx:PieChart>
    Hope this helps.  The secondary option I posted was mostly pseduo code but the idea should give you a starting point.

  • Business Graphics:Create multiple Pie charts dynamically

    Hi Experts,
    I have a requirement to create 10 different pie chart in a view in a Grid layout.
    The charts will be created dynamically because the data will be known at runtime.
    Any type of help will be appreciated
    Regards.

    Hi,
    Here is a simple example:
    you must write this code in wdDoModfy() method, in if (firstTime){}
    in the layout there is already created one transperent container with id BG_CONTAINER
    //add a node
    IWDNodeInfo loDynNode = wdContext.getNodeInfo().addChild("DynNode", null, true, false, true, false, false, true, null, null, null);
    //add some attributes to it
              loDynNode.addAttribute("DynAttr1Str", "ddic:com.sap.dictionary.string");
              loDynNode.addAttribute("DynAttr2Int", "ddic:com.sap.dictionary.integer");
    //get the node
              IWDNode node = wdContext.getChildNode("DynNode", 0);
    //fill the node with some values
              for (int i = 0; i < 10; i ++){
                   IWDNodeElement element = node.createElement();
                   element.setAttributeValue("DynAttr1Str", "Str value " + i);
                   element.setAttributeValue("DynAttr2Int", new Integer(i));
                   // Add to the content
                   node.addElement(element);
    //get the attributes, we will use the attrinfo to bind them to the series
              IWDAttributeInfo loDynAttr1StrInfo = loDynNode.getAttribute("DynAttr1Str");
              IWDAttributeInfo loDynAttr2IntInfo = loDynNode.getAttribute("DynAttr2Int");
    //create the graphics
              IWDBusinessGraphics loGraphics = (IWDBusinessGraphics)view.createElement(IWDBusinessGraphics.class,"bg1");
    //set the type to pie
              loGraphics.setChartType(WDBusinessGraphicsType.PIE);
    //create a simple series and bind the integer attribute to it
              IWDSimpleSeries loSSeries = (IWDSimpleSeries)view.createElement(IWDSimpleSeries.class, "Series1");
              loSSeries.bindValue(loDynAttr2IntInfo);
    //create the  category and bind the string attribute to it
              IWDCategory loCategory = (IWDCategory)view.createElement(IWDCategory.class,"Category1");
              loCategory.bindDescription(loDynAttr1StrInfo);
    //add series and category
              loGraphics.addSeries(loSSeries);
              loGraphics.setCategory(loCategory);
    //I assume that there is a transperent container already created design time to put the graphics there
    //container with id BG_CONTAINER
              IWDTransparentContainer loContainer =  (IWDTransparentContainer)view.getElement("BG_CONTAINER");
    //add the graphics
              loContainer.addChild(loGraphics);
    If this is the type of graphics you need then you must simply do a for cycle and supply the graphics with the right node elements and you are ready.
    Best regards,
    Anton

  • Dynamically Labeling a pie chart (arc2d_pie)

    Can Somebody guide me how to Dynamically labling a pie chart inside or outside of it.Atpresent I am using rectangle color-code for labling at the top and left side of arch2d but its very confusing as the pie segments grows in number .I am submitting my source code for the pie chart for your reference.You are requested to please guide me with some concrete example as soon as possible .Thanks in advanceimport java.io.*;
    import java.util.*;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import java.awt.image.*;
    import java.util.Random;
    import java.sql.*;
    import java.math.BigDecimal;
    public class pie2d extends JPanel{
         Connection con;
         Statement stmt;
         Vector vc,conVector;
         int arraincrement,sum,pieMinusAngle,IntegerToInt;
         double sumAngle,allAngleSum;
         public void pie(Graphics g){
              try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String connection_string="jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};Dbq=D:\\bhanu\\bhanu.mdb;DriverID=22";
    con=DriverManager.getConnection(connection_string);
    stmt=con.createStatement();
    catch(Exception er){
         System.out.println("could not connect to database"+er);
    vc=new Vector();
    conVector=new Vector();
    try{
         ResultSet res=stmt.executeQuery("select contractor,count(contractor)as totalcon from daily group by contractor");
    System.out.println("Result set executed");
    while(res.next()){
         String tovector=res.getString("totalcon");
         String contractor=res.getString("contractor");
         conVector.add(contractor);
         int stringToInt=Integer.parseInt(tovector);
         vc.add(stringToInt);
    catch(Exception e){
         System.out.println("Result set error"+e);
              Graphics2D g2d=(Graphics2D)g;
              Random generator = new Random();
              g2d.setFont(new Font("Arial",Font.BOLD,15));
         int vectorsize=vc.size();
         for(int i=0;i<vectorsize;i++){
         Object getInt=vc.elementAt(i);
         Integer objToInt=(Integer)getInt;
         int IntegerToInt=objToInt.intValue();
    sum=sum+IntegerToInt;
         int pieAngle=360;
         for(int i=0;i<vectorsize;i++){
         System.out.println("sum is now :"+sum);     
         Object getInt=vc.elementAt(i);
         Integer objToInt=(Integer)getInt;
          IntegerToInt=objToInt.intValue();
         double DivideAngle=(double)((360/sum)*IntegerToInt);
         allAngleSum=allAngleSum+DivideAngle;
         if(allAngleSum<360){
         double sumCalculate=(360-allAngleSum)/vectorsize;
         for(int i=0;i<vectorsize;i++){
         System.out.println("sum is now :"+sum);     
         Object getInt=vc.elementAt(i);
         Integer objToInt=(Integer)getInt;
          IntegerToInt=objToInt.intValue();
         double DivideAngle=(double)((360/sum)*IntegerToInt)+sumCalculate;
         Object contractorObj=conVector.elementAt(i);
         String contractor=(String)contractorObj;
         int Rnewcolor=generator.nextInt(255);
         int Gnewcolor=generator.nextInt(255);
         int Bnewcolor=generator.nextInt(255);     
         g2d.setPaint(new Color(Rnewcolor,Gnewcolor,Bnewcolor));
         g2d.fill(new Arc2D.Double( 240, 200, 400, 400, sumAngle,DivideAngle, Arc2D.PIE ) );
         sumAngle=sumAngle+DivideAngle;
         String intToString=Integer.toString(IntegerToInt);
         if(i<7){
         g2d.fill(new Rectangle2D.Double(i*70,50,30,30));
         g2d.drawString(intToString,i*73,100);
         g2d.drawString(contractor,i*73,120);//top horizontal
         else{
              g2d.fill(new Rectangle2D.Double(20,i*40,30,30));
         g2d.drawString(intToString,55,i*42);
              g2d.drawString(contractor,75,i*42);
         if(allAngleSum>360){
         double sumCalculate=(allAngleSum-360)/vectorsize;
         for(int i=0;i<vectorsize;i++){
         Object getInt=vc.elementAt(i);
         Integer objToInt=(Integer)getInt;
          IntegerToInt=objToInt.intValue();
         double DivideAngle=(double)((360/sum)*IntegerToInt)-sumCalculate;
         Object contractorObj=conVector.elementAt(i);
         String contractor=(String)contractorObj;
         int Rnewcolor=generator.nextInt(255);
         int Gnewcolor=generator.nextInt(255);
         int Bnewcolor=generator.nextInt(255);     
         g2d.setPaint(new Color(Rnewcolor,Gnewcolor,Bnewcolor));
         g2d.fill(new Arc2D.Double( 240, 200, 400, 400, sumAngle,DivideAngle, Arc2D.PIE ) );
         sumAngle=sumAngle+DivideAngle;
         String intToString=Integer.toString(IntegerToInt);
         if(i<7){
         g2d.fill(new Rectangle2D.Double(i*70,50,30,30));
         g2d.drawString(intToString,i*73,100);
         g2d.drawString(contractor,i*73,120);//top horizontal
         else{
              g2d.fill(new Rectangle2D.Double(20,i*40,30,30));
         g2d.drawString(intToString,55,i*42);
              g2d.drawString(contractor,75,i*42);
         sum=0;
         sumAngle=0;
         allAngleSum=0;
         try{
              stmt.close();
              con.close();
         catch(Exception e){
              System.out.println("Could not close connections"+e);
         public void paintComponent(Graphics g){
              super.paintComponent(g);
              pie(g);
    }

    Can Somebody guide me how to Dynamically labling a pie chart inside or outside of it.Atpresent I am using rectangle color-code for labling at the top and left side of arch2d but its very confusing as the pie segments grows in number .I am submitting my source code for the pie chart for your reference.You are requested to please guide me with some concrete example as soon as possible .Thanks in advanceimport java.io.*;
    import java.util.*;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import java.awt.image.*;
    import java.util.Random;
    import java.sql.*;
    import java.math.BigDecimal;
    public class pie2d extends JPanel{
         Connection con;
         Statement stmt;
         Vector vc,conVector;
         int arraincrement,sum,pieMinusAngle,IntegerToInt;
         double sumAngle,allAngleSum;
         public void pie(Graphics g){
              try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String connection_string="jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};Dbq=D:\\bhanu\\bhanu.mdb;DriverID=22";
    con=DriverManager.getConnection(connection_string);
    stmt=con.createStatement();
    catch(Exception er){
         System.out.println("could not connect to database"+er);
    vc=new Vector();
    conVector=new Vector();
    try{
         ResultSet res=stmt.executeQuery("select contractor,count(contractor)as totalcon from daily group by contractor");
    System.out.println("Result set executed");
    while(res.next()){
         String tovector=res.getString("totalcon");
         String contractor=res.getString("contractor");
         conVector.add(contractor);
         int stringToInt=Integer.parseInt(tovector);
         vc.add(stringToInt);
    catch(Exception e){
         System.out.println("Result set error"+e);
              Graphics2D g2d=(Graphics2D)g;
              Random generator = new Random();
              g2d.setFont(new Font("Arial",Font.BOLD,15));
         int vectorsize=vc.size();
         for(int i=0;i<vectorsize;i++){
         Object getInt=vc.elementAt(i);
         Integer objToInt=(Integer)getInt;
         int IntegerToInt=objToInt.intValue();
    sum=sum+IntegerToInt;
         int pieAngle=360;
         for(int i=0;i<vectorsize;i++){
         System.out.println("sum is now :"+sum);     
         Object getInt=vc.elementAt(i);
         Integer objToInt=(Integer)getInt;
          IntegerToInt=objToInt.intValue();
         double DivideAngle=(double)((360/sum)*IntegerToInt);
         allAngleSum=allAngleSum+DivideAngle;
         if(allAngleSum<360){
         double sumCalculate=(360-allAngleSum)/vectorsize;
         for(int i=0;i<vectorsize;i++){
         System.out.println("sum is now :"+sum);     
         Object getInt=vc.elementAt(i);
         Integer objToInt=(Integer)getInt;
          IntegerToInt=objToInt.intValue();
         double DivideAngle=(double)((360/sum)*IntegerToInt)+sumCalculate;
         Object contractorObj=conVector.elementAt(i);
         String contractor=(String)contractorObj;
         int Rnewcolor=generator.nextInt(255);
         int Gnewcolor=generator.nextInt(255);
         int Bnewcolor=generator.nextInt(255);     
         g2d.setPaint(new Color(Rnewcolor,Gnewcolor,Bnewcolor));
         g2d.fill(new Arc2D.Double( 240, 200, 400, 400, sumAngle,DivideAngle, Arc2D.PIE ) );
         sumAngle=sumAngle+DivideAngle;
         String intToString=Integer.toString(IntegerToInt);
         if(i<7){
         g2d.fill(new Rectangle2D.Double(i*70,50,30,30));
         g2d.drawString(intToString,i*73,100);
         g2d.drawString(contractor,i*73,120);//top horizontal
         else{
              g2d.fill(new Rectangle2D.Double(20,i*40,30,30));
         g2d.drawString(intToString,55,i*42);
              g2d.drawString(contractor,75,i*42);
         if(allAngleSum>360){
         double sumCalculate=(allAngleSum-360)/vectorsize;
         for(int i=0;i<vectorsize;i++){
         Object getInt=vc.elementAt(i);
         Integer objToInt=(Integer)getInt;
          IntegerToInt=objToInt.intValue();
         double DivideAngle=(double)((360/sum)*IntegerToInt)-sumCalculate;
         Object contractorObj=conVector.elementAt(i);
         String contractor=(String)contractorObj;
         int Rnewcolor=generator.nextInt(255);
         int Gnewcolor=generator.nextInt(255);
         int Bnewcolor=generator.nextInt(255);     
         g2d.setPaint(new Color(Rnewcolor,Gnewcolor,Bnewcolor));
         g2d.fill(new Arc2D.Double( 240, 200, 400, 400, sumAngle,DivideAngle, Arc2D.PIE ) );
         sumAngle=sumAngle+DivideAngle;
         String intToString=Integer.toString(IntegerToInt);
         if(i<7){
         g2d.fill(new Rectangle2D.Double(i*70,50,30,30));
         g2d.drawString(intToString,i*73,100);
         g2d.drawString(contractor,i*73,120);//top horizontal
         else{
              g2d.fill(new Rectangle2D.Double(20,i*40,30,30));
         g2d.drawString(intToString,55,i*42);
              g2d.drawString(contractor,75,i*42);
         sum=0;
         sumAngle=0;
         allAngleSum=0;
         try{
              stmt.close();
              con.close();
         catch(Exception e){
              System.out.println("Could not close connections"+e);
         public void paintComponent(Graphics g){
              super.paintComponent(g);
              pie(g);
    }

  • Drill down in pie chart using Business Graphics?

    Hi,
    I have create a pie chart using business graphics UI element. is it possible to drill down when we click on a part of pie chart?
    Please let me know how can we achieve this. Thank you.
    Regards,
    Bharat.

    I got the solution. we can identify this by using the event id property.
    Regards,
    Bharat.

  • Pie Chart select event fires all items instead of selected

    Hi,
    I would like to fire an event from the select on a particular element in a pie chart.
    The Flash Debugger shows that the select is sending all items to the data service. I only want to send the selected item to the data service
    I am using SP8.
    Any suggestions.
    Thanks.
    Dick
    --- Debug Logger ---
    21:  [AAD4] schedulePlan(SELECT)
    20:  [AAD4] schedulePlan(FORM5_SELECT)
    19:  [AAD4] raiseEvent(FORM5, SELECT)
    18:  [AAD4] Number of rows in Response is: undefined
    17:  [AAD4] Threshold number of rows is:
    16:  [AAD4] receiveADC4()
    15:  [AAD4] schedulePlan(SELECT)
    14:  [AAD4] executeNext(shift plansQueue - length:0)
    13:  [AAD4] executeNext([STEP10])
    12:  [AAD4] Sent request: <Request type="executeFunction" function="getBorrowerByName_R" system="BorrowerFinal2" systemType="WebServicesFactory" manageConnection="N" encode="Y" commit="N" convert="N" dsmid="Administrator:com.myComp.myProduct.4.Digital_dashboard.par:1166609751870"><Input name="INPUT" shape="OBJ" appName="INPUT" ><Meta><field name="arg0" appName="arg0" type="string"/></Meta><Row arg0="Hirsch"/><Row arg0="Boston"/><Row arg0="New York"/><Row arg0="Macy's"/><Row arg0="Sears"/><Row arg0="Hedges"/></Input><Output name="Response" appName="OUTPUT___sp___Response" shape="OBJ" capacity="0"></Output><Output name="RETURN" shape="ROW" capacity="1"/></Request>
    11:  [AAD4] checkStep([STEP10])
    10:  [AAD4] [PLAN17] Invoke ADC4
    9:  [AAD4] executeNext([STEP3])
    8:  [AAD4] checkStep([STEP3])
    7:  [AAD4] [PLAN17] Map CHART2 -> ADC4.INPUT
    6:  [AAD4] executeNext([STEP11])
    5:  [AAD4] [PLAN17] Reset ADC4
    4:  [AAD4] executeNext([STEPundefined])
    3:  [AAD4] schedulePlan(CHART2_SELECT)
    2:  [AAD4] Engine fire infoset change event, notify to: GRID6
    1:  [AAD4] raiseEvent(CHART2, SELECT)

    Hi Marcel,
    I am surprised that you got this to work.  How did you configure your pie chart?
    >You have to assign an event to the data mapping between the chart and the data provider (write select for the event name).
    I did this (look at the Flash debuggerinfo  in the initial post) but this didn't help.  Can you post the Flash debugger info from your pie chart?
    Thanks.
    Dick

  • Overlay a graphic on a Pie Chart, & Rotate text in a Pie Chart

    Is it possible to overlay a graphic on a pie chart?
    I've tried manipulating the Wrap Inspector, but regardless, when I paste a graphic on topic it drops below the pie chart and deletes one segment of the pie.
    In a related pie chart question, is it possible to rotate the text to face into the central axis, think spokes in wheel (vs. the default horizontal). I can rotate the pie chart in about 3 dif. inspectors, but no luck here...and my texts is just a little too long to fit nicely in the default (and too hard to read if I reduce the font size).
    Thanks

    I assume you want to have a graphic that sits over the chart, and that you see the values underneath? Something like a shine, worn texture or logo?
    If you are wondering what happened to your particular 'missing slice' open the Graph inspector and select that section. Chances are you have changed the tiled image which was assigned to that particular piece of the pie chart.
    To overlay a graphic, draw a circle shape. In the graphics inspector assign an image fill to that shape. Choose tiled or scale to fit as required (a png. file with transparencies will show the underlying values, as will setting the opacity of the circle)
    Turn the wrap off for the circle (It sounds like your pie chart may be set to 'moves with text' instead of 'locked to page') And then place it overtop of the pie chart. Resize to fit. Since this is now 'locked to page' and above the pie chart, any movement of the pie chart means you will have to reorient your overlay. To avoid this, set the pie chart to Locked to Page as well.
    At this point you can set the wrap for the pie chart so the text moves around it if you like. Your overlay and the pie chart will remain in sync if they are both fixed to page.
    Regarding your text question, no. You can't set that. What you can do is use a numerical, letter or symbolic value and include a legend manually to indicate the true names of the portions using a text box.
    (I've seen someone with a pie chart whose segments were labeled with seven words, the last two of which were the only ones that changed. I suggested using the unchanging portion as the graph title and the changing portion as the individual slices. Not sure if that would apply to your project.)

  • Include a pie chart graphics in Smart Form

    hi ,
    my req. to include a pie chart graphics in Smart Form .
    my logic
    1) write a pie chat program using the data .
    2) convert into bmp and upload into se78
    3) include the pic in smart form .
    is there any other way
    can u please mention the class and method to include the picture directly .
    currently i have downloaded the pic in the local server using the
    CALL METHOD GP_INST->IF_GRAPHIC_PROXY~EXPORT
    EXPORTING
    FORMAT = 3
    WIDTH = 1000
    HEIGHT = 3000
    NAME = 'c:\s'
    IMPORTING
    CONTENT_TYPE = ct
    CONTENT_LENGTH = cl
    CONTENT = t
    RETVAL = RETVAL
    but the picture is not visible ( not in jpg format) . its not readble.
    am attaching the code .
    its urgent , please reply.
    cheers
    senthil

    Thanks problem resolved.

Maybe you are looking for