Focal Point
[CLOSED] Conditional styling/formatting Axis Labels in HTML5 charts

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

June 06, 2019, 10:46 AM
jfr99
[CLOSED] Conditional styling/formatting Axis Labels in HTML5 charts
Hi All,

How do you conditionally style/format an axis label when creating a HTML5 chart?

This turns all x axis values red ...

*GRAPH_JS
xaxis: {labels: {color: 'red', font: 'bold 12pt Bookman Old Style'}}
*END


But how can you turn only some red depending on some condition?

Thanks

This message has been edited. Last edited by: FP Mod Chuck,


WebFocus 8.201M, Windows, App Studio
June 06, 2019, 05:16 PM
Waz
You can use javascript to do some manipulation.

e.g.
GRAPH FILE CAR
SUM SALES
BY COUNTRY
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET LOOKGRAPH LINE
ON GRAPH SET STYLE *
*GRAPH_JS
border: {width:0},
series: [{series: 'all', marker: {shape: 'circle'}}],
  xaxis: {
    labels: {
     font: 'bold 10pt Bookman Old Style',
     color: function(val){
      switch(val) {
       case 'ENGLAND':
        return 'blue';
        break ;
       case 'FRANCE':
        return 'red';
        break ;
       default:
        return 'green';
        break ;
      }
     }
    }
   },
  yaxis: {
    labels: {font: 'bold 10pt Bookman Old Style',color: 'blue'}}    
*END
ENDSTYLE
END



Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

June 07, 2019, 08:30 AM
jfr99
Hi Waz ... Thanks for the example, but when I run your code ... all the COUNTRY values are blank. What needs to be changed to make this work? Does that code work for you?


WebFocus 8.201M, Windows, App Studio
June 07, 2019, 11:01 AM
Tony A
Code works for me unchanged in 8.2.04. In 8.2.01 there seems to be an issue so I would suggest a case with tech support?

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 
June 10, 2019, 05:12 PM
Waz
Code works for me in 8.1.04, but does not on 8.2.05.

Perhaps this is an undocumented feature or a Bug ??


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

June 11, 2019, 03:18 AM
Tony A
Waz,

Works for me OK in 8.2.05 gen 12212018.

The only version that I saw issues was 8.2.01

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 
June 11, 2019, 05:13 PM
Waz
Gen date for my 8.2.05 is
24 Feb 2019 (Client)
21 Feb 2019 (Server) GEN_NUM = 1535


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

June 12, 2019, 03:58 AM
Tony A
Mine is currently
Client 12th Oct 2018 Build/Gen 13
Server 8th Oct 2018 Gen 1518

Will be updating to Gen 1542 (client 15) later hopefully and also building VM for 8.2.06 Gen 1732

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 
June 12, 2019, 12:37 PM
Tony A
Works on
- 8205 - client Build/Gen 104 server Gen 1542 which are the latest for 8.2.05

- 8206 - client Build/Gen 22 server Gen 1732 - latest for 8206

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 
June 12, 2019, 06:32 PM
Waz
Bugger,

don't want to upgrade if I can avoid it.

Guess I was unlucky in the version I downloaded.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!