Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

1 Commit

Repository files navigation

ShadePlot License: MIT

Render charts to PNG files using WebGPU and Deno.

Light SimpleDark Simple
Light — SimpleDark — Simple
Light FullDark Full
Light — Title + LegendDark — Title + Legend

Requirements

  • Deno (v2.5.0 or higher recommended)
  • WebGPU Compatible Hardware (GPU with WebGPU support)
  • Git (for cloning the repository)

Installation

# Clone the repository
git clone https://github.com/NeaByteLab/ShadePlot.git
# Enter the project directorycd ShadePlot/

Usage Example

importshadeplotfrom'@neabyte/shadeplot'awaitshadeplot({canvas: {width: 1280,height: 720,style: 'dark'},layout: {title: 'Monthly Performance',showLegend: true,legendPosition: 'top-right'},series: [{label: 'Revenue',data: [{x: 1,y: 42},{x: 2,y: 58},{x: 3,y: 71}],color: '#3b82f6',line: {width: 2,dash: 'solid'},marker: {show: true,size: 5}},{label: 'Expenses',data: [{x: 1,y: 80},{x: 2,y: 85},{x: 3,y: 92}],color: '#f43f5e',line: {width: 2,dash: 'dash'},marker: {show: true,size: 5}}],output: './chart.png'})

API Reference

shadeplot(options)

shadeplot(options: ShadePlotOptions): Promise<void>
  • Returns: Promise<void> — resolves when the PNG file is written.
  • Throws: Error if canvas dimensions are <= 0 or any series data is empty.

ShadePlotOptions

FieldTypeRequiredDescription
canvasCanvasCanvas size and color theme
layoutLayoutTitle and legend configuration
seriesSeries[]One or more data series to render
outputstringOutput PNG file path

Canvas

FieldTypeRequiredDescription
widthnumberCanvas width in pixels
heightnumberCanvas height in pixels
style'dark' | 'light'Color theme

Layout

FieldTypeDefaultDescription
titlestringChart title, centered in header
showLegendbooleanfalseShow legend in header
legendPosition'top-left' | 'top-right''top-left'Horizontal legend alignment

Series

FieldTypeRequiredDescription
labelstringSeries name shown in legend
dataArray<{ x: number; y: number }>Data points to plot
colorstringHex color string (e.g. #3b82f6)
lineLineOptionsLine style options
markerMarkerOptionsMarker style options

LineOptions

FieldTypeDefaultDescription
widthnumber2Line width in pixels
dash'solid' | 'dash' | 'dot''solid'Line dash style

MarkerOptions

FieldTypeDefaultDescription
showbooleanfalseShow circle marker at each point
sizenumber4Marker diameter in pixels

License

This project is licensed under the MIT license. See the LICENSE file for more info.