SetXLabelType

SetXLabelType — Set formatting type for X tick and data labels

Synopsis

$plot->SetXLabelType($xlt)
    

Description

SetXLabelType sets the formatting type for X tick and data labels. By default, there is no special formatting, so the labels are output as-is. Other choices are 'data' and 'time'.

'data' formatting formats the labels as floating point numbers, with digits grouped into thousands (3 digit groups), and with precision set by SetPrecisionX.

'time' formatting formats the labels as date/time values, using a format specifier set by SetXTimeFormat.

Parameters

$xlt

A string indicating the desired formatting mode: 'data' or 'time'.

Notes

The default formatting mode is to do no special formatting of the labels. Strings will be output as-is, and numbers will be output using PHP's default formatting.

A side effect of SetPrecisionX is to call this function SetXLabelType and set the formatting mode to 'data'.

Starting with PHPlot-5.0.4, empty string data labels are ignored when formatting with 'data' or 'time' formats. You can use this to suppress some data labels, or control label density, with 'data' and 'time' formatted labels.

Through PHPlot-5.0rc3, empty strings would still be formatted. With 'data' format, an empty string would result in a zero value, and with 'time' format an empty string would cause an error. As a result, with older releases, if you don't want to use data labels when using 'data' or 'time' formats, you must turn off X data label display with SetXDataLabelPos, even if your data array labels are empty strings.

Through PHPlot-5.0rc3, when the formatting mode is 'data' the thousands grouping separator was always a comma, and a period was used as a decimal point. Starting with 5.0.4, PHPlot attempts to get the correct values for your locale. You can set the separator characters yourself instead with SetNumberFormat.