Skip to content

Commit

Permalink
Add simple test app
Browse files Browse the repository at this point in the history
  • Loading branch information
Niilo Keinänen committed Aug 5, 2024
1 parent 22263dc commit e1f452f
Show file tree
Hide file tree
Showing 4 changed files with 3,029 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
registry=https://registry.npmjs.org/
@lightningchart:registry=https://registry.npmjs.org/
29 changes: 29 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import express from "express";
import { PNG } from "pngjs";
import { lightningChart, renderToPNG } from "@lightningchart/lcjs-headless";
import { flatThemeLight } from "@lightningchart/lcjs-themes";

const app = express();
const port = 3000;

app.get("/", (req, res) => {
const lc = lightningChart({
// Valid until 8/6/2024
license:
"0002-n6Q3wipxRCPK7PHm1Z1p6PdhNNqeKwClN/s+aUwl3vT54A0lse0e9Ryv9JY4YzR8avVBVjTpcgbR7Q8DS2egZAHn-MEUCIQC87Etz4Jn4NLyctnrTCjVOHKsy7VSxa99DG6arbb1RfgIgZKtGhZpmATUsBZ6fkq834+Sq137gFyv7lsz3OVndGvA=",
licenseInformation: {
appTitle: "LightningChart JS Trial",
company: "LightningChart Ltd.",
},
});
const chart = lc.ChartXY({ theme: flatThemeLight });
const chartOutput = renderToPNG(chart, 800, 640);
const outputBuff = PNG.sync.write(chartOutput);
res.setHeader("Content-Type", "image/png");
res.setHeader("Content-Length", outputBuff.length);
res.send(outputBuff);
});

app.listen(port, () => {
console.log(`Example app listening at http://localhost:${port}`);
});
Loading

0 comments on commit e1f452f

Please sign in to comment.