when using exporting(highchart) in angular 7 got the the error - highcharts

using exporting(highchart) getting below error:
ERROR in src/app/desktop/module/dashboard/dashboard.module.ts(24,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'typeof import("C:/website/UI_Dashboard/node_modules/highchart
s/modules/exporting.src")' has no compatible call signatures.
in the module:
import {ChartModule, HIGHCHARTS_MODULES} from 'angular-highcharts';
import * as more from 'highcharts/highcharts-more.src';
import * as highcharts from 'highcharts';
import * as exporting from 'highcharts/modules/exporting.src';
import * as offline from 'highcharts/modules/offline-exporting';
exporting(highcharts);
offline(highcharts);
what should I do for solving this issue?

Have you tried with import exporting from 'highcharts/modules/exporting.src';?
It's the suggested way of module working as documented in the official Highcharts wrapper for Angular - https://github.com/highcharts/highcharts-angular#core
You should also load all Highcharts related files as src or minified - mixing might cause some TS issues.
An import path for src version of Highcharts core is 'highcharts/highcharts.src'.
Also (I'm not sure if this applies here since the code might not be complete), highcharts-more needs to be initialized as any other module. Usually it is loaded before other modules - initialization order is rarely important (some series types are based on optional modules) and you will get an error if the order is wrong, so it's important to test this.

In case anyone encounters this problem nowadays, changing this:
import * as exporting from 'highcharts/modules/exporting.src';
To this:
import Exporting from 'highcharts/modules/exporting';
Solved the problem for me.
I'm using Angular CLI 11.1.4 and the Highcharts npm package v9.2.2

Related

Could not load lang::java::jdt::Java

When trying to import JAVA modules I receive an error:
// JAVA imports
import lang::java::jdt::Java;
import lang::java::jdt::JDT;
import lang::java::jdt::JavaADT;
Could not load lang::java::jdt::Java
In the console:
rascal>import lang::java::jdt::Java;
|prompt:///|(0,29,<1,0>,<1,29>): Could not import module lang::java::jdt::Java: can not find in search path
Advice: |http://tutor.rascal-mpl.org/Errors/Static/ModuleImport/ModuleImport.html|
I'm using Eclipse and am trying to use the AstNode datatype. Any ideas?
The JDT modules have been replaced a while back by the m3 model.
While they are a bit different, the AST part should be comparable.
Check the m3 ast documentation and the Measuring java recipe.
Is this an old project you are trying to get up and running?

jspm config.js using system, not able to import Highmaps... (works fine with cjs)

so this snippet works great when I use commonjs on my config.js
import * as Ng2Highcharts from 'highcharts/modules/map';
Ng2Highcharts(Highcharts);
but as soon as I switch to system with the following import:
import * as Ng2Highcharts from 'highcharts/modules/map';
Ng2Highcharts.default(Highcharts)
I get an error of :
ORIGINAL EXCEPTION: TypeError: x[(intermediate value)(intermediate value)(intermediate value)] is not a constructor
ORIGINAL STACKTRACE:
not sure why config.js switching from cjs to system breaks this,
Thanks
Sean

How to import a component in one angular2-dart package into another angular2-dart package

I understand how to import one dart-polymer package into another package and use a component from the imported package.
There seems to be a difference in angular2-dart.
I created an angular2-dart component in package A and import it into package B.
The specific component I want to use is NameComponent.
In polymer I would simply do the following to used the imported component's markup
<name-component></name-component>
Doing something similar does not work in angular2-dart.
I have not been able to find information on importing a component from one dart package into another for angular2-dart.
A graphical summary of what I am trying to do is shown below - package B. The name-component is from package A.
Does anyone know how this is done?
EDIT 1
After making the suggested corrections I receive the following
"P:\Program Files\Dart\dev\dart-sdk\bin\pub.bat" serve web --port=57435
Loading source assets...
Loading angular2 and dart_to_js_script_rewriter transformers...
Serving epimss_ng2_app web on http://localhost:57435
[DirectiveProcessor on epimss_ng2_reg|lib/components.dart]:
ERROR: Invalid argument (url): "Could not read asset at uri asset:epimss_ng2_reg/lib/name_component.html"
[Warning from TemplateCompiler on epimss_ng2_app|lib/app_component.ng_meta.json]:
Could not find Directive entry for name: NameComponent
. Please be aware that Dart transformers have limited support for reusable, pre-defined lists of Directives (aka "directive aliases"). See https://goo.gl/d8XPt0 for details.
Build completed with 1 errors.
[web] GET Served 13 assets.
[web] GET packages/epimss_ng2_reg/components.dart => Could not find asset epimss_ng2_reg|lib/components.dart.
[web] GET Served 17 assets.
I am going to place the components directory directly on lib and see if it makes a difference.
My package is actually packages/epimss_ng2_reg/src/components.dart.
I can only think of 2 things you might be missing.
You need to add the component to directives
#Component(..., directives: const [NameComponent]) af the parent component.
You need to add the Angular2 transformer in pubspec.yaml of the component
transformers:
angular2

Top level routines of one library are inaccessible when loaded through another library in Dart

Say, I load this script in the browser:
<script src='app.dart' type='application/dart'></script>
Now, in app.dart I have this:
import 'library1.dart';
unleashTheKraken();
Then in library1.dart you'll find this:
library library1;
import 'library2';
And finally in library2.dart we'll have:
library library2;
unleashTheKraken() => print('Unleashing the Kraken')
And the result is: Exception: No top-level method 'unleashTheKraken' declared. How so?
Because imports don't chain automatically. You have to use the export statement for that.
library library1;
import "library2.dart";
export "library2.dart";
And to avoid unnecessary code: import and export are completely independent. If you don't use unleashTheKraken in library1 itself, you can omit the import statement and just use export alone.

Could not find class 'weka.core.FastVector',

I am using weka for my project. but get the error info"could not find class weka.core.FastVector" on the line below. I have already added weka.jar from the build path of the project by adding external jar file. How should I solve this problem? Thanks a lot for your time on reviewing my question.
import weka.core.Attribute;
import weka.core.FastVector;
import weka.core.Instance;
import weka.core.Instances;
FastVector atts;
private void setUpARFF(){
atts = new FastVector();}
I know that FastVector was marked as obsolete a while back, perhaps they've finally removed it. Are you using the dev version of weka (or what version are you using)? FastVector can be replaced with ArrayList (in dev version) so use that instead.

Resources