Tech Tip: Utility method to modify the SVG graph created from GRAPH
PRODUCT: 4D | VERSION: 14.0 | PLATFORM: Mac & Win
Published On: May 5, 2014
Below is an utility method to modify the SVG graph that can be created using the GRAPH command. It determines which element to modify by the ID of th element passed in the second parameter. Refer to the docs for the list of IDs that are automatically created from the GRAPH command.
// Method: MODIFY_GRAPH // Parameters // $1 - Pointer to the Picture variable containing the graph // $2 - SVG Element ID // $3 - Element's attribute // $4 - Element's value // ---------------------------------------------------- C_POINTER($1;$vGraph) C_TEXT($2;$elem) C_TEXT($3;$attr) C_TEXT($4;$value) $vGraph:=$1 $elem:=$2 $attr:=$3 $value:=$4 $ref:=SVG_Open_picture ($vGraph->) $objectRef:=DOM Find XML element by ID($ref;$elem) SVG_SET_ATTRIBUTES ($objectRef;$attr;$value) SVG EXPORT TO PICTURE($ref;$vGraph->) |
Below is an example of using the method to change the graph's background color to black.
MODIFY_GRAPH(->vPict;"ID_background";"fill";"rgb(0,0,0)") |
For a list of possible attributes that can be modified, refer to the css properties reference in w3schools: http://www.w3schools.com/cssref/.