B.register is not a function in fusioncharts - fusioncharts

Im getting an error of
TypeError: B.register is not a function
at /Test/node_modules/fusioncharts/fusioncharts.charts.js:6:125
I am using fusioncharts installed via npm and have reverted to their guide on rendering charts via npm here. Following step by step the error comes when trying including
require("fusioncharts/fusioncharts.charts")(FusionCharts);
Performing a search in the fusioncharts.charts.js file shows me they do have a B.register function inside. Is their guide wrong and missing a step, or is this a bug. I can display the chart using HTML fine, the js implementation is having hiccups.

FusionCharts is not completely ES6 compatible as of now so you have to use webpack bundler to render the charts via npm.

Related

How to enable java linting in Code Mirror?

We are trying to create a code editor(IDE) in Angular 11. We mainly use java code in it. We need to show lint errors while typing and also beautifier in it. Is there any package or solution already available?

Module Federation in Nx and Angular generates an error loading styles.js

I am following the article describing setting up module federation: https://nx.dev/l/a/guides/setup-mfe-with-angular
Starting with generating the workspace, adding the angular plugin, and adding the dashboard application.
When serving the dashboard application I get an error from styles.js:
Uncaught SyntaxError: Cannot use 'import.meta' outside a module
It is being loaded as:
<script src="styles.js" defer></script>
Doing some quick searches seems to indicate that this thing should have type="module" on it.
However there doesn't seem to be any kind of configuration I can find to modify the line being added to the index.html.
I have checked the regular template generated by angular, it uses the defer style to everything, so the other js file entries are being changed to type="module" some place. The normal styles.js also does not contain any "import.meta" string.
Any solution would be helpful.
TL;DR: thats fine. You should not see this error in the production
There is a note on the https://nx.dev/guides/setup-mfe-with-angular you mentioned saying:
NOTE: When serving MFEs in dev mode locally, there'll be an error output to the console, import.meta cannot be used outside of a module, and the script that is coming from is styles.js. It's a known error output, but it doesn't actually cause any breakages from as far as our testing has shown. It's because the Angular compiler attaches the styles.js file to the index.html in a tag with defer.
It needs to be attached with type=module, but doing so breaks HMR. There is no way of hooking into that process for us to patch it ourselves.
The good news is that the error doesn't propagate to production, because styles are compiled to a CSS file, so there's no erroneous JS to log an error. It's worth reiterating that there's been no actual errors or breakages noted from our tests.
Check the scriptType
This issue has to do with how the imports are set up in the compiled app. You can update the scriptType in your webpack.config.js by adding the scriptType:
module.exports = {
output: {
uniqueName: "YourUniqueAppName",
publicPath: "auto",
scriptType: "text/javascript"
},

Module not found: Error: Can’t resolve ‘fs’

Below are the two error (image) I’m facing
I’m using Ionic 4.
everything works but as soon I start calling WooCommerce API and use it in constructor I get the below two errors.
I have imported Woocommerce API, but when I initialize it in constructr it shows both of this error.
It looks like you are using this package which has an obsolete warning:
2019-07-29: This client is obsolete and will no longer receive updates, a new JavaScript library is available under the name of #woocommerce/woocommerce-rest-api.
However, that's a node.js package. It's failing because fs stands for filesystem and that doesn't exist in the browser.
Node.js is for local development, not for browser packages, which is what Ionic 4 is built with.
However, if you really want to use it then this guide will show you how to wrap it up using browserify:
Transforming a Node.js Module to A Browser Library
The solution is to use Browserify to bundle the module with all its dependencies inside one JavaScript file so we will not need any external Node.js dependencies which are not available inside the Cordova webview (a headless browser) used by Ionic 4.
https://www.techiediaries.com/woocommerce-ionic-2/
I don't know how far you'll get as it's for Ionic 2 but I'm just showing you this to demonstrate that node.js packages are not for Ionic.
Update
Based on your comments you say you are having problems with global not being defined.
Searching Google this seems to be a solved issue, try:
I think for now the best option would be to include
(window as any).global = window;
In your polyfills.ts file, as mentioned here:
angular/angular-cli#9827 (comment)
You have to go to folder \node_modules\#angular-devkit\build-angular\src\angular-cli-files\models\webpack-configs\browser.js and replace node: false, by node: { crypto: true, stream: true, fs: "empty", net: "empty", tls: "empty" },
It's working for me.

Writing a custom panel plugin for grafana

So I need to write a custom grafana plugin, that works like a funnel. I decided to try and integrate this funnel. Note that it is supposed to get the data from a mysql Server and use it just as a table and not as time series.
So far I read the grafana documentation and then watched this video. In the video a dataFormat is declared in the plugin.json file, however when I checked other working Plugins I didn't see that part written in the plugin.json. The GitHub repos in the video are also gone. I stumbled upon this one though, so then I copied it in the data/plugin directory. I restarted the Server and it was detected but when I tried making a new Panel I got an error saying that it could not be found. I was planning on starting with this example and then working my way towards integrating the funnel part but I can't seem to get it working. Any ideas where to start?
I have reproduced your problem with the same actions and got same error:
Panel plugin not found: myorgid-simple-panel
Just a guess: there is a dependency section in plugin.json file
"dependencies": {
"grafanaVersion": "6.3.x",
"plugins": []
}
My Grafana version is v6.2.5. Isn't this plugin template for future Grafana release (master or developement version)?
I had the same problem with simple-react-panel. To solve it, I ran in the simple-react-panel-master directory :
npm i #grafana/toolkit
npm i #grafana/ui
yarn build
and after I restart grafana service

Use Facebook Flow with Ionic 3?

I am looking to use the Facebook Static Analyzer Flow with my Ionic project. I am new to the different package managers as Ionic uses Webpack. Every tutorial I see for Flow indicates to configure Babel to use it, but it does not appear that Ionic uses Babel. Is there an issue configuring Flow with Ionic 3 with Babel?
All the references I have found for Typescript use either Babel or Webpack, which is why I am not sure that the two can work together.
There are two parts to Flow, the flow binary, and the flow preset for Babel.
You write JS with added flow type annotations, but the flow type annotations would not be acceptable to your JS interpretter (node, browser etc) - so the source files have to be transpiled to remove the Flow type information.
Babel is your transpiler, with the appropriate presets and plugins.
Webpack is used ahead of that chain to marshall other resources to get from source to build/distribution code.
Webpack can be configured with the babel-loader plugin so that Babel is run as the packing proceeds.
The babel-preset-flow is used to transpile the type-annotated code to plain JS.
So, Webpack uses Babel, Babel uses Flow preset.
There is also a comment mode for Flow which allows you to use Flow without having to do any transpiling which might also be a solution to your problem if you can't configure the tool stack to your liking.