Skip to content

Methods

Jonathan Simmonds edited this page Jan 14, 2021 · 6 revisions

Classes

GrapheneEngine

addLinegraph(element, properties, data, axisFormatter, informationFormatter), addBargraph(element, properties, data, axisFormatter, informationFormatter) - adds a line/bar graph to the engine that is positioned in element with defined properties, displaying data, axis labels formatting (dependent on interval) handled by axisFormatter and information label formatting handled by informationFormatter

axisFormatter(value, interval) - value is the raw X value, interval is the distance between this label and the next one on the X axis, function should return a string to be displayed below the X axis

informationFormatter(value) - value is the raw X value, function should return a string to be displayed on the information panel

render - draws all graphs that have been added to the engine but have not yet been drawn

getGraph(element) - retrieves a graph positioned in element

removeGraph(element) - removes a graph positioned in element

GrapheneLinegraph

updateData(data, properties) - replaces data, replaces properties (if supplied) and redraws the graph

addHorizontalData(data, properties) - adds data to each data set, replaces properties (if supplied) and redraws the graph

Example data

{
    "x":["Mon", "Tue", "Wed", "Thu"],
    "y":[[23, 26, 25, 26], [13, 14, 20, 18]],
    "u":[[1, 2, 2, 3]]
}

addVerticalData(data, properties) - adds new data sets, replaces properties (if supplied) and redraws the graph

Example data

{
    "names": ["Svalbard", "Faro", "Fort William"],
    "y":[[23, 26, 25, 26], [13, 14, 20, 18]],
    "u":[[1, 2, 2, 3]]
}
Clone this wiki locally