ngx-graph: After building app with ngx-graph for Prod environment tooltip breaks the app.

Od Dev environtmnt everything works fine. But when i build the app with:

ng build --prod my console is filled with errors and page frezzes.

image

I tried to remove tooltips from my html graph template but this doesn’t help. Updated my ngx-graph and ngx-charts to the latest version and the error still occurs.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 3
  • Comments: 16 (2 by maintainers)

Commits related to this issue

Most upvoted comments

Since the TooltipService and InjectionService are from the dependency ngx-charts and not in ngx-graph itself, I looked over there to search for related issues. I found #975.

The only feasible solution proposed seemed to be here, which is just to revert to earlier versions of ngx-graph and ngx-charts. The versions suggested are:

@swimlane/ngx-graph”: “4.1.1”, “@swimlane/ngx-charts”: “7.3.0”

However, in my case, this was throwing an error because the BaseChartComponent in this old version of ngx-charts was using Observable.fromEvent (I’m using Angular v7 and rxjs v6.3).

I changed to ngx-graph v5.0.0 and ngx-charts v8.1.0 and it worked in production with AOT. So for those who cannot remove aot or build-optimizer, this may be an option.

I ran into this issue as well. This issue is resolved for me when removing aot from build. It is a better workaround than the hack suggested above, but not a desired one. I wander if the answer here can resolve this case as well.

Same here ! And the workaround is no option at all for our production environment … Could you plz fix this !!

I found a hacky work-around, which I present here. Be aware, that this is not a nice solution, but it works for me.

Copy the folders from https://github.com/swimlane/ngx-graph/tree/master/src into one of your modules. This does not need to be the module where you use the graph. In this module, export “GraphModule”. Rename the selector in graph.ts. Instead of importing NgxGraphs in the modules, import your own module and use “your” graph by using the renamed selector. There where some more smaller changes, which where nicely stated by the compiler.

This solved it for me. Hope it helps

@KingDarBoja nice, thanks! will try that and wait for the new version

@agusdutra Downgrading to "@swimlane/ngx-charts": "^10.1.0" will do the trick without downgrading the ngx-graph package.

I am working on a fix for this issue but still testing it.

Cheers!