Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.



Read-Only Read-Only Topic
Go
Search
Notify
Tools
Dynamic Graphs
 Login/Join
 
Silver Member
posted
I've got a bunch of issues with trying to customize some aspects of my graphs. They all revolve around needing to dynamically change settings in my graph based on the data for the customer I'm reporting on.

Bar graph example -

One graph shows widgets per customer division. If a customer has 10 divisions, each with between 1 and 10 widgets and an 11th with 150, the graph will show the Y-axis max value of 150 with increments of 10. The first 10 divisions bars will be nearly flat on the X-axis. It's really not very visually helpful as all the small divisions look about the same. What I'd like to do in this situation is have the graph show a max value of 15 and increments of 1. The 11th value that's way out of range should be shown as hitting the top.

The same graph may also be used for a customer that has 2 divisions each with 1 widget. In this case the automatic layout shows the max value of 1 with increments of .2. There's no such thing as .2 of a widget so I'd like to show a max value of 5 and increments of 1. Also annoying is the bars will be very wide for both divisions (to cover the entire frame)

I've slogged through the API documentation and can set the values as constants but I really need to set the values based on the data for the specific customer being reported on. I think some of my attempts might have been close to working but not being very experienced with WF I've not been able to accomplish it. I'm running out of time and figured I better ask for help.

-EJL

Using WF 7.1
 
Posts: 41 | Registered: January 06, 2006Report This Post
Virtuoso
posted Hide Post
See if this gives you come ideas.

http://techsupport.informationbuilders.com/sps/20452037.html

If there aren't alot of different selections...you could also have static graphs with -GOTO Statements based on what the user chooses to each graph. Do some research on GOTO.


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Silver Member
posted Hide Post
Thanks. That example shows hardcoded values being used to change graph settings. That part I can do. The key sentence in that article said:

"The variables can also be set through other means."

That's the part that I can't seem to get to work. Somehow I need to be able to calculate settings for the graph based on the data. Once calculated I know how to use the APIs to make it do what I want.

I have a hunch it involves a COMPUTE statement or something like that in the data access part of the graph but I can't seem to get that figured out. My inexperience with WF is probably getting in the way.
 
Posts: 41 | Registered: January 06, 2006Report This Post
Master
posted Hide Post
Hi EJL,
I'm not sure whether you are looking for something like this,

-SET &ECHO='ALL';
-DEFAULT &GRTYPE=LINE
-DEFAULT &TYPESELINDEX=0;
-DEFAULT &FSSELINDEX=0;
-DEFAULT &FNSELINDEX=0;
-DEFAULT &DATVAL='false';
-DEFAULT &FNAME='Times New Roman';
-DEFAULT &FSIZE=14;
-DEFAULT &CTITLE=' ';


TABLE FILE CAR
PRINT DEALER_COST
CAR
BY COUNTRY
BY SALES
ON GRAPH HOLD AS GRAPHTEST
END

-HTMLFORM BEGIN
<HTML>
<HEAD>
<script LANGUAGE="JavaScript">
function getReport(val)
{

if(document.frm.DATVALUE.checked)
{
document.frm.DATVAL.value="true";
}
else
{
document.frm.DATVAL.value="false";
}
document.frm.TYPESELINDEX.value=document.frm.GRTYPE.selectedIndex;
document.frm.FSSELINDEX.value=document.frm.FSIZE.selectedIndex;
document.frm.FNSELINDEX.value=document.frm.FNAME.selectedIndex;
document.frm.submit();
}

function showSelected()
{
document.frm.GRTYPE.selectedIndex=&TYPESELINDEX;
document.frm.FNAME.selectedIndex=&FNSELINDEX;
document.frm.FSIZE.selectedIndex=&FSSELINDEX;
document.frm.DATVALUE.checked=&DATVAL
}

</SCRIPT>
</HEAD>
<form name="frm" action="http://YOURSERVERNAME/ibi_apps/WFServlet" method="POST">
<BODY onLoad="showSelected[)">
<table width="100" border="0" cellspacing="2" cellpadding="2">
<tr>
<td cellspacing="2" cellpadding="2" width="100" >Graph Type</td>
<td colspan="4" ></td>
<td cellspacing="2" cellpadding="2" width="100" >Font Name</td>
<td colspan="4" ></td>
<td cellspacing="2" cellpadding="2" width="100" >Font Size</td>
<td colspan="4" ></td>
<td cellspacing="2" cellpadding="2" width="100" >Data Value</td>
<td colspan="4" ></td>
<td cellspacing="2" cellpadding="2" width="100" >Chart Title</td>
<td colspan="4" ></td>
</tr>
<tr>
<td cellspacing="2" cellpadding="2" width="100" >
<SELECT name="GRTYPE" onChange="getReport[document.frm.GRTYPE.options[this.selectedIndex].value)">
<OPTION value="LINE">LINE</OPTION>
<OPTION value="PIE">PIE</OPTION>
<OPTION value="BAR">BAR</OPTION>
<OPTION value="VBAR">VBAR</OPTION>
<OPTION value="HBAR">HBAR</OPTION>
<OPTION value="SCATTER">SCATTER</OPTION>
<OPTION value="VAREA">AREA</OPTION>
<OPTION value="STOCK">STOCK</OPTION>
<OPTION value="POLAR">POLAR</OPTION>
<OPTION value="RADARA">RADAR</OPTION>
<OPTION value="BUBBLE">BUBBLE</OPTION>
<OPTION value="SPECTRAL">SPECTRAL</OPTION>
</SELECT>
</td><td colspan="4" ></td>
<td cellspacing="2" cellpadding="2" width="100" >
<SELECT name="FNAME" onChange="getReport[document.frm.FNAME.options[this.selectedIndex].value)">
<OPTION value="Times New Roman">Times New Roman</OPTION>
<OPTION value="Courier">Courier</OPTION>
<OPTION value="Arial">Arial</OPTION>
</SELECT>
</td>
<td colspan="4" ></td>
<td cellspacing="2" cellpadding="2" width="100" >
<SELECT name="FSIZE" onChange="getReport[document.frm.FSIZE.options[this.selectedIndex].value)">
<OPTION value="6">6</OPTION>
<OPTION value="8">8</OPTION>
<OPTION value="10">10</OPTION>
<OPTION value="12">12</OPTION>
<OPTION value="14">14</OPTION>
<OPTION value="16">16</OPTION>
<OPTION value="18">18</OPTION>
<OPTION value="20">20</OPTION>
<OPTION value="30">30</OPTION>
<OPTION value="40">40</OPTION>
</SELECT>
</td>
<td colspan="4" ></td>
<td cellspacing="2" cellpadding="2" width="100" ><input type="checkbox" name="DATVALUE" onClick="getReport[this.value)"></td>
<td colspan="4" ></td>
<td cellspacing="2" cellpadding="2" width="100" ><input type="text" name="CTITLE" ></td>
<td cellspacing="2" cellpadding="2" width="100" >
<input type="button" name="apply" value=".." onClick="getReport[document.frm.CTITLE.value)"></td>
</tr>
</table>
<INPUT TYPE="HIDDEN" NAME="IBIF_ex" VALUE="test">
<input type="hidden" name="TYPESELINDEX" value="0">
<input type="hidden" name="FSSELINDEX" value="0">
<input type="hidden" name="FNSELINDEX" value="0">
<input type="hidden" name="DATVAL" value="false">
</BODY>
</form>
</HTML>
-HTMLFORM END


SET LOOKGRAPH=&GRTYPE
SET GRAPHEDIT=SERVER
SET GRID=OFF

DEFINE FILE GRAPHTEST
SALES/D12CM MISSING ON=IF SALES NE 0 THEN SALES ELSE MISSING;
END

SET GRAPHEDIT=ON
SET GRMERGE=ON

GRAPH FILE GRAPHTEST
WRITE SALES AS 'Sales'
BY CAR
ACROSS COUNTRY
ON GRAPH SET VZERO OFF
ON GRAPH SET GRAPHSTYLE *
setDisplay (getDataText(), &DATVAL);
setTextString (getTitle(),"&CTITLE");

setFontName (getO1Label(), "&FNAME" );
setFontSize(getO1Label(),&FSIZE);
setFontSizeAbsolute(getO1Label(),true);

setFontName (getY1Label(), "&FNAME");
setFontSize(getY1Label(),&FSIZE);
setFontSizeAbsolute(getY1Label(),true);

setDataTextRadiusDefault(75);
setTextRotation(getDataText(),2);
setTextJustHoriz(getDataText(),0);
setFontName (getDataText(), "&FNAME");
setFontSize(getDataText(),12);
setFontSizeAbsolute(getDataText(),true);
setPlace(true);

setY1MajorGridStep(15.0);
setY1MajorGridStepAuto(false);

-*setFillMissingData(0);

-**used to display legend whereever you want.********
-*setRect(getLegendArea(),new Rectangle(-15500,-15500,31000,4000));
setTransparentBorderColor(getLegendArea(),false);
setTransparentFillColor(getLegendArea(),false);
setTextJustHoriz(getLegendText(),0);
setLegendMarkerPosition(2);
setFontSizeAbsolute(getLegendText(),true);
setFontSize(getLegendText(),9);
setLegendTextAutofit(true);
setLegendAutomatic(true);
-*********legend code ends here**************

ENDSTYLE

ON GRAPH SET STYLE *
ENDSTYLE
END

-EXIT

Hope this helps,


WFConsultant

WF 8105M on Win7/Tomcat
 
Posts: 780 | Location: Florida | Registered: January 09, 2005Report This Post
Silver Member
posted Hide Post
Thanks but that's not what I'm looking for. I need the graph to calculate the settings from the data, not to have someone manually choose the settings.

The automatic layout does something similiar to what I want but it approaches the problem from the wrong angle in my circumstance. It automatically stretches or shrinks the graphical representation to fit the specified area. I want to change the specified area to fit the graphical representation. I need control over some other settings but that's probably the easiest one to explain.

Example:
Let's say I have an iframe where I'm displaying the bar graph. It's 900 pixels wide. At the default setting 20 bars across the X-axis looks good. The problem is without some logic built into the graph, it's always going to be 900 pixels whether I have 1 bar or 20 to display. The graph looks odd with just one bar spread across 900 pixels. In this case I'd like to code the graph so that if the number of bars is < 5 the width of the graph is 300 pixels.

-EJL
 
Posts: 41 | Registered: January 06, 2006Report This Post
Silver Member
posted Hide Post
You can size your graph by setting HAXIS and VAXIS. eg:
However you would have read required data(like you many bars would appear in the chart) before you actully set to plot the chart
eg:

TABLE FILE CAR
PRINT COUNTRY
ON TABLE HOLD AS H_COUTRY
END
-RUN
-SET &N_BARS= &LINES;
-SET &HAXIS = IF &N_BARS LE 4 THEN 240 ELSE IF &N_BARS LE 10 THEN 360 ELSE 600;
-SET &VAXIS = 120;
GRAPH FILE CAR
SUM SALES
BY COUNTRY
ON GRAPH SET HAXIS &HAXIS.EVAL
ON GRAPH SET VAXIS &VAXIS.EVAL
ON GRAPH SET GRAPHSTYLE *
setGraphType(17);
ENDSTYLE
END
 
Posts: 38 | Location: India | Registered: May 18, 2005Report This Post
Silver Member
posted Hide Post
Thanks for the effort but figuring out how many bars will appear on the chart is exactly what I'm looking for help on. If you could show me a way to calculate this value within the report logic, you'd provide the answer to my problem.

I'm sorry if this hasn't been clearly stated.
 
Posts: 41 | Registered: January 06, 2006Report This Post
<JG>
posted
I suspect what you require is the API call setY1ScaleMax.

If you pre proccess your graph data and determine the maximum Y1 that you want.
This can be read in as a variable to set the setY1ScaleMax value.

If you are 5.3 look at page 599 of the graph documentaion. In 71 it's 620.

You may also want to look at Y1OffScaleDisplay.

This message has been edited. Last edited by: <JG>,
 
Report This Post
Silver Member
posted Hide Post
JG, the problem is I don't know how to pre-process the graph and make the values available to the API set later. That's been my question all along.

Can you point me to some sample code that would "pre process the graph and determine the maximum" and then show how I'd access that value in an API call?

I know the APIs, I know I can use a variable like "&max" in the call, but I just don't know how to get a value assigned to &max (other than hardcoding with a -SET or passing it in from an external source).
 
Posts: 41 | Registered: January 06, 2006Report This Post
Virtuoso
posted Hide Post
Derive the parameter values by analysing the data source, then record them in a sequential dataset, and use -READ to transfer them into &vars that you reference downstream in your GRAPH request.

It might look like this
DEFINE FILE datasource
PARM1/I8= ...;
PARM2/I8=...;

TABLE FILE datasource
WRITE MAX.PARM1 MIN.PARM2
AND HOLD AS ddname FORMAT ALPHA
END
-RUN
-READ ddname &Parm.A8 &Parm2.A8

Sometimes the values are COMPUTEd in TABLE, rather than declared in DEFINE; all depends on your heuristic for deriving them.

For testing, comment out the HOLD and stop the music (-EXIT) at the end of the TABLE to report the computed parameters.
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Silver Member
posted Hide Post
Thanks JG. That's really solid help.

I'm sure this stuff is obvious to experienced developers but for someone who is trying to figure out WF for the first time, it's not so easy.
 
Posts: 41 | Registered: January 06, 2006Report This Post
<JG>
posted
EJL thank the correct j.g. not the wrong JG for the final answer.

I just had not had time to reply before he gave you an example
of exactly what I would have posted. (I would have used the car file out of habit)

JG not j.g.
 
Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders