Focal Point
[CLOSED] Change the X-axis values based on the filter

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

July 16, 2019, 02:26 PM
BI Dev
[CLOSED] Change the X-axis values based on the filter
Hi Everyone,

I am trying to create a bar chart where y-axis is an amount and x-axis is a date(ex:01/14/2019). My plan is to create a conditional x-axis which works like this.When I select a date range that is more than 3 months x-axis should plot amount by "date" but show alternate(Sunday to Sunday)weeks as labels(Ex:Sun Jan 13, Sun Jan 27 etc).When I select date range that is more than a year x-axis should plot amount by "bi-weekly" intervals on graph but show "Months" as labels(Ex: Jan '19). Please provide if you have any inputs on how to create this in webfocus. Thank you very much.

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


Webfocus 8105/8202
Windows
All Outputs
July 16, 2019, 03:09 PM
MartinY
If you don't already have these period defined (Sun Jan 13, Sun Jan 20, …) within a Date (calendar) table from which you can read from, you need to create them as you will do with any other programming language.
With WF you will use DEFINES or COMPUTE.
Assign a DEFINEd/COMPUTEd period for each available date.

Ideally, you should build a Date table where for each date you will assign its week value and any other period you need.
Then join this Date table to your data to have each data row linked with its proper Date table record. This way you will have access to your period fields.
Also it will become available to any other report since it's going to be a data table (Date table) and not specific to a report (hard coded).


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
July 16, 2019, 03:50 PM
BI Dev
Hi Martin,

Thanks for your input. Let's say I have these available at the data source and I have created a bar chart with amount in Y-axis and Date in X-axis. Can you let me know how to change the labels on x-axis based on the selected time range like I mentioned above.


quote:
Originally posted by MartinY:
If you don't already have these period defined (Sun Jan 13, Sun Jan 20, …) within a Date (calendar) table from which you can read from, you need to create them as you will do with any other programming language.
With WF you will use DEFINES or COMPUTE.
Assign a DEFINEd/COMPUTEd period for each available date.

Ideally, you should build a Date table where for each date you will assign its week value and any other period you need.
Then join this Date table to your data to have each data row linked with its proper Date table record. This way you will have access to your period fields.
Also it will become available to any other report since it's going to be a data table (Date table) and not specific to a report (hard coded).



Webfocus 8105/8202
Windows
All Outputs
July 16, 2019, 04:03 PM
MartinY
You can do something such as this where &BY1 will be assigned to proper desired x-axis field
But it's also possible that you will need a "fake" field to have them order properly such as a real date and not a text field. Otherwise it will be ordered alphabatically
-SET &BY1 = DECODE &SELECTION ('BYWEEK'  DATEWEEK
-                              'BYMONTH' DATEMONTH
-                              ELSE      DATEDAY);
GRAPH FILE xyz
SUM VALUE
BY &BY1
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
July 29, 2019, 10:36 AM
BI Dev
Hi Martin,

I will try this way. Thank you very much.

Regards
BI DEV


Webfocus 8105/8202
Windows
All Outputs