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] Data Labels with Series Label and Data Value on Stacked Bar

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Data Labels with Series Label and Data Value on Stacked Bar
 Login/Join
 
Member
posted
I've been tasked with making stacked bar charts that will include both the series label and the data value on the chart as a data label.
So for the CAR example below, instead of just having the sales amount for each series it would also have the country like: "JAPAN: 78,030".
This seems like a very simple task but I can't seem to find a way to do it. I can either display the data value or the series value but not both.

GRAPH FILE CAR
SUM CAR.BODY.SALES
BY CAR.ORIGIN.COUNTRY
BY CAR.BODY.BODYTYPE
WHERE CAR.BODY.BODYTYPE EQ 'SEDAN';
WHERE CAR.ORIGIN.COUNTRY NE 'ITALY';
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET GRWIDTH 1
ON GRAPH SET AUTOFIT ON
ON GRAPH SET UNITS &WF_STYLE_UNITS
ON GRAPH SET HAXIS &WF_STYLE_WIDTH
ON GRAPH SET VAXIS &WF_STYLE_HEIGHT
ON GRAPH SET LOOKGRAPH BAR
ON GRAPH SET AUTOFIT ON
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setPlace(true);
setCurveFitEquationDisplay(false);
*END
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/ENIADefault_combine.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
TYPE=DATA, COLUMN=N1, BUCKET=color, $
TYPE=DATA, COLUMN=N2, BUCKET=x-axis, $
TYPE=DATA, COLUMN=N3, BUCKET=y-axis, $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
setDataTextPosition(4);
setDataTextDisplay(true);
setDisplay(getLegendArea(),false);
*GRAPH_JS_FINAL
"pieProperties": {
    "holeSize": "0%"
},
"blaProperties": {
    "seriesLayout": "stacked"
},
"agnosticSettings": {
    "chartTypeFullName": "Bar_Stacked"
}
*END
ENDSTYLE
END
-RUN  

This message has been edited. Last edited by: Matthew S,


WebFocus 8207
Windows 10
Excel, HTML
 
Posts: 7 | Registered: July 27, 2017Report This Post
Virtuoso
posted Hide Post
Is that what you're looking for ?
GRAPH FILE CAR
SUM SALES
    COMPUTE TT1      /A30V = 'My Tooltip';
    COMPUTE TT2      /A30V = COUNTRY || ' : ' | FPRINT(SALES, 'D8', 'A10');
BY COUNTRY
BY BODYTYPE
WHERE BODYTYPE EQ 'SEDAN';
WHERE COUNTRY NE 'ITALY';
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET GRWIDTH 1
ON GRAPH SET AUTOFIT ON
ON GRAPH SET UNITS PIXELS
ON GRAPH SET HAXIS 700
ON GRAPH SET VAXIS 400
ON GRAPH SET LOOKGRAPH BAR
ON GRAPH SET AUTOFIT ON
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setPlace(true);
setCurveFitEquationDisplay(false);
*END
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/ENIADefault_combine.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
TYPE=DATA, COLUMN=N1, BUCKET=color, $
TYPE=DATA, COLUMN=N2, BUCKET=x-axis, $
TYPE=DATA, COLUMN=N3, BUCKET=y-axis, $
TYPE=DATA, COLUMN=TT1,     BUCKET=tooltip, $
TYPE=DATA, COLUMN=TT2,     BUCKET=tooltip, $
*GRAPH_JS_FINAL
series: [ {"series": 'reset', "tooltip": '{{tooltip1}}<br>{{tooltip2}}'} ],
htmlToolTip: {enable: true, snap: false }
*END
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
setDataTextPosition(4);
setDataTextDisplay(true);
setDisplay(getLegendArea(),false);
*GRAPH_JS_FINAL
"pieProperties": {
    "holeSize": "0%"
},
"blaProperties": {
    "seriesLayout": "stacked"
},
"agnosticSettings": {
    "chartTypeFullName": "Bar_Stacked"
}
*END
ENDSTYLE
END
-RUN

You can add as many as you want. Each tooltip will be on its own line.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Expert
posted Hide Post
In case you meant the data labels and not tooltips, here is another slant. This method can be found in the JSCHART manual (page 135 of the copy that I have) within chapter "4 Chart-Wide properties" under "Using a Callback Function to Format Data Labels".

My suggestion is to download a copy of the PDF for reference.

GRAPH FILE CAR
SUM SALES
    COMPUTE TT1/A30V = COUNTRY || ' : ' | FPRINT(SALES, 'D8', 'A10');
BY COUNTRY
BY BODYTYPE
WHERE BODYTYPE EQ 'SEDAN';
WHERE COUNTRY NE 'ITALY';
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET GRWIDTH 1
ON GRAPH SET AUTOFIT ON
ON GRAPH SET UNITS PIXELS
ON GRAPH SET HAXIS 700
ON GRAPH SET VAXIS 400
ON GRAPH SET LOOKGRAPH BAR
ON GRAPH SET AUTOFIT ON
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setPlace(true);
setCurveFitEquationDisplay(false);
*END
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/ENIADefault_combine.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
TYPE=DATA, COLUMN=N1, BUCKET=color, $
TYPE=DATA, COLUMN=N2, BUCKET=x-axis, $
TYPE=DATA, COLUMN=N3, BUCKET=y-axis, $
TYPE=DATA, COLUMN=TT1, BUCKET=tooltip, $
*GRAPH_JS_FINAL
dataLabels: {
    visible: true,
    position: 'bottom',
    formatCallback: function(d) {return d.tooltip1;}
},
htmlToolTip: {enable: true, snap: false }
*END
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
setDisplay(getLegendArea(),false);
*GRAPH_JS_FINAL
"pieProperties": {
    "holeSize": "0%"
},
"blaProperties": {
    "seriesLayout": "stacked"
},
"agnosticSettings": {
    "chartTypeFullName": "Bar_Stacked"
}
*END
ENDSTYLE
END


T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Member
posted Hide Post
Tony A,

Yes, I did want it for data labels and not tooltips.
Thank you for your reply. This should work well.


WebFocus 8207
Windows 10
Excel, HTML
 
Posts: 7 | Registered: July 27, 2017Report This Post
Expert
posted Hide Post
Nice works guys.
If you know me, I'll do / ask for more. So, What needs to be done to eliminate "'SALES:' and 'COUNTRY:' from displaying in the tooltip (on hover)? It's redundant information.
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Expert
posted Hide Post
I'd argue that the entire tooltips are redundant, especially if you capture the chart as an image and place within a PDF doc.

So I would use
htmlToolTip: {enabled: false}
and get rid of them completely.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Member
posted Hide Post
quote:
Originally posted by Doug:
Nice works guys.
If you know me, I'll do / ask for more. So, What needs to be done to eliminate "'SALES:' and 'COUNTRY:' from displaying in the tooltip (on hover)? It's redundant information.


I did turn off tooltips but if for some reason they needed to be kept you could do something like:
series: *GRAPH_JS_FINAL
"pieProperties": {
    "holeSize": "0%"
},
"blaProperties": {
    "seriesLayout": "stacked"
},
"agnosticSettings": {
    "chartTypeFullName": "Bar_Stacked"
},
dataLabels: {
    visible: true,
    position: 'bottom',
    formatCallback: function(d) {return d.tooltip1;}
},
htmlToolTip: {enable: true, snap: false },
series: [  {
"series": 'reset', "tooltip": '{{tooltip1}}'+'<br>'+'Why do you need a tooltip here?'
      }  ],
  

This message has been edited. Last edited by: Matthew S,


WebFocus 8207
Windows 10
Excel, HTML
 
Posts: 7 | Registered: July 27, 2017Report 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] Data Labels with Series Label and Data Value on Stacked Bar

Copyright © 1996-2020 Information Builders