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] Vertical DataText in Bar graph

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[Solved] Vertical DataText in Bar graph
 Login/Join
 
Member
posted
Hi All,

I'm trying to rotate the data text to 90deg. It's not working. Can anyone please help me on this?

-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.COMP.CAR
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO 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 LOOKGRAPH BAR
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/ibi_themes/Warm.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
TYPE=DATA, COLUMN=N1, BUCKET=x-axis, $
TYPE=DATA, COLUMN=N2, BUCKET=y-axis, $
TYPE=DATA, COLUMN=N3, BUCKET=y-axis, $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
setDisplay(getDataText(), true);
setTextRotation(getDataText(),1);

*GRAPH_JS_FINAL
"pieProperties": {
    "holeSize": "0%"
},
"blaProperties": {
    "seriesLayout": "percent"
},
"agnosticSettings": {
    "chartTypeFullName": "Bar_Percent"
}
*END
ENDSTYLE
END
-RUN

-*IA_GRAPH_FINISH


Thanks,
Dinesh

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


WebFOCUS 8105 | 8206
Windows, All Outputs
 
Posts: 22 | Registered: May 24, 2016Report This Post
Virtuoso
posted Hide Post
Is that what you're looking for ?

-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 CAR.BODY.DEALER_COST
    CAR.BODY.RETAIL_COST
BY CAR.COMP.CAR
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO 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 LOOKGRAPH BAR
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/ibi_themes/Warm.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
TYPE=DATA, COLUMN=N1, BUCKET=x-axis, $
TYPE=DATA, COLUMN=N2, BUCKET=y-axis, $
TYPE=DATA, COLUMN=N3, BUCKET=y-axis, $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
setDisplay(getDataText(), true);
-*setTextRotation(getDataText(), 2);

-* 45 degre
-*setTextRotation(getO1Label(),3);
-* 90 degre
setTextRotation(getO1Label(),2);
-* 270 degre
-*setTextRotation(getO1Label(),1);


*GRAPH_JS_FINAL
"pieProperties": {
    "holeSize": "0%"
},
"blaProperties": {
    "seriesLayout": "percent"
},
"agnosticSettings": {
    "chartTypeFullName": "Bar_Percent"
}
*END
ENDSTYLE
END
-RUN


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
Member
posted Hide Post
Not the x axis or y axis label. I'm looking for datatext rotation(numbers on the bar).


WebFOCUS 8105 | 8206
Windows, All Outputs
 
Posts: 22 | Registered: May 24, 2016Report This Post
Virtuoso
posted Hide Post
As per documentation, doesn't seems to be an option.

How to Show and Format Data Text Labels
"series":[
  {"series": s,
    "dataLabels": {
      "visible": boolean,
      "content": "string",
      "content": function(),
      "position": "string",
      "font": "string",
      "color": "string",
      "useNegativeColor": boolean,
      "negativeColor": "string",
      "numberFormat": "numformat",
      "feelerLine": {
        "visible": boolean,
        "width": number,
        "color": "string",
        "dash": "string"
      }
    }
  }
]


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
Member
posted Hide Post
Thanks MartinY. Any workaround for this?


WebFOCUS 8105 | 8206
Windows, All Outputs
 
Posts: 22 | Registered: May 24, 2016Report This Post
Master
posted Hide Post
You could work around this with javascript in an -HTMLFORM block

  
-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.COMP.CAR
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO 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 LOOKGRAPH BAR
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/ibi_themes/Warm.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
TYPE=DATA, COLUMN=N1, BUCKET=x-axis, $
TYPE=DATA, COLUMN=N2, BUCKET=y-axis, $
TYPE=DATA, COLUMN=N3, BUCKET=y-axis, $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(true);
setDisplay(getDataText(), true);
setTextRotation(getDataText(),2);
setFontSizeInPoints(getDataText(),18);
setFillColor(getDataText(),new Color(255,255,255));
setDataTextPosition(4);
*GRAPH_JS_FINAL
"pieProperties": {
    "holeSize": "0%"
},
"blaProperties": {
    "seriesLayout": "percent"
},
"agnosticSettings": {
    "chartTypeFullName": "Bar_Percent"
}
*END
ENDSTYLE
END
-RUN

-*IA_GRAPH_FINISH

-HTMLFORM BEGIN NOEVAL
<head>
    <script src='https:cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js'></script>
    <script>
         $(document).ready(function () {
             $(function(){
                 rotateLabels(); 
             });         
         });
         function rotateLabels(){
             var lbl = $("text[class^='dataLabels!s']");
             if (lbl == null) {
                 console.log("not loaded");
                 setTimeout("rotateLabels()", 400);
             } else {
                 $("text[class^='dataLabels!s']").css('writing-mode', 'vertical-lr');
             }
         }
    </script>
</head>
-HTMLFORM END



Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
 
Posts: 608 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Report This Post
Virtuoso
posted Hide Post
@Hallway the data in the bar are not rotated as requested by Dinesh, it may miss something somewhere.


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
Master
posted Hide Post
My apologies. It works in Chrome and FireFox on my end... But I did forget to test using IE and Edge. Those both fail in rotating the text (go figure).


Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
 
Posts: 608 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Report This Post
Member
posted Hide Post
Yes, It’s not working in IE. In firefox or other browsers it’s working only on the initial load. If you resize the window(responsive) it will come back to it’s original position.

Anyway Thank you Hallway!! Appreciate your help!!


WebFOCUS 8105 | 8206
Windows, All Outputs
 
Posts: 22 | Registered: May 24, 2016Report This Post
Master
posted Hide Post
OK, I think that I have worked it out. Apparently when you use an HTMLFORM block on a chart, WebFOCUS puts the html code from that form block AFTER the closing html tag. Chrome and FF are smart enough to figure this out and still run the scripts. However this is a major hiccup for Microsoft browsers. So I changed the code to save the chart as a temp HOLD file and then put the HOLD file into a div element in the HTMLFORM block. This still caused errors in MSFT browsers because it still had duplicate head and body tags in the DOM (again Chrome and FF are smart enough to figure this out). So using jQuery, I was able to put the HOLD file into a temp div, extract out the div that contains the chart and put that into a different wrapper div and then delete out the temp div.

However, since that temp div was a complete html dom, the MSFT browsers fire off the ONLOAD event as soon as that hold file is loaded, before I could do the manipulation stated above. Chrome and FF wait until the entire page is loaded (after the manipulation stated above) before firing off the ONLOAD event. Because of this, I had to determine the browser being used and rotate the labels on the Document Ready event for MSFT browsers and rotate the labels on the window onLoad event for all other browsers.

I also added in the logic to keep the labels rotated when the window was resized.

Let me know if I missed anything.
-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.COMP.CAR
-* ON GRAPH PCHOLD FORMAT JSCHART
-* Change to a hold file
ON GRAPH HOLD AS CHART FORMAT JSCHART
ON GRAPH SET VZERO 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 LOOKGRAPH BAR
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/ibi_themes/Warm.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
TYPE=DATA, COLUMN=N1, BUCKET=x-axis, $
TYPE=DATA, COLUMN=N2, BUCKET=y-axis, $
TYPE=DATA, COLUMN=N3, BUCKET=y-axis, $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(true);
setDisplay(getDataText(), true);
setTextRotation(getDataText(),2);
setFontSizeInPoints(getDataText(),18);
setFillColor(getDataText(),new Color(255,255,255));
setDataTextPosition(4);
*GRAPH_JS_FINAL
"pieProperties": {
    "holeSize": "0%"
},
"blaProperties": {
    "seriesLayout": "percent"
},
"agnosticSettings": {
    "chartTypeFullName": "Bar_Percent"
}
*END
ENDSTYLE
END
-RUN

-*IA_GRAPH_FINISH


-HTMLFORM BEGIN NOEVAL
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Data Label Rotation</title>
    <script src='https://code.jquery.com/jquery-3.3.1.min.js'></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/UAParser.js/0.7.18/ua-parser.min.js"></script>
</head>
<body>
    <div id="CHART_0_temp">
        !IBI.FIL.CHART;
    </div>
    <div id="CHART_0_wrapper">
    </div>
    <script>
        new UAParser();
        var browser = $.ua.browser;
        
        $.fn.rotateLabels = function() {
            $("text[class^='dataLabels!s']").attr('transform', function(i, origValue){
                return origValue + ' rotate(270)'
            });
        }

        $(document).ready(function () {
            $("#CHART_0_wrapper").prepend( $("div[id^='jschart_CHART_0']") );
            $("#CHART_0_temp").remove();
            if (browser.name == 'IE' || browser.name == 'Edge' ) {
                $.fn.rotateLabels();
            };
        });
        
        $(window).on('load', function () {
            if (browser.name !== 'IE') {
                $.fn.rotateLabels();
            } else if ( browser.name !== 'Edge' ){
                $.fn.rotateLabels();  
            };
        });

        $(window).resize(function(){
            $.fn.rotateLabels();
        });

    </script>
</body>
</html>
-HTMLFORM END


Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
 
Posts: 608 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Report This Post
Member
posted Hide Post
Now it's working good and very much appreciated.

Thanks again Hallway for the workaround.


WebFOCUS 8105 | 8206
Windows, All Outputs
 
Posts: 22 | Registered: May 24, 2016Report This Post
Master
posted Hide Post


I'm glad to help.


Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
 
Posts: 608 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Report 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] Vertical DataText in Bar graph

Copyright © 1996-2020 Information Builders