Focal Point
[SOLVED] Vertical Percent Bar Label

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

December 03, 2014, 03:30 PM
Rev1
[SOLVED] Vertical Percent Bar Label
I've got a request to show a vertical percent bar graph but display the individual dollar amounts instead of they stacked % amount. Example Dealer A sold 10,000 dollars worth of cars and 90,000 dollars in trucks. The stacked bar would show 90% trucks, 10% cars and the labels for those bars would show 10,000 and 90,000. Searching the forum I found comments that it can't be done but they were from old threads. Just wanted to make sure a solution hasn't been found by someone.

This message has been edited. Last edited by: <Kathryn Henning>,


WebFOCUS 8104, Windows, All Outputs
December 04, 2014, 04:37 PM
<nick z>
Yes, there is a way to do it in code in JSCHART output format only:

GRAPH FILE CAR
SUM CAR.BODY.DEALER_COST
CAR.BODY.RETAIL_COST
BY CAR.ORIGIN.COUNTRY
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET ARGRAPHENGIN JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 1
ON GRAPH SET LOOKGRAPH VBRSTKPC
ON GRAPH SET AUTOFIT ON
ON GRAPH SET STYLE *
*GRAPH_SCRIPT

setPieDepth(0);
setPieTilt(0);
setDepthRadius(0); 
setCurveFitEquationDisplay(false); 
setPlace(true); 

*END

*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
setDataTextDisplay(true);
*END
*GRAPH_JS
dataLabels: {visible:true,
formatCallback: function(v, s,g) {
  if (typeof v === 'object' && v.hasOwnProperty('value')) {
    v = v.value;
  } else {
    v = this.data[s][g];
  }
  return this.formatNumber(v, '$#,#') ;
}},
series: [
{series: 'reset', showDataValues:true,
}
]

*END
ENDSTYLE
END

-RUN


Note: This is a workaround and will only work for this scenario where you have 2 or more Measures and only 1 BY field on a Percent BAR chart.
This may not work for other Chart types.
Thanks.
Nick.