console-scatter-plot

Simple scatter plot generator writing into browser/node console

Usage no npm install needed!

<script type="module">
  import consoleScatterPlot from 'https://cdn.skypack.dev/console-scatter-plot';
</script>

README

console-scatter-plot

Simple scatter plot generator writing into browser/node console

npm install --save console-scatter-plot
import ScatterPlot from 'console-scatter-plot';

var option = {
  xAxis: {
    label: 'xLabel',
    color: 'red'
  },
  yAxis: {
    label: 'yLabel',
    color: 'blue'
  },
  points: [{x: 100, y: 30}]
};

var scatterPlot = new ScatterPlot(option);

var graph = scatterPlot.string(); // get graph as string (without color)
scatterPlot.print(); // print to console

snapshot

demo

option

param default
xAxis label 'x'
min (auto)
max (auto)
length 60
color
flip false
yAxis label 'y'
min (auto)
max (auto)
length 20
color
flip false
points[] x (required)
y (required)
marker '*'
color

color option

  • Browser
    • CSS color style (#f00, rgb(255, 0, 0), red, ...)
  • Node.js
    • black
    • red
    • green
    • yellow
    • blue
    • magenta
    • cyan
    • white
    • gray
    • grey