|
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"; |
| 1 | +const express = require("express"); |
| 2 | +const { PNG } = require("pngjs"); |
| 3 | +const { |
| 4 | + lightningChart, |
| 5 | + renderToPNG, |
| 6 | +} = require("@lightningchart/lcjs-headless"); |
| 7 | +const { flatThemeLight } = require("@lightningchart/lcjs-themes"); |
| 8 | +const { ColorRGBA, SolidFill } = require("@lightningchart/lcjs"); |
5 | 9 |
|
6 | 10 | const app = express(); |
7 | 11 | const port = 3000; |
8 | 12 |
|
9 | 13 | 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 | | - }); |
| 14 | + const lc = lightningChart({}); |
19 | 15 | const chart = lc.ChartXY({ theme: flatThemeLight }); |
| 16 | + chart.setSeriesBackgroundFillStyle( |
| 17 | + new SolidFill({ color: ColorRGBA(255, 0, 0) }) |
| 18 | + ); |
20 | 19 | const chartOutput = renderToPNG(chart, 800, 640); |
21 | 20 | const outputBuff = PNG.sync.write(chartOutput); |
22 | 21 | res.setHeader("Content-Type", "image/png"); |
|
0 commit comments