How to: |
The referenceLines properties define one or more reference lines to draw on an axis.
referenceLines: [ { value: rvalue, axis: 'axisstring', line: { color: 'linecstring', width: linewnumber, dash: 'linedstring' }, label: { text: 'labeltstring', font: 'labelfstring', color: 'labelcstring' }, anchor: 'anchorstring', showValue: boolean } ]
where:
Is a number or string that defines where on the axis to draw the line.
Is a string that defines the axis on which to draw the line: 'x', 'y', 'y2', or undefined (do not draw line).
Is a color defined by a color name or numeric specification string that defines the color of the line. The default is 'black'.
Is a number that defines the width of the line in pixels. The default is 1.
Is a string that defines the dash style of the line. Use a string of numbers that defines the width of a dash followed by the width of the gap between dashes (for example, dash: '1 1' draws a dotted line). Use '' for a solid line.
Is an optional string that defines the label to draw beside a reference line. Use '', or undefined Empty string, or undefined, to draw no label.
Is a string that defines the size and type face of the label. The default is '7.5pt Sans-Serif'.
Is a color defined by a color name or numeric specification string that defines the color of the label.
Is a string that defines where to draw the reference label relative to the line. Valid values are: 'start' (same side as axis labels) or 'end' (opposite side).
Enables or disables showing the reference line value. Valid values are:
The following request against the GGSALES data source generates a vertical bar chart with two reference lines. The y-axis reference line is a red line drawn at the value 4,000,000, with a green label that shows the value as part of the label. The x-axis reference line is a green line drawn at the value Food, with a red label that shows the value as part of the label:
GRAPH FILE GGSALES
SUM DOLLARS UNITS BUDDOLLARS BUDUNITS
BY CATEGORY
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET LOOKGRAPH VBAR
ON GRAPH SET STYLE *
*GRAPH_JS
referenceLines: [
{value: 4000000,
axis: 'y',
line: {color: 'red', width: 6,dash: '' },
label: {text: 'Reference Line @:',
font: 'bold 8pt Sans-Serif',
color: 'green' },
anchor: 'end',
showValue: true
} ,
{value: 'Food',
axis: 'x',
line: {color: 'green', width: 6,dash: '' },
label: {text: 'Reference Line @:',
font: 'bold 8pt Sans-Serif',
color: 'red' },
anchor: 'end',
showValue: true
}]
*END
ENDSTYLE
END
The output is:
WebFOCUS |