Share your repls and programming experiences

← Back to all posts
SortaGrapher - easy <canvas> graphs
tussiez (1654)

SortaGrapher!

This is a short Repl I wrote in a night or so :D

SortaGrapher makes it easy to add graphs to your project.

Quick Setup

Find the entire user guide here: https://replit.com/@sortagames/SortaGrapher/readme.md

First, import the module:

import Grapher from 'https://sortagrapher.sortagames.repl.co/lib.js'

Then, create a new graph:

let myGraph = new Grapher(75,75); // width/height in pixels

// add the canvas!
document.body.appendChild(myGraph.canvas)

Make a data logger:

let logger = new myGraph.Reader(20); // max. data points to show

And finally, graph stuff:

// Only accepts values from 0-1.
// You may need to use .the optional scaling function:
// logger.mapNumber(myValue,minimum,maximum);

logger.log(myValue);

Tip: This uses SortaCanvas, so if you want to draw objects, such as text, along with the graph, use myGraph.sortacanvas.

Enjoy!

Here it is!

Comments
hotnewtop
ch1ck3n (2052)

descrives my heartbeat just perfectly

tussiez (1654)

@ch1ck3n What were you- anyway:
1 2 3
4 5 6
7 8 9

tussiez (1654)

@ch1ck3n

"911, what's your emergency?"
"come"

ch1ck3n (2052)

@tussiez scared monkey noises and even faster heartbeat