Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/deno_chart/deps.ts>CanvasGradient

A graph library for deno. Inspired by Chart.js. A simpler implementation for basic bar graphs that save to an image.
Latest
interface CanvasGradient
import { type CanvasGradient } from "https://deno.land/x/deno_chart@1.1.0/deps.ts";

An opaque object describing a gradient. It is returned by the methods CanvasRenderingContext2D.createLinearGradient() or CanvasRenderingContext2D.createRadialGradient().

Methods

addColorStop(offset: number, color: string): void
addColorStop(offset: number, color: string): void

Adds a color stop with the given color to the gradient at the given offset. 0.0 is the offset at one end of the gradient, 1.0 is the offset at the other end.

Throws an "IndexSizeError" DOMException if the offset is out of range. Throws a "SyntaxError" DOMException if the color cannot be parsed.