Focal Point
[CLOSED]Skipping Axis Labels in JSCHARTs

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

April 21, 2017, 04:54 PM
capples
[CLOSED]Skipping Axis Labels in JSCHARTs
I've tried multiple methods mentioned in the documentation to try and skip labels with a JSCHART, but everything only seems to work with non-JSCHART formats.

I searched and found an older thread (https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/8707084976?r=6077084976#6077084976) where people were discussing this same issue.

Most of the variants I've tried have been the AutoSkip get/set commands, eg
setO1LabelSkipBegin(1);
setO1LabelSkipCount(1);
setY1MajorGridDisplay(false);
setY1AxisLineDisplay(false);
setO1MajorGridDisplay(false);
setDepthRadius(0);
   setO1LabelAutoSkip(2);


Has anyone come across a method that works for JSCHARTs?

edit. Found a little success with these commands, but I cannot set the amount of labels to skip

*GRAPH_JS
blaProperties: {lineConnection: 'curved'},
xaxis: {labels: {visible: true,font: '10pt Calibri',rotation: 0}},
  axisAutoLayout:{rotate45:false, rotate90:true,truncate:false, stagger:true, skip:true}    
*END

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


WF 8.2.0.3
Windows 10 64bit
HTML, AHTML, PDF, Excel
April 24, 2017, 09:00 AM
BabakNYC
Code below provided by Francis a couple of years ago. I got it to work.
*GRAPH_SCRIPT

setReportParsingErrors(false);
setSelectionEnableMove(false);
setAutoSkip(getO1Label(),2);                                // sets or disables label skip for labels
setPlaceSkip(getO1Label(),0);
setSkipBegin(getO1Label(),0);                               // sets the first label to skip
setSkipCount(getO1Label(),1);                               // sets the interval of labels to skip after setSkipBegin()



WebFOCUS 8206, Unix, Windows
April 24, 2017, 09:34 AM
MartinY
Doesn't work with JSCHARTs

Except if you can provide a whole sample Babak, maybe we all missing something to make it work with JSCHARTs.


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
April 24, 2017, 09:48 AM
BabakNYC
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 wfretail82/wf_retail_tiny
-* Created by Info Assist for Graph
SUM WF_RETAIL_TINY.WF_RETAIL_SALES.COGS_US
WF_RETAIL_TINY.WF_RETAIL_SALES.DISCOUNT_US
WF_RETAIL_TINY.WF_RETAIL_SALES.GROSS_PROFIT_US
BY WF_RETAIL_TINY.WF_RETAIL_TIME_SALES.TIME_DATE
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET ARGRAPHENGIN JSCHART
ON GRAPH SET EMBEDHEADING ON
ON GRAPH SET VZERO OFF
ON GRAPH SET GRWIDTH 1
ON GRAPH SET AUTOFIT ON
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, ORIENTATION=LANDSCAPE, $
TYPE=DATA, COLUMN=N1, BUCKET=x-axis, $
TYPE=DATA, COLUMN=N2, BUCKET=y-axis, $
TYPE=DATA, COLUMN=N3, BUCKET=y-axis, $
TYPE=DATA, COLUMN=N4, BUCKET=y-axis, $
*GRAPH_SCRIPT

setReportParsingErrors(false);
setSelectionEnableMove(false);
setAutoSkip(getO1Label(),2);                                // sets or disables label skip for labels
setPlaceSkip(getO1Label(),0);
setSkipBegin(getO1Label(),0);                               // sets the first label to skip
setSkipCount(getO1Label(),1);                               // sets the interval of labels to skip after setSkipBegin()
;
*GRAPH_JS_FINAL
"introAnimation": {
    "enabled": true
}

*END
ENDSTYLE
END

-RUN




WebFOCUS 8206, Unix, Windows
April 24, 2017, 10:26 AM
MartinY
Babak, try the following and you'll see that the AutoSkip doesn't work for a JSCHART when it does for JPEG
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
SUM RETAIL_COST
BY CAR
-* -* setAutoSkip has no effect
ON GRAPH PCHOLD FORMAT JSCHART
-* -* setAutoSkip does make a difference in JPEG
-*ON GRAPH PCHOLD FORMAT JPEG
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET ARGRAPHENGIN JSCHART
ON GRAPH SET EMBEDHEADING ON
ON GRAPH SET VZERO OFF
ON GRAPH SET GRWIDTH 1
ON GRAPH SET AUTOFIT ON
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/javaassist/intl/EN/ENIADefault_combine.sty,$

TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, ORIENTATION=LANDSCAPE, $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
setAutoSkip(getO1Label(),2);                                // sets or disables label skip for labels
setPlaceSkip(getO1Label(),0);
setSkipBegin(getO1Label(),0);                               // sets the first label to skip
setSkipCount(getO1Label(),1);                               // sets the interval of labels to skip after setSkipBegin()
;
*GRAPH_JS_FINAL
"introAnimation": {
    "enabled": true
}
*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
April 24, 2017, 10:49 AM
Tony A
The "skip" option for JSCHART output defaults to true, so you should not have to add anything other than the assignment of the "buckets" for an chart format of BAR.

Doesn't appear to work with horizontal bar output. However, vertical bar works fine.

You do need to have a fair number or items for your axis though, which is why using the CAR file is not so good.

If you run the following, you'll see what I mean. Run the report and change the width of the window. Notice the axis labels changing.

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 wf_retail
SUM COGS_US
BY TIME_DATE
WHERE TIME_YEAR EQ 2008
-* -* setAutoSkip has no effect
ON GRAPH PCHOLD FORMAT JSCHART
-* -* setAutoSkip does make a difference in JPEG
-*ON GRAPH PCHOLD FORMAT JPEG
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET ARGRAPHENGIN JSCHART
ON GRAPH SET EMBEDHEADING ON
ON GRAPH SET VZERO OFF
ON GRAPH SET GRWIDTH 1
ON GRAPH SET AUTOFIT ON
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
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, ORIENTATION=LANDSCAPE, $
TYPE=DATA, COLUMN=N1, BUCKET=x-axis, $
TYPE=DATA, COLUMN=N2, BUCKET=y-axis, $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
*GRAPH_JS_FINAL
"introAnimation": {
    "enabled": true
}
*END
ENDSTYLE
END
-RUN


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 
April 24, 2017, 11:05 AM
MartinY
Tony, it's true that labels change, but the result is not the same as for the AutoSkip where you can select to display or not a label.

But it's not my issue, all this is capples request. Maybe the BUCKET option will suits the need.


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
April 24, 2017, 06:20 PM
capples
Tony, I was not aware of that bucket feature and that is better than what I previously had. It's actually probably better than what I was hoping for as it is dynamic in how it changes.

Martin is right though that I was wanting to have the ability to say how many labels to skip (ie the user wanted to only show a label every 6 months, instead of every month on the axis)


WF 8.2.0.3
Windows 10 64bit
HTML, AHTML, PDF, Excel
September 14, 2017, 08:44 AM
Gaurav
Hello everyone,

I want to give static labels to my x-axis which is showing number of days. I want to limit it from 0 - 60 with increment of 5. I have tried everything that is given in documentation HAUTO, HMAX, HMIN, HTICK. Nothing works for me. I am attaching the graph how it currently looks. Please HELP! [FLASH_VIDEO]


WebFOCUS 8.1.05
Windows, All Outputs
September 14, 2017, 08:47 AM
Gaurav
My Bad I don't know how to add picture to it. Basically it generates random numbers on X-axis which I want to be uniform so that my graph which is line chart looks more relevant. I am adding my code this time.

 
ENGINE INT CACHE SET ON
-DEFAULTH &WF_STYLE_UNITS='PIXELS';
-DEFAULTH &WF_STYLE_HEIGHT='400.0';
-DEFAULTH &WF_STYLE_WIDTH='500.0';
-DEFAULTH &WF_TITLE='WebFOCUS Report';
-DEFAULTH &HIGHVAL='60';
-DEFAULTH &MINVAL='0';
SET VAUTO=OFF, VMIN=0, VMAX=100,VTICK=10
DEFINE FILE install_repair_offer_select_sec
DAYS/D12.2 = HRS_REC_TO_COMPL / 24;
CNT/I10 = IF HRS_REC_TO_COMPL EQ MISSING THEN 0 ELSE 1;
END
GRAPH FILE install_repair_offer_select_sec
-* Created by Info Assist for Graph
SUM COMPUTE CMT_DAYS/I10 = LAST CMT_DAYS + CNT; NOPRINT
	COMPUTE PER_COMP/D12% = (CMT_DAYS / TOT.CNT)*100;
BY DAYS
WHERE JOB_TGT_DUE_DTTM GE '2017/08/01';
WHERE JOB_TGT_DUE_DTTM LE '2017/08/07';
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET ARGRAPHENGIN JSCHART
ON GRAPH SET EMBEDHEADING ON
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 HAUTO OFF
ON GRAPH SET HMIN 0
ON GRAPH SET HMAX 60
ON GRAPH SET HTICK 5
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 1
ON GRAPH SET LOOKGRAPH VLINE
ON GRAPH SET AUTOFIT OFF
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setCurveFitEquationDisplay(false);
setPlace(true);
-*setuseseriesshapes(true);
-*setmarkersizedefault(50);
-*setAutoSkip(getO1Label(),2);
-*setPlaceSkip(getO1Label(),0);
-*setSkipBegin(getO1Label(),0);                               
-*setSkipCount(getO1Label(),5); 
setScaleMaxAuto(getX1Axis(),false);
setScaleMinAuto(getX1Axis(),false);
setScaleMax(getX1Axis(),&HIGHVAL);
setScaleMin(getX1Axis(),&MINVAL );
*END
*GRAPH_JS
border: {width: 2, color: 'teal'},
blaProperties: {lineConnection: 'curved'},
xaxisNumeric: {
  min: 0,
  max: 60
  }
*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 



WebFOCUS 8.1.05
Windows, All Outputs
September 14, 2017, 09:21 AM
Francis Mariani
You would think that JSCHART (new technology) would be able to do everything 3D Graphics (old and current technology) can do, but, unfortunately not.

How do people discover this? By trying things they knew used to work and now don't.

JSCHARTS has introduced interesting new features but does not support a lot of stuff we've all used in the past.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server