ABTSoftware / scichart-react

scichart-react is an open source React Chart component for use with scichart.js. This simplifies the development of React Charts by handling initialisation, deletion and lifecycle of the chart and allows multiple options for creating simple to advanced options
https://abtsoftware.github.io/scichart-react/
MIT License
8 stars 0 forks source link

Default configuration can break build #4

Closed emab closed 6 months ago

emab commented 7 months ago

Hi,

First of all - thanks for putting this library together. My wrapper code didn't work nicely with subcharts but this works wonderfully!

I have a quick thought on the default configuration used:

https://github.com/ABTSoftware/scichart-react/blob/50c138d40ef0676bef29206125ce49bdfe564a4d/src/SciChart.tsx#L12-L16

I run my application via Electron, so bundle the scichart data/wasm files in the root directory. Adding this library broke my build as it was looking for the files at my hard drive root, rather than the relative root.

I previously didn't set this configuration, and it worked fine when hosted via a webserver and when bundled in Electron. It took me a while to track down this bug, so I wonder:

  1. Is this a sensible default? Does Scichart not have a built-in sensible default?
  2. Should some documentation be added to let users know that this configuration is being set, and set to something that does not match the usual defaults?
jim-risen commented 7 months ago

Hello @emab, First of all, thanks for the feedback. We appreciate it!

Regarding the WASM/data loading configuration:

  1. The core SciChart.JS lib uses an equivalent of
    
    SciChartSurface.configure({
    wasmUrl: undefined,
    dataUrl: undefined
    });

SciChart3DSurface.configure({ wasmUrl: undefined, dataUrl: undefined });



And we have faced multiple issues with this approach especially while using some frameworks.
The configuration used for SciChartReact, on the other hand, seems to be more straightforward and predictable.

2. You are right about making this difference more explicit in documentation. We'll update it.

For electron, we have created a boilerplate scaffolded with Electron Forge - https://github.com/ABTSoftware/scichart-react/tree/electron-demo/demos/electron  

Let us know if there are any issues with a specific setup that we may need to check.
emab commented 6 months ago

Interesting! For reference, I'm using the React Vite template, and the defaults worked well for dev mode plus my hosted versions in electron and via a web server. I used a plugin to copy the wasm/data files to the public folder on build.

Documentation update sounds like a good plan! And thanks again for putting this package together.