Constructor
new Graph(width, height, position, options)
Creates a graph
Name | Type | Default | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
width | number | 200 | Width of the graph | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
height | number | 200 | Height of the graph | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
position | vec | Position of the graph | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
options | object | Other graph options Properties
|
- Source
let graph = new Graph(200, 150, new vec(20, 20), {
maxLength: 800,
title: "Hello graph",
titleSize: 12,
background: "transparent",
lineColor: {
itemA: "#9D436C",
itemB: "#5EA8BA",
},
padding: 10,
scaleRange: [0, 144 * 2],
});
Members
(readonly) enabled :boolean
If the graph is enabled
- boolean
- Source
Methods
setEnabled()
Set if the graph is enabled
- Source
addData(value, nameopt)
Adds value to the graph
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
value | number | Value to add | ||
name | string | <optional> | "default" | Name of line |
- Source
graph.addData(20); // Adds value 20. Only works if you used a string (not object) to set lineColor
graph.addData(102.4, "itemA"); // Adds value 102.4 to the line named itemA