Skip to content

Commit

Permalink
chore(documentation) updating Nuxt.js and Browser global module to us…
Browse files Browse the repository at this point in the history
…e libraryVersion in CDN loading
  • Loading branch information
andyb1979 committed Mar 10, 2022
1 parent c7ee61f commit 5137f3c
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 12 deletions.
16 changes: 13 additions & 3 deletions Sandbox/demo-browser-global-module/README.md
Expand Up @@ -13,15 +13,25 @@ Please note to use scichart.js you need to have a server to serve html. Just ope

1. Add script pointing to a specific version into the **head** section of your html file. For instance to add version `2.1.2261` add this script:
```html
<script src="https://cdn.jsdelivr.net/npm/scichart@2.1.2261/_wasm/scichart.browser.js" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/scichart@2.1.2290/_wasm/scichart.browser.js" crossorigin="anonymous"></script>
```
2. Configure SciChartSurface to download .data and .wasm files from the CDN. Library versions in the script and in the configure method must be the same!
```typescript
SciChart.SciChartSurface.configure({
dataUrl: "https://cdn.jsdelivr.net/npm/scichart@2.1.2261/_wasm/scichart2d.data",
wasmUrl: "https://cdn.jsdelivr.net/npm/scichart@2.1.2261/_wasm/scichart2d.wasm"
dataUrl: "https://cdn.jsdelivr.net/npm/scichart@2.1.2290/_wasm/scichart2d.data",
wasmUrl: "https://cdn.jsdelivr.net/npm/scichart@2.1.2290/_wasm/scichart2d.wasm"
});
```

Note: For newer versions of SciChart we have included the library version as a field, so you can use code like this instead to avoid version mismatches:

```typescript
SciChart.SciChartSurface.configure({
dataUrl: `https://cdn.jsdelivr.net/npm/scichart@${SciChart.libraryVersion}/_wasm/scichart2d.data`,
wasmUrl: `https://cdn.jsdelivr.net/npm/scichart@${SciChart.libraryVersion}/_wasm/scichart2d.wasm`
});
```
```
3. Create a chart
4. Serve the html file to get this result
Expand Down
2 changes: 1 addition & 1 deletion Sandbox/demo-browser-global-module/src/client/index.html
Expand Up @@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Include SciChart.js -->
<script
src="https://cdn.jsdelivr.net/npm/scichart@2.1.2261/_wasm/scichart.browser.js"
src="https://cdn.jsdelivr.net/npm/scichart@2.1.2290/_wasm/scichart.browser.js"
crossorigin="anonymous"
></script>
<script src="scichart-example.js" defer></script>
Expand Down
@@ -1,8 +1,8 @@
async function initSciChart() {
// In order to load data file from the CDN we need to set dataUrl
SciChart.SciChartSurface.configure({
dataUrl: "https://cdn.jsdelivr.net/npm/scichart@2.1.2261/_wasm/scichart2d.data",
wasmUrl: "https://cdn.jsdelivr.net/npm/scichart@2.1.2261/_wasm/scichart2d.wasm"
dataUrl: `https://cdn.jsdelivr.net/npm/scichart@${SciChart.libraryVersion}/_wasm/scichart2d.data`,
wasmUrl: `https://cdn.jsdelivr.net/npm/scichart@${SciChart.libraryVersion}/_wasm/scichart2d.wasm`
});
await SciChart.chartBuilder.buildChart("scichart-root", {
series: {
Expand Down
4 changes: 3 additions & 1 deletion Sandbox/demo-nuxtjs/README.md
Expand Up @@ -8,9 +8,11 @@
### To Make SciChart Class available object the Nuxt should include BrowserBundle (compiled JS code from CDN)
### script section of nuxt.config.js:
```
import {libraryVersion} from "../../Core/BuildStamp";
...
script: [
{
src: "https://cdn.jsdelivr.net/npm/scichart@2.0.2146/_wasm/scichart.browser.js",
src: `https://cdn.jsdelivr.net/npm/scichart@${libraryVersion}/_wasm/scichart.browser.js`,
},
]
```
Expand Down
3 changes: 2 additions & 1 deletion Sandbox/demo-nuxtjs/nuxt.config.js
@@ -1,4 +1,5 @@
const path = require("path");
import { libraryVersion } from "scichart/Core/BuildStamp";

export default {
// Disable server-side rendering: https://go.nuxtjs.dev/ssr-mode
Expand All @@ -21,7 +22,7 @@ export default {
],
script: [
{
src: "https://cdn.jsdelivr.net/npm/scichart@2.0.2146/_wasm/scichart.browser.js",
src: `https://cdn.jsdelivr.net/npm/scichart@${libraryVersion}/_wasm/scichart.browser.js`,
},
],
},
Expand Down
2 changes: 1 addition & 1 deletion Sandbox/demo-nuxtjs/package.json
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"core-js": "^3.15.1",
"nuxt": "^2.15.7",
"scichart": "2.1.0-beta.40"
"scichart": "^2.1.2290"
},
"devDependencies": {}
}
6 changes: 3 additions & 3 deletions Sandbox/demo-nuxtjs/pages/index.vue
Expand Up @@ -21,9 +21,9 @@ export default {
// https://github.com/ABTSoftware/SciChart.JS.Examples/tree/master/Sandbox/demo-browser-global-module
SciChart.SciChartSurface.configure({
dataUrl:
"https://cdn.jsdelivr.net/npm/scichart@2.0.2115/_wasm/scichart2d.data",
`https://cdn.jsdelivr.net/npm/scichart@${SciChart.libraryVersion}/_wasm/scichart2d.data`,
wasmUrl:
"https://cdn.jsdelivr.net/npm/scichart@2.0.2115/_wasm/scichart2d.wasm",
`https://cdn.jsdelivr.net/npm/scichart@${SciChart.libraryVersion}/_wasm/scichart2d.wasm`,
});
// Create the SciChartSurface in the div 'scichart-root'
Expand All @@ -41,7 +41,7 @@ export default {
RolloverModifier,
FastLineRenderableSeries,
} = SciChart;
// Create an X,Y Axis and add to the chart
const xAxis = new NumericAxis(wasmContext);
const yAxis = new NumericAxis(wasmContext);
Expand Down

0 comments on commit 5137f3c

Please sign in to comment.