# Table of Contents
# Plot
Graphs plots from the pre module.
Import it with:
const plots = require('@epispot/epijs').plots
# plot
Plots a output of a model from the pre module.
# Parameters
modelArray (opens new window) The output from the pre module function.canvasHTMLCanvasElement (opens new window) The canvas to show the output.daysNumber (opens new window) The amount of days to plotcolorsArray (opens new window) Custom colors for the graph, in the same order the compartments are. (optional, defaultnull)optionsObject (opens new window) Optional. Custom configuration to pass into the options parameter for chart.js, defaults to:
{
title: {
display: true,
text: "Total Cases"
},
scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}]
}
}
# Examples
let sirout1 = sir(4, 9999, 1000, 100, 1/21, 10999, true)
plot(sirout1, "canvas-pre1", 100) // Plots data for 100 days onto the canvas-pre1 chart, with the data from the SIR model.
Returns any Returns the chart.js chart, if needed for modification.
# manipulate
Manipulate the chart.js graph
# Parameters
idThe chart.js graphmvalueString (opens new window) The value to manipulate inchart.data.datasets[x]. This can be any valid chart.js parameter. See https://www.chartjs.org/docs/latest/charts/line.html#line-styling (opens new window)valueThe value to insert into the graph
# Examples
let sirout1 = sir(4, 9999, 1000, 100, 1/21, 10999, true)
let sirplot = plot(sirout1, "canvas-pre1", 100)
sirplot.manipulate(sirplot, "fill", true) // Set fill to true
Returns any The chart.js graph