NOTE: Items in bold red represent patches that may or may not be added to OFC-2.
Defines the attributes for the Y Axis of the chart. This includes the Y Axis itself, the horizontal grid lines, tick marks and the labels. Formatting of the Y Axis Labels in OFC2 is provided via the “label_style” objects.
This is an example for the LEFT Y Axis using the current automatic label generation:
“y_label__label_style”:”12,#DD3030”,
"y_axis":{"min":0, "max":5, "stroke":2, "tick-height":3,
“colour”:”#784016”, “offset”:true, “grid-colour”:”#F5E1AA”,
"3d":0, "steps":1
},
This is an example for the LEFT Y Axis using the current method of providing an array of strings for the labels:
“y_label__label_style”:”12,#DD3030”,
"y_axis":{"min":0, "max":5, "stroke":2, "tick-height":3,
“colour”:”#784016”, “offset”:true, “grid-colour”:”#F5E1AA”,
"3d":0, "steps":1,
"labels": [“Jan”, “Feb”, “Mar”, “Apr”, “May” ] },
},
This is an example for the LEFT Y Axis using the patch that allows further definition of the labels:
“y_label__label_style”:”12,#DD3030”,
"y_axis":{"min":0, "max":5, "stroke":2, "tick-height":3,
“colour”:”#784016”, “offset”:true, “grid-colour”:”#F5E1AA”,
"3d":0, "steps":1,
"labels":{"rotate":”vertical”, ”size”:10, ”steps”:1, “visible-steps”:3,
"labels":[“Jan”, {text:“Feb”, “size”:12, “colour”:”#FF0000”},
“Mar”, “Apr”, “May” ] },
},
This is an example for the RIGHT Y Axis (the definition is exactly the same as for “y_axis” and “y_label__label_style”):
“y_label_2__label_style”:”10,#30DD30”,
"y_axis_right":{"min":0, "max":5, "stroke":2, "tick-height":3,
“colour”:”#784016”, “offset”:true, “grid-colour”:”#F5E1AA”,
"3d":0, "steps":1,
"labels":{"rotate":”vertical”, ”size”:10, ”steps”:1, “visible-steps”:3,
"labels":[“Jan”, {text:“Feb”, “size”:12, “colour”:”#FF0000”},
“Mar”, “Apr”, “May” ] },
},
This is the definition of the “y_label__label_style” top level string attribute. Note that the definition of “y_label_2__label_style” is exactly the same as “y_label__label_style” which is detailed here.
|
OBJECT |
ATTRIBUTE |
VALID VALUES |
DEFAULT |
NOTES |
|
|
“y_label__label_style” |
“none” “<font size>” “<font size>,<colour>” |
undefined |
“none” - do not show labels
“<font size>” - sets the font size of the label
“<font size>,<colour>” - sets both the font size and the colour of the label |
This is the definition of the “y_axis” object. Note that the definition of “y_axis_right” is exactly the same as “y_axis” which is detailed here.
|
OBJECT |
ATTRIBUTE |
VALID VALUES |
DEFAULT |
NOTES |
|
“y_axis” |
|
|
|
* This definition is exactly the same for “y_axis_right” |
|
|
“min” |
Any value |
0 |
The X value at the point where the Y Axis meets the Y axis in the lower left corner |
|
|
“max” |
Any value |
undefined |
If “max” is not specified then it will be automatically determined by the data being plotted. |
|
|
“stroke” |
0 to n |
2 |
Width in pixels of the axis line. Zero (0) is a hairline. |
|
|
“tick-length” |
0 to n |
3 |
Specifies the length of the tick marks in pixels. Zero (0) means do not draw the tick mark. If set to zero allows the grid line to be drawn without the tick mark. |
|
|
“colour” |
“#RRGGBB” hex string |
“#784016” |
Colour for the axis line. Default is a brownish. |
|
|
“grid-colour” |
“#RRGGBB” hex string |
“#F5E1AA” |
Colour for the background of the chart area. Default is a beige (?). |
|
|
“grid-visible” |
true or false |
true |
Defines whether or not to display the grid lines and tick marks |
|
|
“3d” |
0 to n |
0 |
Not currently used with the Y Axis |
|
|
“steps” |
1 to n |
1 |
Specifies how many steps between grid lines. One (1) means a grid line at every value. Two (2) means a grid line at every other value. Etc. |
|
|
“offset” |
true or false |
true |
Specifies whether or not there should be a small gap between the X Axis and the minimum Y point. |
|
|
“labels” |
Array of strings to be displayed as labels [...]
or
Object describing the text labels {...} |
undefined |
An array strings which are the labels to be displayed
* See label_style definition for formatting Y Axis Labels in the official OFC2
or
An object that further defines labels attributes and labels |
Definition of the the “labels” object within the “y_axis” object.
|
OBJECT |
ATTRIBUTE |
VALID VALUES |
DEFAULT |
NOTES |
|
“labels” |
|
|
|
|
|
|
“colour” |
“#RRGGBB” hex string |
“#000000” |
Defines the color of the label text. Default is black. |
|
|
“text” |
user defined text |
“#val#” |
Specifies the default label text for the Y axis labels* ** The #val# magic value allows for inserting the Y value as desired in the label. * Four magic values are available for use with unix timestamps: #date#, #date:___#, #gmdate# and #gmdate:___#.** ** See the date formatting section below |
|
|
“size” |
6 to n |
10 |
Defines the font size of the label |
|
|
“steps” |
1 to n |
1 |
Defines number of steps between the labels to be created. |
|
|
“rotate” |
“vertical” |
undefined |
Specifies if the label should be rotated vertically or not. |
|
|
“show_labels” |
true or false |
true |
Whether or not the labels should be visible |
|
|
“labels” |
Array of strings and/or objects defining each label |
[...] |
If no labels are defined then labels will be generated automatically based on the “steps” value with the text being the Y value at each point. * Each label object can override any of the above attributes |
Definition of the array of “labels” objects within the “labels” object in the “y_axis” object. The label objects with in the “labels” array can be either just a text string or another object with attributes specified for an individual label. Below is the definition of the attributes that are valid for one of these label objects.
|
OBJECT |
ATTRIBUTE |
VALID VALUES |
DEFAULT |
NOTES |
|
label objects |
|
|
|
Label objects that can be in the “labels” array |
|
|
“colour” |
“#RRGGBB” hex string |
“#000000” |
Defines the color of the label text. Default is black. |
|
|
“size” |
6 to n |
10 |
Defines the font size of the label |
|
|
“rotate” |
“vertical” |
undefined |
Specifies if the label should be rotated vertically or not. |
|
|
“y” |
Numeric value |
undefined |
* Specifies the Y Value where a grid line and label should be displayed. |
|
|
“text” |
user defined text |
“#val#” |
Specifies the default label text for the Y axis labels* ** The #val# magic value allows for inserting the Y value as desired in the label. * Four magic values are available for use with unix timestamps: #date#, #date:___#, #gmdate# and #gmdate:___#.** ** See the date formatting section below |
Replacement variables can be used in the definition of tool tips and labels so that each one does not have to be individually defined. When the text is actually displayed, the variables below will be replaced with its appropriate value (assuming the variable is valid in the context it is used).
|
Magic Value |
Description |
|
#date# |
Formats the Y Value as a date string using the local time with format Y-m-d such as: 2008-10-23 |
|
#date:_____# |
Formats the Y Value as a date/time string using the local time with user defined formatting. * See Date Formatting below |
|
#gmdate# |
Formats the Y Value as a date string using GMT/UTC time with format Y-m-d such as: 2008-10-23 |
|
#gmdate:_____# |
Formats the Y Value as a date/time string using GMT/UTC time with user defined formatting. This is useful for formatting elapsed time in hours, minutes and seconds. * See Date Formatting below |
|
#ygmdate# |
Same as #gmdate# in this context |
|
#ygmdate:_____# |
Same as #gmdate:_____# in this context |
|
#val# |
Inserts the Y Value into the label text at the indicated location(s). |
The user defined date format is implemented to match the formatting performed by the PHP date function. The following table lists the valid format characters and their descriptions.
|
Format Character |
Description |
Example returned Values |
|
Day |
|
|
|
d |
Day of the month, 2 digits with leading zeros |
01 to 31 |
|
D |
A textual representation of the day, three letters |
Mon through Sun |
|
j |
Day of the month without leading zeros |
1 to 31 |
|
l (lower case L) |
A full textual representation of the day of the week |
Sunday through Saturday |
|
N |
ISO-8601 numeric representation of the day of the week |
1 (for Monday) through 7 (for Sunday) |
|
S |
English ordinal suffix for the day of the month, 2 characters |
st, nd, rd or th. Works well with j |
|
w |
Numeric representation of the day of the week |
0 (for Sunday) through 6 (for Saturday) * Not Implemented |
|
z |
The day of the year (starting from 0) |
0 through 365 * Not Implemented |
|
Week |
|
|
|
W |
ISO-8601 week number of year, weeks starting on Monday |
Example: 42 (the 42nd week in the year) * Not Implemented |
|
Month |
|
|
|
F |
A full textual representation of a month |
January through December |
|
m |
Numeric representation of a month, with leading zeros |
01 through 12 |
|
M |
A short textual representation of a month, three letters |
Jan through Dec |
|
n |
Numeric representation of a month, without leading zeros |
1 through 12 |
|
t |
Number of days in the given month |
28 through 31 * Not Implemented |
|
Year |
|
|
|
L |
Whether its a leap year |
1 if it is a leap year, 0 otherwise * Not Implemented |
|
o |
ISO-1806 year number. This has the same value as Y, except that if the ISO week number (W) belongs to the previous or next year, that year is used instead. |
* Not Implemented |
|
Y |
A full numeric representation of a year, 4 digits |
Examples: 1999 or 2003 |
|
y |
A two digit representation of a year |
Examples: 99 or 03 |
|
Time |
|
|
|
a |
Lower case Ante meridiem and Post meridiem |
am or pm |
|
A |
Upper case Ante meridiem and Post meridiem |
AM or PM |
|
B |
Swatch Internet time |
000 through 999 * Not Implemented |
|
g |
12-hour format of an hour without leading zeros |
1 though 12 |
|
G |
24-hour format of an hour without leading zeros |
0 through 23 |
|
h |
12-hour format of an hour with leading zeros |
01 through 12 |
|
H |
24-hour format of an hour with leading zeros |
00 through 23 |
|
i |
Minutes with leading zeros |
00 through 59 |
|
s |
Seconds with leading zeros |
00 through 59 |
|
u |
Microseconds |
Example: 54321 * Not Implemented |
|
Timezone |
|
|
|
e |
Timezone identifier |
Examples: UTC, GMT * Not Implemented |
|
I |
Whether or not the date in in daylight saving time |
1 if Daylight Saving Time, 0 otherwise * Not Implemented |
|
O |
Difference to Greenwich time (GMT) in hours |
Example: +0200 |
|
P |
Difference to Greenwich time (GMT) in hours with colon between hours and minutes |
Example: +02:00 * Not Implemented |
|
T |
Timezone abbreviation |
Examples: EST, MDT * Not Implemented |
|
Z |
Timezone offset in seconds. The offset for timezones west of UTC is always negative, and for those east is always positive. |
-43200 through 50400 |
|
Full Date.Time |
|
|
|
c |
ISO 8601 date |
Example: 2004-02-12T15:19:21+00:00 * Not Implemented |
|
r |
RFC 2822 formatted date |
Example: Thu, 21 Dec 2000 16:0107 +0200 |
|
U |
Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT) |
Example: 1185080400 is July 22 2007 00:00:00 |
Any character that is not one of the above format characters is printed as-is.
* Escaping a format character with a backslash so that is passes through and prints is Not Implemented
Examples:
#date:Y-m-d at H:i# would format as 2008-09-18 at 09:46
#date:g:i:s a# would format as 2:14:52 pm
#gmdate:H:i# would format as 02:14