Installation
Setting up an app for SciTrader takes three steps:
- install the packages;
- import the stylesheet;
- serve SciChart's WebAssembly files.
Step 3 depends on your bundler, so this page has an example for each of the common ones.
Install the packages
# Plain TypeScript or JavaScript
npm install scichart-scitrader scichart scichart-financial-tools rxjs
# React: add these as well
npm install scichart-scitrader-react react react-dom
Why so many? scichart-scitrader relies on SciChart, but doesn't bring its own copy.
scichart, scichart-financial-tools and rxjs are peer dependencies: your app installs them, and the SDK uses your copy.
An app must have exactly one copy of SciChart, because SciChart keeps global state: the licence, the loaded WebAssembly engine, and the registry used when charts are saved and restored.
Peer dependencies make sure the SDK and your own chart code share that copy. They also let you choose its version.
scichart-scitrader-react works the same way with react, react-dom and scichart-scitrader.
| Package | Version |
|---|---|
scichart | 6.0.14 or later 6.x |
scichart- | 6.0.14 or later 6.x. |
rxjs | 7.5.5 or later. Earlier 7.x releases have no TypeScript types for modern module resolution. |
react, react- | 16.14 or later |
The SDK's own dependencies (idb, technicalindicators) install automatically.
You need a bundler. The packages ship as ES modules (esm/) and CommonJS (cjs/), with TypeScript types in types/. They import their own files without file extensions, which a bundler resolves and a browser can't. The examples below cover webpack, Vite, esbuild, Rollup and Parcel. Any bundler that understands node_modules works.
Import the stylesheet
Import it once, next to your first import of the SDK:
import "scichart-scitrader/scitrader.css";
It gives the SDK's toolbars, pane controls, menus and overlays their look (Styling). It is plain CSS, and the SDK's JavaScript never imports it, so your bundler handles it like any other CSS file. Without a bundler, link node_modules/scichart-scitrader/styles/scitrader.css from your page.
Serve SciChart's WebAssembly
SciChart draws with a WebAssembly engine. Your bundler bundles SciChart's JavaScript, but not the engine: the browser downloads that as a separate file when the first chart is created. You have to serve it, and SciChart has to know its URL.
The files are in node_modules/scichart/_wasm/:
| File | Size (gzipped) | Loaded |
|---|---|---|
scichart. | 0.8 MB | In browsers with WebAssembly SIMD (every major browser since 2023) |
scichart- | 0.8 MB | Instead of scichart., in older browsers without SIMD |
scichart- | 0.8 MB | Only if you opt in to 64-bit memory (Sci) |
scichart- | 0.25 MB each | Only for SciChart 3D charts; SciTrader doesn't use them |
Serve all the files in
_wasm/. Copy the whole folder into your build. SciChart picks the one file it needs for each browser, based on what that browser supports, so a user only downloads one of them. Serving every file means each browser finds the right one.
Where SciChart looks
By default SciChart requests scichart.wasm with a relative path, so the browser resolves it against the page's URL, not the script's. On a page at /charts/btc, that's /charts/scichart.wasm.
So unless every page sits at the root, tell SciChart where the file is before the first chart is created. Start the path with a forward slash to make it absolute, from the root of your site:
import { SciChartSurface } from "scichart";
// Leading "/": always /scichart.wasm, whatever the page's URL
SciChartSurface.configure({ wasmUrl: "/scichart.wasm" });
If your app also uses scichart-react, note that importing it sets wasmUrl to /scichart.wasm, at import time. To use a different URL, call configure after that import.
SciChart finds scichart-nosimd.wasm and scichart-64.wasm from the same URL, by adding -nosimd or -64 to the name. If your bundler renames files (Vite and Parcel add content hashes), pass wasmNoSimdUrl too, as in their examples below.
If the file can't be loaded, chart creation fails with "Could not load SciChart WebAssembly module". Look for a 404 on scichart.wasm in the browser's network tab: the URL it shows is where SciChart looked.
Deploying Wasm in the SciChart.js docs has more detail, including framework boilerplates and loading the files offline.
webpack
Copy the folder into the build with copy-webpack-plugin:
// webpack.config.js
const CopyWebpackPlugin = require("copy-webpack-plugin");
const path = require("path");
const scichartWasm = path.join(path.dirname(require.resolve("scichart/package.json")), "_wasm");
module.exports = {
// …
plugins: [new CopyWebpackPlugin({ patterns: [{ from: scichartWasm, to: "" }] })],
};
The files land next to your bundle, at /scichart.wasm if you serve the build from the root. Set wasmUrl to that.
Vite
Vite needs no copy step. Import each file's URL with ?url; Vite copies the file into the build and returns its final, hashed URL:
import { SciChartSurface } from "scichart";
import wasmUrl from "scichart/_wasm/scichart.wasm?url";
import wasmNoSimdUrl from "scichart/_wasm/scichart-nosimd.wasm?url";
SciChartSurface.configure({ wasmUrl, wasmNoSimdUrl });
This works in the dev server and in production builds. In TypeScript, ?url imports need Vite's client types: add /// <reference types="vite/client" /> to a .d.ts file in your project (Vite's templates include one).