graph_line
graph_line(x, y, [width=320], [height=200], [padding=20], [graduations], [xmin], [xmax], [ymin], [ymax], [stroke], [weight])
Draw a line graph from two lists of x and y values. The plot is automatically scaled to fit the specified dimensions.
Syntaxe
var x = [0, 1, 2, 3, 4, 5];
var y = [0, 10, 5, 15, 10, 20];
graph_line(x, y, width=400, height=300, padding=30, graduations="#2196F3", stroke="#2196F3", weight=2);
Arguments
| Name | Required | Default | Description |
|---|---|---|---|
x | yes | - | List of x values |
y | yes | - | List of y values |
width | - | 320 | width of graph area |
height | - | 200 | height of graph area |
padding | - | 20 | Internal padding |
graduations | - | - | Color of axes and ticks (e.g. '#000'). If 'none', no graduations. |
xmin | - | - | Override minimum X value |
xmax | - | - | Override maximum X value |
ymin | - | - | Override minimum Y value |
ymax | - | - | Override maximum Y value |
stroke | - | - | Stroke color |
weight | - | - | Stroke weight (thickness) |