Jump to content

Recommended Posts

Posted

Hi community,

I am trying to have each Bullet chart with its own title.

With below sample, each graph is named Chart Title

The goal is to have each of them with its respective COUNTRY name : ENGLAND then JAPAN

-SET &Title = 'MyTitle';

GRAPH FILE CAR

SUM RCOST

BY COUNTRY

BY CAR

WHERE COUNTRY EQ 'ENGLAND' OR 'JAPAN';

ON GRAPH SET VAXIS 50

ON GRAPH PCHOLD FORMAT JSCHART

ON GRAPH SET LOOKGRAPH CUSTOM

ON GRAPH SET STYLE *

*GRAPH_JS

"chartType": "bullet",

"border": {"width": 0, "color": "white"},

"title": {"visible": true, "text": "Chart Title", "color": "red"},

-*"title": {"visible": true, "text": "Title: {{series_label}}", "color": "red"},

-*"title": {"visible": true, "text": "&Title", "color": "red"},

"yaxis": {"colorBands": [

{"start": 0, "stop": 10000, "color": "silver"},

{"start": 10000, "stop": 20000, "color": "lightgrey"},

{"start": 20000, "stop": 30000, "color": "whitesmoke"}]

},

"series": [

{"series": 0, "group": 0, "color": "steelblue"},

{"series": 0, "group": 1, "color": "red", "marker": {"size": 15, "position": "middle", "shape": "triangle"}}

]

*END

ENDSTYLE

END

I know how to replace by a variable but this is not what I am looking for.

Thanks for suggestion

Posted

The code below does what you want, however, the title text and bullet graphic are on separate lines. couldnt see how to get the on the same line.

GRAPH FILE CAR

"<COUNTRY"

SUM SALES

BY COUNTRY

BY CAR

WHERE COUNTRY EQ 'ENGLAND' OR 'JAPAN';

ON GRAPH PCHOLD FORMAT JSCHART

ON GRAPH SET LOOKGRAPH CUSTOM

ON GRAPH SET VAXIS 50

ON GRAPH SET STYLE *

TYPE=HEADING, SIZE=9, FONT=ARIAL, $

*GRAPH_JS

"chartType": "bullet",

"border": {"width": 0, "color": "white"},

"yaxis": {"colorBands": [

{"start": 0, "stop": 10000, "color": "silver"},

{"start": 10000, "stop": 20000, "color": "lightgrey"},

{"start": 20000, "stop": 30000, "color": "whitesmoke"}]

},

"series": [

{"series": 0, "group": 0, "color": "steelblue"},

{"series": 0, "group": 1, "color": "red", "marker": {"size": 15, "position": "middle", "shape": "triangle"}}

]

*END

ENDSTYLE

END

Posted

Thanks David, better than nothing

I found that the report result is affected by below setting :

SET EMBEDHEADING = OFF/ON

If use with ON, the Bullet graph title (heading) is located at far left and same line as the graph itself - which gives a bad look.

If set to OFF, the herading is placed above - which is much better

Posted

With EMBEDHEADING=ON it looks somewhat better with a non-proportional font and replacing the spaces with some character such as a period. Then the bullet charts line up on the left side.

 

image.png741449 12.9 KB

 

GRAPH FILE CAR

SUM SALES

COMPUTE COUNTRY2/A11 = REPLACE(COUNTRY, ' ', '.' ); NOPRINT

BY COUNTRY

BY CAR

HEADING

"<COUNTRY2>"

ON GRAPH PCHOLD FORMAT JSCHART

ON GRAPH SET LOOKGRAPH CUSTOM

ON GRAPH SET EMBEDHEADING ON

ON GRAPH SET VAXIS 50

ON GRAPH SET STYLE *

TYPE=HEADING, SIZE=9, FONT=CONSOLAS, HEADALIGN=BODY,$

*GRAPH_JS

"chartType": "bullet",

"border": {"width": 0, "color": "white"},

"yaxis": {"colorBands": [

{"start": 0, "stop": 10000, "color": "silver"},

{"start": 10000, "stop": 20000, "color": "lightgrey"},

{"start": 20000, "stop": 30000, "color": "whitesmoke"}]

},

"series": [

{"series": 0, "group": 0, "color": "steelblue"},

{"series": 0, "group": 1, "color": "red", "marker": {"size": 15, "position": "middle", "shape": "triangle"}}

]

*END

ENDSTYLE

END

Posted

Yes that I know but with long variable text (Country is short) the bullet graph are shift a lot to the right.

Also, with Heading on left side, you cannot use the DrillDown functionnality which you can with the Heading placed on top.

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...