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.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Bar Graph Data Labels

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Bar Graph Data Labels
 Login/Join
 
Gold member
posted
Hi,

I have bar graph in which the numbers are displayed at the top of each bar i.e in the data labels . Is it possible, if I can get the percentage also beside the numbers eg: 6478 55% 31341 70%?

DEFINE FILE CAR
SORT /I1 = DECODE COUNTRY ('JAPAN' 1 'ENGLAND' 2 ELSE 3);
MEAS_LAT /P10C = IF BODYTYPE EQ 'SEDAN' THEN RETAIL_COST ELSE 0;
MEAS_OUT /P10C = IF BODYTYPE NE 'SEDAN' THEN RETAIL_COST ELSE 0;
END

ENGINE INT CACHE SET ON
-DEFAULTH &WF_STYLE_UNITS='PIXELS';
-DEFAULTH &WF_STYLE_HEIGHT='405.0';
-DEFAULTH &WF_STYLE_WIDTH='770.0';
-DEFAULTH &WF_TITLE='WebFOCUS Report';
GRAPH FILE CAR
SUM MEAS_LAT AS 'LATEST'
MEAS_OUT AS 'OUTDATED'
BY SORT NOPRINT
BY COUNTRY AS ''

ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET UNITS &WF_STYLE_UNITS
ON GRAPH SET HAXIS &WF_STYLE_WIDTH
ON GRAPH SET VAXIS &WF_STYLE_HEIGHT
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 2
ON GRAPH SET LOOKGRAPH VBAR
ON GRAPH SET AUTOFIT ON
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setCurveFitEquationDisplay(false);
setPlace(true);
*END
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/ENIADefault_combine.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
setDisplay(getDataText(0), true);
setDataTextDisplay(true);
*END
ENDSTYLE
END
-RUN

This message has been edited. Last edited by: Tamra,


WebFOCUS 8.2.02
Windows, All Outputs
 
Posts: 95 | Registered: May 16, 2016Report This Post
Guru
posted Hide Post
Here is the link to the WebFOCUS Charting - for now.

Possibly, Defining Custom Tooltips With a Callback Function
Page 124 in the manual

You will need to logon to the IBI Techsupport site to view the link.


Thank you for participating in the Focal Point Forum!
Tamra Colangelo
Focal Point Moderator
Information Builders

This message has been edited. Last edited by: Tamra,


WebFOCUS 8x - BI Portal, Developer Studio, App Studio, Excel, PDF, Active Formats and HTML5
 
Posts: 487 | Location: Toronto | Registered: June 23, 2009Report This Post
Guru
posted Hide Post
Here is a bit more information:

With a field that already containing the value needed in the data label, it makes things a bit easier. However, GRAPH_JS can’t see NOPRINT fields. What you may want to do is to have the field visible in the chart, then go into the GRAPH_JS section of the code and set its visibility using a series call. That way the code would still treat it as a series for purposes of the callback function.

Thank you for participating in the Focal Point Forum!
Tamra Colangelo
Focal Point Moderator
Information Builders


WebFOCUS 8x - BI Portal, Developer Studio, App Studio, Excel, PDF, Active Formats and HTML5
 
Posts: 487 | Location: Toronto | Registered: June 23, 2009Report This Post
Guru
posted Hide Post
The Charting Product Manager replied with the following example:

DEFINE FILE CAR
SORT /I1 = DECODE COUNTRY ('JAPAN' 1 'ENGLAND' 2 ELSE 3);
MEAS_LAT /P10C = IF BODYTYPE EQ 'SEDAN' THEN RETAIL_COST ELSE 0;
MEAS_OUT /P10C = IF BODYTYPE NE 'SEDAN' THEN RETAIL_COST ELSE 0;
END

ENGINE INT CACHE SET ON
-DEFAULTH &WF_STYLE_UNITS='PIXELS';
-DEFAULTH &WF_STYLE_HEIGHT='405.0';
-DEFAULTH &WF_STYLE_WIDTH='770.0';
-DEFAULTH &WF_TITLE='WebFOCUS Report';
GRAPH FILE CAR
SUM MEAS_LAT AS 'LATEST'
MEAS_OUT AS 'OUTDATED'
BY SORT NOPRINT
BY COUNTRY AS ''

ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET UNITS &WF_STYLE_UNITS
ON GRAPH SET HAXIS &WF_STYLE_WIDTH
ON GRAPH SET VAXIS &WF_STYLE_HEIGHT
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 2
ON GRAPH SET LOOKGRAPH VBAR
ON GRAPH SET AUTOFIT ON
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setCurveFitEquationDisplay(false);
setPlace(true);
*END
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/ENIADefault_combine.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
setDisplay(getDataText(0), true);
setDataTextDisplay(true);
*END
*GRAPH_JS
dataLabels: {
formatCallback: function(d, s, g) {
var sum = d.value / pv.sum(this.data.map(function(el){return el[g];}), function(el){return el.value;});
return this.formatNumber(d.value, '$#') + ' ' + this.formatNumber(sum, '#%');
}
},

*END
ENDSTYLE
END
-RUN




Thank you for participating in the Focal Point Forum!
Tamra Colangelo
Focal Point Moderator
Information Builders


WebFOCUS 8x - BI Portal, Developer Studio, App Studio, Excel, PDF, Active Formats and HTML5
 
Posts: 487 | Location: Toronto | Registered: June 23, 2009Report This Post
Gold member
posted Hide Post
Thank you so much Tamra. Is it also possible if I can get the total % value for all the bars in the data label E.g. instead of having 100% 0%, I can get 20% 10% 35% 15% 10%...

Thank you,
Mehak


WebFOCUS 8.2.02
Windows, All Outputs
 
Posts: 95 | Registered: May 16, 2016Report This Post
Gold member
posted Hide Post
Also, is it possible if you can explain what all variable mean in the code?


WebFOCUS 8.2.02
Windows, All Outputs
 
Posts: 95 | Registered: May 16, 2016Report This Post
Gold member
posted Hide Post
Tamra,

Also, is it possible to get the % sum of blue one and % sum of yellow one in data labels?

Thank you so much,
MM


WebFOCUS 8.2.02
Windows, All Outputs
 
Posts: 95 | Registered: May 16, 2016Report This Post
Guru
posted Hide Post
The best way to answer to your questions is to try to figure out the calculations and run a report to see your results. You may require a HOLD file to sum and sort the data then use COMPUTE to perform your required calculations. Then run a graph off the HOLD file.

In the previous post there is the link to the Chart manual and the page for the function being used.

Let us know your results.

Thank you for participating in the Focal Point Forum!
Tamra Colangelo
Focal Point Moderator
Information Builders


WebFOCUS 8x - BI Portal, Developer Studio, App Studio, Excel, PDF, Active Formats and HTML5
 
Posts: 487 | Location: Toronto | Registered: June 23, 2009Report This Post
Gold member
posted Hide Post
Per the example above, the percentage is only looking at the country grouping. We are looking to see the percentage for both the latest and outdated series. ie for japan the latest percentage would be 6,478 / 114,286 (the sum of all the blue bars 6,478 + 31,341 + 5,610 + 5,925 + 64,732) not 6,478 / 6,478

Thanks you
Mehak

quote:
Originally posted by Tamra:
The Charting Product Manager replied with the following example:

DEFINE FILE CAR
SORT /I1 = DECODE COUNTRY ('JAPAN' 1 'ENGLAND' 2 ELSE 3);
MEAS_LAT /P10C = IF BODYTYPE EQ 'SEDAN' THEN RETAIL_COST ELSE 0;
MEAS_OUT /P10C = IF BODYTYPE NE 'SEDAN' THEN RETAIL_COST ELSE 0;
END

ENGINE INT CACHE SET ON
-DEFAULTH &WF_STYLE_UNITS='PIXELS';
-DEFAULTH &WF_STYLE_HEIGHT='405.0';
-DEFAULTH &WF_STYLE_WIDTH='770.0';
-DEFAULTH &WF_TITLE='WebFOCUS Report';
GRAPH FILE CAR
SUM MEAS_LAT AS 'LATEST'
MEAS_OUT AS 'OUTDATED'
BY SORT NOPRINT
BY COUNTRY AS ''

ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET UNITS &WF_STYLE_UNITS
ON GRAPH SET HAXIS &WF_STYLE_WIDTH
ON GRAPH SET VAXIS &WF_STYLE_HEIGHT
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 2
ON GRAPH SET LOOKGRAPH VBAR
ON GRAPH SET AUTOFIT ON
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setCurveFitEquationDisplay(false);
setPlace(true);
*END
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/ENIADefault_combine.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
setDisplay(getDataText(0), true);
setDataTextDisplay(true);
*END
*GRAPH_JS
dataLabels: {
formatCallback: function(d, s, g) {
var sum = d.value / pv.sum(this.data.map(function(el){return el[g];}), function(el){return el.value;});
return this.formatNumber(d.value, '$#') + ' ' + this.formatNumber(sum, '#%');
}
},

*END
ENDSTYLE
END
-RUN




Thank you for participating in the Focal Point Forum!
Tamra Colangelo
Focal Point Moderator
Information Builders


WebFOCUS 8.2.02
Windows, All Outputs
 
Posts: 95 | Registered: May 16, 2016Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Bar Graph Data Labels

Copyright © 1996-2020 Information Builders