-
Notifications
You must be signed in to change notification settings - Fork 96
Core
Trigger file download
-
filename - string
: the filename -
data - string
: the contained data
./src/core/highcharts-editor.js:50
:
download: function (filename, data) {
Clear an object
Deletes all the object attributes. Useful when needing to clear an object without invalidating references to it
-
obj - object
: the object to clear
./src/core/highcharts-editor.js:64
:
clearObj: function (obj) {
Preform an AJAX request. Same syntax as jQuery.
-
p - object
: options-
url (string)
- the URL to call -
type (enum)
- the type of request -
dataType (enum)
- the type of data expected -
success (function)
- function to call on success -
error (function)
- function to call on request fail -
data (object)
- the payload -
autoFire (boolean)
- wether or not to fire the request right away
-
-
on(event, callback)
: Listen for event - returnsfunction
: Can be called to unbind the listener-
event
:string
, The event to listen for -
callback
:function
, Function to call when the event is emitted
-
-
Error
: when there's an error -
OK
: when the request succeeded
object
- interface to the request
./src/core/highcharts-editor.js:84
:
ajax: function (p) {
Generate a uuid
Borrowed from http://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript
string
- a UUID string
./src/core/highcharts-editor.js:163
:
uuid: function () {
Map an array to an object
-
arr - array
: the array to map
object
- an object with the array contents as keys, and their value set to true
./src/core/highcharts-editor.js:182
:
arrToObj: function (arr) {
Make a camel back string pretty
Transforms e.g. imACamelBackString
to Im a camelback string
.
-
str - string
: the input string
string
- the transformed string
./src/core/highcharts-editor.js:205
:
uncamelize: function (str) {
Clamp a number between min/max
-
min - number
: minimum value -
max - number
: maximum value -
value - number
: the value to clamp
number
- the clamped value
./src/core/highcharts-editor.js:240
:
clamp: function (min, max, value) {
Convert a hex value to RGB
-
hex - string
: the hex string
object
- an object with rgb components
./src/core/highcharts-editor.js:255
:
hexToRgb: function (hex) {
Invert a color
-
hex - string
: the color to invert
string
- new hex color
./src/core/highcharts-editor.js:270
:
invertHexColor: function (hex) {
Return #FFF or #000 based on the intensity of a color
-
hex - string
: input color
string
- the new hex color
./src/core/highcharts-editor.js:290
:
getContrastedColor: function (hex) {
Convert a string to a bool
-
what - string
: the string to convert
bool
- the resulting bool
./src/core/highcharts-editor.js:305
:
toBool: function (what) {
Set a property based on -- delimited path
-
obj - object
: the object to modify -
path - string
: the path to the attribute to change -
value - anything
: the value to set -
index - number
: if we're accessing an array, this is the index
./src/core/highcharts-editor.js:315
:
setAttr: function (obj, path, value, index) {
Get a property based on -- delimited path
-
obj - object
: the object to traverse -
path - string
: the path to the attribute to get -
index - number
: if we're accessing an array, this is the index
anything
- the value or false
./src/core/highcharts-editor.js:359
:
getAttr: function (obj, path, index) {
Deep merge two objects.
Note: this modifies object a
!
-
a - object
: the destination object -
b - object
: the source object
object
- argument a
./src/core/highcharts-editor.js:402
:
merge: function (a, b) {
Check if something is null or undefined
-
what - anything
: the value to check
bool
- true if nulll
./src/core/highcharts-editor.js:432
:
isNull: function (what) {
Check if something is a string
-
what - anything
: the value to check
bool
- true if string
./src/core/highcharts-editor.js:440
:
isStr: function (what) {
Check if something is a number
-
what - anything
: the value to check
bool
- true if number
./src/core/highcharts-editor.js:448
:
isNum: function(what) {
Check if a value is a function
-
what - anything
: the value to check
bool
- true if function
./src/core/highcharts-editor.js:456
:
isFn: function (what) {
Check if a value is an array
-
what - anything
: the value to check
bool
- true if array
./src/core/highcharts-editor.js:464
:
isArr: function (what) {
Check if a value is a boolean
-
what - anything
: the value to check
bool
- true if bool
./src/core/highcharts-editor.js:472
:
isBool: function (what) {
Check if a value is a basic type
A basic type is either a bool, string, or a number
-
what - anything
: the value to check
bool
- true if basic
./src/core/highcharts-editor.js:481
:
isBasic: function (what) {
Set an option
Skip value
to get the value
-
option - string
: the option to set -
value - anything
: the value to set
anything
- the option value
./src/core/highcharts-editor.js:536
:
highed.option = function (option, value) {
Add a function to call when the document is ready
-
fn - function
: the function to call
./src/core/highcharts-editor.js:548
:
highed.ready = function (fn) {
Log something
Accepts a variable amount of arguments after level
which will be
the log message (similar to console.log
).
-
level - number
: the log level 1..4
./src/core/highcharts-editor.js:562
:
highed.log = function (level) {
Set the current log level
-
level - number
: the current log level
./src/core/highcharts-editor.js:573
:
highed.setLogLevel = function (level) {
Include something
-
what - string
: URL to a css or javascript file -
fn - function
: function to call when done including the script -
asCSS - boolean
: force including as css
./src/core/highcharts-editor.js:584
:
highed.include = function (what, fn, asCSS) {
Returns true if running on a phone
boolean
- true if running on a phone
./src/core/highcharts-editor.js:626
:
highed.onPhone = function () {
Event dispatcher object
Constructs an instance of an event dispatcher when called.
var events = highed.events();
events.on("foobar", function() {
console.log("Hello world!");
});
events.emit("foobar");
-
on(event, callback, context)
: Listen to an event - returnsfunction
: function that can be called to unbind the listener-
event
:string
, the event to listen for -
callback
:function
, the function to call when the event is emitted -
context
:anything
, the calling context (`this` reference) for the callback
-
-
emit(event)
: Emit an event - returnsnumber
: The number of events dispatched-
event
:string
, the event to emit
-
./src/core/highed.events.js:34
:
highed.events = function () {
Upload and parse a local file
Borrowed from almostvanilla which is licensed under MIT.
-
props - object
: the upload settings-
type (string)
- the type of data to load -
accept (string)
- the accepted file extensions -
multiple (boolean)
- allow multiple files -
progress (function)
- progress callback-
{number} (number)
- the progress in percent -
success (function)
- function called when the file is uploaded-
{object} (object)
- the file information-
filename (string)
- the name of the file -
size (number)
- the size of the file in bytes -
data (string)
- the file data
-
-
-
-
./src/core/highed.fileupload.js:58
:
highed.readLocalFile = function (props) {
Get a localized string based on the current global language
-
id - string
: the ID of the string to get
./src/core/highed.localization.js:64
:
highed.getLocalizedStr = function (id) {
Set the active langauge
-
lang - string
: the language to activate
boolean
- true if the language exists, and was applied
./src/core/highed.localization.js:92
:
highed.setLang = function (lang) {
Install a new template
highed.installTemplate("custom", {
title: "My company template",
tooltipText: "Company template: requires no particular data",
config: {
"chart--title": "Copany Chart"
}
});
-
type - string
: template type:line area column bar scatter pie polar stock
-
def - object
: the template definition-
title (string)
- the template title -
config (object)
- the highcharts attributes -
tooltipText (string)
- the tooltip text
-
./src/core/highed.templateman.js:45
:
highed.installTemplate = function(type, def) {
Add a new template type
If the type allready exists, nothing will happen
highed.addTemplateType("custom", "My company templates");
-
type - string
: the type id -
title - string
: the title as it appears in the category list
./src/core/highed.templateman.js:71
:
highed.addTemplateType = function (type, title) {
Add a set of templates
highed.installMultipleTemplates([ {
type: "line",
template: {
title: "My Line Template",
config: {}
}
} ]);
-
templates - array
: an array of templates
./src/core/highed.templateman.js:94
:
highed.installMultipleTemplates = function (templates) {
Check if a node is visible
-
node - domnode
: the node to check
./src/core/highed.dom.js:33
:
isVisible: function (node) {
Append a set of nodes to another node.
Arguments supplied after the @param {} target represents the children to append.
-
target - object
: the node to append to
domnode
- the target
./src/core/highed.dom.js:43
:
ap: function (target) {
Create a set of options for a select
-
select - HTMLSelect
: the dropdown to add options to -
options - (array|object)
: the options as an array or as an object keyed on ID -
selected - number
: the index of the selected option
./src/core/highed.dom.js:73
:
options: function (select, options, selected) {
Show a node when another is hovered
-
parent - object
: the node to listen for the hover on -
child - object
: the node to show when the parent is hovered
./src/core/highed.dom.js:105
:
showOnHover: function (parent, child) {
Create a new HTML node
-
type - string
: the type of node to create -
cssClass - string
: the css class to use for the node -
innerHTML - string
: the inner html of the new node -
id - string
: the id of the new node
domnode
- the new dom node
./src/core/highed.dom.js:141
:
cr: function (type, cssClass, innerHTML, id) {
Style a node
-
nodes - (object|array)
: the node to style. Can also be an array -
style - object
: object containing style properties
anything
- whatever was supplied to @param {} nodes
./src/core/highed.dom.js:172
:
style: function (nodes, style) {
Attach an event listener to a dom node
-
target - object
: the dom node to attach to -
event - string
: the event to listen for -
callback - function
: the function to call when the event is emitted -
context - object
: the context of the callback function
function
- a function that can be called to unbind the handler
./src/core/highed.dom.js:198
:
on: function (target, event, callback, context) {
Get or set the value of a node
-
node - object
: the node to get the value of -
value - (string|bool|number)
: the value to set
anything
- the value
./src/core/highed.dom.js:262
:
val: function (node, value) {
Get the size of a node
-
node - object
: the node to get the size of
object
- the size as an object {w, h}
./src/core/highed.dom.js:300
:
size: function (node) {
Get the position of a node
-
node - object
: the node to get the position of -
abs - boolean
: absolute calculation rather than parent relative
object
- the position as an object {x, y}
./src/core/highed.dom.js:312
:
pos: function (node, abs) {
Find a node
-
node - object
: the node to find. Either a string or an actual node instance
object
- the node or false if the node was not found
./src/core/highed.dom.js:337
:
get: function (node) {
Overview
Stand-alone Usage
Advanced
- Enable Advanced Customization
- Choosing Which Options to Include
- Adding Custom Templates
- Plugins
- Disabling Editor Features
- Adding Fonts
- Custom Templates
- Localization
- Sticky Chart Options
Integrating
API Reference