graph2table
v0.1.1
Published
Client for the graph2table API: send a chart image, get the data table.
Maintainers
Readme
graph2table
JavaScript client for the graph2table API. Send a chart image, get the data table.
graph2table automatically extracts the data table from a chart image.
Install
npm install graph2tableNode 18 or newer. No dependencies. Also works in the browser with a File or Blob.
Use
import { convert } from "graph2table";
const result = await convert("figure.png", { apiKey: "YOUR_API_KEY" });
result.headers // ['x', 'Series A', 'Series B']
result.rows[0] // { x: 0, 'Series A': 12.4, 'Series B': 9.1 }
result.toCsv() // 'x,Series A,Series B\n0,12.4,9.1\n...'Get an API key at https://graph2table.com/app/keys. In Node, set the GRAPH2TABLE_API_KEY environment variable to skip the apiKey option.
The image can be a file path (Node), a Buffer or Uint8Array, or a Blob or File. PNG, JPG and WebP up to 10 MB.
To focus the extraction, pass customInstructions: "Extract only the red series".
Errors throw Graph2TableError with status and the API message.
Check the result
Open the same image at https://graph2table.com/converter to see every extracted point drawn on the chart, and correct a point before you export.
Links
- API reference: https://graph2table.com/docs/api
- Accuracy and released data: https://graph2table.com/blog/chartx-technical-report
