Jump to content

How can i get a MAX, MIN and a Avg line in a bar chart

Merin Joseph
Go to solution Solved by David Beagan ,

Recommended Posts

Yes - I know. But I think that you are not looking for a trend but an aggregation on the overall level of data. this could be done using partition aggregation - just create compute fields and use the function to build your calculations as described here


Link to comment
Share on other sites

You can use reference lines to produce something like this:

(code is below)image.thumb.png.c8bfb36e1daec5b5a506b4197dca1fa5.png

TABLE FILE ggsalesSUM UNITS BY STON TABLE HOLD AS bystateENDTABLE FILE bystateSUM MIN.UNITS AS 'MIN' AVE.UNITS AS 'AVE' MAX.UNITS AS 'MAX'ON TABLE SET ASNAMES ONON TABLE HOLD AS LINEVALSEND-RUN-DEFAULTH &MIN = 0;-DEFAULTH &AVE = 0;-DEFAULTH &MAX = 0;-READFILE LINEVALS GRAPH FILE ggsalesSUM UNITSBY STON GRAPH PCHOLD FORMAT JSCHARTON GRAPH SET LOOKGRAPH BARON GRAPH SET AUTOFIT ONON GRAPH SET STYLE *INCLUDE=IBFS:/FILE/IBI_HTML_DIR/ibi_themes/Warm.sty,$TYPE=DATA, COLUMN=N1, BUCKET=x-axis, $TYPE=DATA, COLUMN=N2, BUCKET=y-axis, $*GRAPH_JS"referenceLines": [ {"value": &MIN, "axis": "y", "line": {"color": "red", "width": 3, "dash": "dash"}, "label": {"text": "Minimum ", "color":"black", "font": "bold 10pt Sans-Serif"}, "anchor": "start", "showValue": true }, {"value": &AVE, "axis": "y", "line": {"color": "red", "width": 3, "dash": "dash"}, "label": {"text": "Average ", "color":"black", "font": "bold 10pt Sans-Serif"}, "anchor": "start", "showValue": true }, {"value": &MAX, "axis": "y", "line": {"color": "red", "width": 3, "dash": "dash"}, "label": {"text": "Maximum ", "color":"black", "font": "bold 10pt Sans-Serif"}, "anchor": "start", "showValue": true },]*ENDENDSTYLEEND
Link to comment
Share on other sites

  • Solution

It is very useful that the text of the reference line handles HTML code. Based on the example I previously provided, I was able to do a tooltip:

 image.png.fa663b6a3f7569a56fa3cb0c5f1143a4.pngBy using this code for a refernce line.

"referenceLines": [ {"value": &MIN, "axis": "y", "line": {"color": "red", "width": 3, "dash": "dash"}, "label": {"text": "<a title=' Min=&MIN' href='' style=color:orange;font-size:15pt;><br>&|#9632;</a>", "color":"black", "font": "bold 10pt Sans-Serif"}, "anchor": "start", "showValue": false },
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...