Vous êtes sur la page 1sur 3

How to create cool charts in PeopleSoft

Visual tools like charts are great for your busy team members/managers to get a status of the current situation and trends. Our study have concluded that having a placing graph on an approval page is much more effective in cost awareness and control than having a separate report. Managers are too busy managing day to day activities to seek out information, better to have a one stop concept.

Following section describes how you can leverage the chart object provided in PeopleSoft to enhance your dull web pages with charts.

1. Create Work Record Create a work record and add a chart field

2. Page Chart object Create a page and insert the chart object InsertChart (Q)

3. Provide Component Menu Portal Security

4. Add Chart PeopleCode under rowinit peoplecode

/* Purpose: Sample Code to create a basic chart on PeopleSoft web page. Chart will be a basic bar chart which highlights Actual Data and an overlay line for budget Developer: Steve Chun*/

/* declare chart object */ Local Chart &oChart;

/* create chart object */ &oChart = GetChart(ICONSULTINGINC.CHART);

/* pass any variable, this assumes that you have a custom view IC_ACTUALS with fields: deptid, fiscal_year, amount_total & ic_month*/ &deptid = IC_ACTUALS.DEPTID; &year = IC_ACTUALS.FISCAL_YEAR;

/* create stand alone rowset and populate */ &oRowset = CreateRowset(Record.IC_ACTUALS); &oRowset.Fill(where deptid = :1 and fiscal_year = :2,&deptid, &year); /* populate chart object with data and set X and Y axis */ &oChart.SetData(&oRowset); &oChart.SetDataYAxis(IC_ACTUALS.AMOUNT_TOTAL); &oChart.SetDataXAxis(IC_ACTUALS.IC_MONTH); /* Chart properties */

&oChart.Type = %ChartType_2DStackedBar; &oChart.HasLegend = True; &oChart.LegendPosition = %ChartLegend_Right; &oChart.XAxisLabelOrient = %ChartText_Vertical;

/* X & Y labels */ &oChart.XAxisTitle = "Monthly Budget vs Commitment"; &oChart.YAxisTitle = "Pre-Encum";

/*Overlay chart data type*/ &oChart.OLType = %ChartType_2DLine; &oChart.OLLineType = %ChartLine_Dash;

/*Overlay rowset this assumes that you have a custom view IC_BUDGETS with fields: deptid, fiscal_year, amount_total & ic_month */ &oRowset1 = CreateRowset(Record.IC_BUDGETS); &oRowset1.Fill(where deptid = :1 and fiscal_year = :2,&deptid, &year);

/*Overlay Data set */ &oChart.SetOLData(&oRowset1); &oChart.SetOLDataYAxis(NMWF_BUDGETS.AMOUNT_TOTAL);

Vous aimerez peut-être aussi