Skip to content

Commit e1f452f

Browse files
author
Niilo Keinänen
committed
Add simple test app
1 parent 22263dc commit e1f452f

File tree

4 files changed

+3029
-0
lines changed

4 files changed

+3029
-0
lines changed

test/.npmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
registry=https://registry.npmjs.org/
2+
@lightningchart:registry=https://registry.npmjs.org/

test/index.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import express from "express";
2+
import { PNG } from "pngjs";
3+
import { lightningChart, renderToPNG } from "@lightningchart/lcjs-headless";
4+
import { flatThemeLight } from "@lightningchart/lcjs-themes";
5+
6+
const app = express();
7+
const port = 3000;
8+
9+
app.get("/", (req, res) => {
10+
const lc = lightningChart({
11+
// Valid until 8/6/2024
12+
license:
13+
"0002-n6Q3wipxRCPK7PHm1Z1p6PdhNNqeKwClN/s+aUwl3vT54A0lse0e9Ryv9JY4YzR8avVBVjTpcgbR7Q8DS2egZAHn-MEUCIQC87Etz4Jn4NLyctnrTCjVOHKsy7VSxa99DG6arbb1RfgIgZKtGhZpmATUsBZ6fkq834+Sq137gFyv7lsz3OVndGvA=",
14+
licenseInformation: {
15+
appTitle: "LightningChart JS Trial",
16+
company: "LightningChart Ltd.",
17+
},
18+
});
19+
const chart = lc.ChartXY({ theme: flatThemeLight });
20+
const chartOutput = renderToPNG(chart, 800, 640);
21+
const outputBuff = PNG.sync.write(chartOutput);
22+
res.setHeader("Content-Type", "image/png");
23+
res.setHeader("Content-Length", outputBuff.length);
24+
res.send(outputBuff);
25+
});
26+
27+
app.listen(port, () => {
28+
console.log(`Example app listening at http://localhost:${port}`);
29+
});

0 commit comments

Comments
 (0)