Focal Point
[SOLVED] Tooltip Formatting - Multiple X Axis's

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/4747094386

August 19, 2016, 03:50 PM
Joel Elscott
[SOLVED] Tooltip Formatting - Multiple X Axis's
I’m trying to format a tooltip for a bar chart with two x axis’s. By default it’s putting in a “>” symbol in for some reason. Is there any way to format a tooltip with multiple x axis’s?

I’ve tried using the following code, but it’s not working:
  
*GRAPH_JS
    series: [
    {'series': 'reset',
                   tooltip: function(d,s,g){
                         return this.getSeries(s).label +', ' +
this.groupLabels[g] +': ' + this.formatNumber(d,'#,###') ; }
     },
    ],

*END


Here is the code I have right now with the default tooltip formatting.

  
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
-* Created by Info Assist for Graph
SUM CAR.BODY.DEALER_COST
CAR.BODY.RETAIL_COST
BY CAR.ORIGIN.COUNTRY
BY CAR.COMP.CAR
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET GRWIDTH 1
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);
*END
ENDSTYLE
END
-RUN
 
-*IA_GRAPH_FINISH

This message has been edited. Last edited by: Joel Elscott,


WebFOCUS 8.2.03
z/OS
August 22, 2016, 08:10 AM
Chad Miller
Try this in your series. I can't run it in my version on App Studio correctly, but the portal does render correct.

 series: [
{series: 'reset', tooltip: function(v,s,g) {
    x = this.data[0][g].value;
    x = this.formatNumber(x, '$###,###,###.');
    y = this.data[1][g].value;
    y = this.formatNumber(y, '$###,###,###.');
    return this.getSeries(0).label + ': ' + x + '<br>' +
    this.getSeries(1).label + ': ' + y + '<br>' 
    ;}}
,] 



WebFOCUS 8105
Windows, All Outputs
August 22, 2016, 09:57 AM
Joel Elscott
Thanks for the response Chad! Unfortunately this isn't working for me though, either as a stand alone report or in the portal. The greater than sign still appears. Is this what your code looks like?

  
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
-* Created by Info Assist for Graph
SUM CAR.BODY.DEALER_COST
CAR.BODY.RETAIL_COST
BY CAR.ORIGIN.COUNTRY
BY CAR.COMP.CAR
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET GRWIDTH 1
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);
 series: [
{series: 'reset', tooltip: function(v,s,g) {
    x = this.data[0][g].value;
    x = this.formatNumber(x, '$###,###,###.');
    y = this.data[1][g].value;
    y = this.formatNumber(y, '$###,###,###.');
    return this.getSeries(0).label + ': ' + x + '<br>' +
    this.getSeries(1).label + ': ' + y + '<br>' 
    ;}}
,] 
*END
ENDSTYLE
END
-RUN



WebFOCUS 8.2.03
z/OS
August 22, 2016, 10:05 AM
Chad Miller
Try changing this line.
 ON GRAPH SET LOOKGRAPH VBAR 
to this:
 ON GRAPH SET LOOKGRAPH VBAR2AX 



WebFOCUS 8105
Windows, All Outputs
August 22, 2016, 10:23 AM
Joel Elscott
Chad, your first version worked fine. I just didn't have it coded quite right. Thanks for your help!!

Final code for those interested:
  
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
-* Created by Info Assist for Graph
SUM CAR.BODY.DEALER_COST
CAR.BODY.RETAIL_COST
BY CAR.ORIGIN.COUNTRY
BY CAR.COMP.CAR
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET GRWIDTH 1
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);
*END
*GRAPH_JS
 series: [
{series: 'reset', tooltip: function(v,s,g) {
    x = this.data[0][g].value;
    x = this.formatNumber(x, '$###,###,###.');
    y = this.data[1][g].value;
    y = this.formatNumber(y, '$###,###,###.');
    return this.getSeries(0).label + ': ' + x + '<br>' +
    this.getSeries(1).label + ': ' + y + '<br>' 
    ;}}
,] 
*END
ENDSTYLE
END
-RUN



WebFOCUS 8.2.03
z/OS
August 22, 2016, 10:31 AM
Chad Miller
Happy to help, Joel!


WebFOCUS 8105
Windows, All Outputs
September 21, 2016, 11:33 AM
Reiter
quote:
series: [
{series: 'reset', tooltip: function(v,s,g) {
x = this.data[0][g].value;
x = this.formatNumber(x, '$###,###,###.');
y = this.data[1][g].value;
y = this.formatNumber(y, '$###,###,###.');
return this.getSeries(0).label + ': ' + x + '
' +
this.getSeries(1).label + ': ' + y + '
'
;}}
,]


@Chad
This is simple and glorious!!!
DS and AS seem to blow up when you use code under JS_GRAPH but at least I have a solution now. I can handle maintaining code if it means my consumer is happy with the output.
would be nice if a more simple GUI method was out there so I wouldn't have to use java tricks to get things to look right. We have some IBI people coming on site to show us the wonders of AS but I'm not going to hold my breath.

Thanks for the idea Chad!!


WebFOCUS 8.1.0.5 DS, learning AS
Windows, All Outputs
April 12, 2017, 02:08 AM
Sheik
-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
-* Created by Info Assist for Graph
SUM CAR.BODY.DEALER_COST
CAR.BODY.RETAIL_COST
BY CAR.ORIGIN.COUNTRY
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET GRWIDTH 1
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 1
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_JS
series: [
{series: 'reset', tooltip: function(v,s,g) {
x = this.data[0][g];
x = this.formatNumber(x, '###,###,###.');
y = this.data[1][g];
y = this.formatNumber(y, '###,###,###.');
return this.getSeries(0).label + ': ' + x + '
' +
this.getSeries(1).label + ': ' + y + '
'
;}}
,]
*END
ENDSTYLE
END