How to: |
The markerPosition property controls the location of the legend markers relative to the legend labels.
legend: {markerPosition: 'string'}
where:
Is a string that defines the location of legend markers relative to the legend label. Valid values are:
The following request places the legend markers below the legend labels:
GRAPH FILE WFLITE SUM DISCOUNT_US GROSS_PROFIT_US REVENUE_US MSRP_US BY PRODUCT_CATEGORY ON GRAPH HOLD FORMAT JSCHART ON GRAPH SET LOOKGRAPH VBAR ON GRAPH SET STYLE * INCLUDE=ENDEFLT,$ *GRAPH_JS legend: {markerPosition: 'bottom'}, series: [ {series: 0, color: 'lightgreen'}, {series: 1, color: 'coral'}, {series: 2, color: 'lightblue'}, {series: 3, color: 'burlywood'} ] *END ENDSTYLE END
The output is:
The following version of the request moves the legend to the right of the chart and places the legend markers to the right of the legend labels:
GRAPH FILE WFLITE SUM DISCOUNT_US GROSS_PROFIT_US REVENUE_US MSRP_US BY PRODUCT_CATEGORY ON GRAPH HOLD FORMAT JSCHART ON GRAPH SET LOOKGRAPH VBAR ON GRAPH SET STYLE * INCLUDE=ENDEFLT,$ *GRAPH_JS legend: {position: 'right', markerPosition: 'right'}, series: [ {series: 0, color: 'lightgreen'}, {series: 1, color: 'coral'}, {series: 2, color: 'lightblue'}, {series: 3, color: 'burlywood'} ] *END ENDSTYLE END
The output is:
The following legend properties change the marker position to 'top' with the legend position to the right. They also draw a border around the legend:
legend: { position: 'right', markerPosition: 'top', lineStyle: {color: 'blue'} }
These legend properties generate the following chart:
Information Builders |