Focal Point
[CLOSED] Displaying data labels from different field in PNG Chart

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

December 12, 2019, 12:37 PM
JLC
[CLOSED] Displaying data labels from different field in PNG Chart
Hi,

Has anyone plotted a chart using a numeric field but used a alphanumeric field to display the data labels? I have a line chart where I am plotting the average service time over several weeks. Average service time is a numeric field which contains the average service time in minutes with decimal places. I would like to display the average service time in minutes and seconds (mm:ss) format as the associated data label, is there a way to do that? While I can compute another field in alphanumeric format to show mm:ss, I was wondering if there was a way to use the computed field for the data label.

Is there a way to do this for a PNG chart as I am trying to reference the chart in a compound document?

Thank you in advance for your suggestions!
~JL
WebFOCUS 8.2.0.4

This message has been edited. Last edited by: FP Mod Chuck,
December 13, 2019, 09:40 AM
vaayu
Try this,
GRAPH FILE CAR
SUM SALES
COMPUTE TT1/A30V = 'HH:MM:SS'|| ' : ' | FPRINT(SALES, 'D8', 'A10');
-*COMPUTE TT1/A30V = COUNTRY || ' : ' | FPRINT(SALES, 'D8', 'A10');

BY COUNTRY

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:/WFC/Global/Themes/Standard/Default/theme.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $

TYPE=DATA, COLUMN=N1, BUCKET=x-axis, $
TYPE=DATA, COLUMN=N2, 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
"series": [
{
"dataLabels": {
"clipToContainer": false,
"visible": true,
"color": "rgba(255, 255, 255, 1)",
"position": "center",
"content": "{{series_label}}, {{metadata_value(\"value\", \"dataLabels\")}}",
"font": "bold 7.5pt 'ARIAL'"
},
"series": "all"
}
],

"pieProperties": {
"holeSize": "0%"
},
"blaProperties": {
"seriesLayout": "stacked",
"orientation": "horizontal",
"barGroupGapWidth": 0.54
},

"agnosticSettings": {
"chartTypeFullName": "Bar_Stacked"
}
*END
ENDSTYLE
END


-********************
Sandbox: 8206.10
Dev: 8201M
Prod:8009
-********************
December 13, 2019, 03:52 PM
JLC
Thank you, vaayu.

Adding this worked for HTML5 chart:
dataLabels: {
visible: true,
position: 'bottom',
formatCallback: function(d) {return d.tooltip1;}
},

Is there anyway to get this to work for a PNG chart?

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


WebFOCUS 8.2.0.4