114
Views
6
Comments
Solved
[Gantt Highcharts] Error when using Gantt chart and another Highchart's chart
gantt-highcharts
Reactive icon
Forge asset by Paulo Torres
Application Type
Reactive

When in a screen where another Highchart exists (i.e. OutSystems chart), the Gantt chart does not load and an error is thrown "Highcharts.ganttChart is not a function".

I believe this might be due to a conflict between scripts that are being loaded that are related to Highcharts.

A simple way to replicate this is to create a screen and add a Gantt chart and an OutSystems chart and load it.

2021-09-06 15-09-53
Dorine Boudry
 
MVP
Solution

Hi Diogo,

this is probably because the Gantt Highcharts asset is using a more recent version of Highcharts than Outsystems, and the version Outsystems is using doesn't have support for Gantt charts.

As a library or class can only be loaded/defined once, it is a matter of making sure the most recent one gets loaded first.  To test this, move your OS chart below the Gantt chart, and then the problem should not occur.

So far for the explanation, this doesn't offer a solution yet.  

The problem is not only when the OS chart is before the Gantt chart on a screen, also when your application starts on a screen with OS chart, and then flows to screen with Gantt, you will get the same problem (i guess, highcharts object doesn't get destroyed and recreated just because of a screen flow, or something like that)

As a patch / workaround, this will do it, but it is far from desirable :

  • make all same libraries as the Gantt chart is using available through a small webblock
  • make sure that webblock is in all cases loaded before any OS chart
    • put it as a wrapper around every OS chart (by giving it a placeholder)
    • put it at the top in all your layout blocks
    • or some other creative way...

something similar to this GanttChartProtector Webblock:

Dorine

UserImage.jpg
Diogo Cardoso

Thanks for the tip Dorine!

This solved the problem. Many thanks!

2023-12-28 16-01-00
Sérgio Trindade

Hello Dorine,

your solution seems to not be working on my scenario.

Even on scripts the recent ones, are being loaded first.

I have attached a picture.

Could you provide a oml example?

Thanks

2021-09-06 15-09-53
Dorine Boudry
 
MVP

@Sergio,

that oml is long gone.

if you share yours, I'll have a look

2023-08-28 07-00-10
Paulo Torres
Champion

Hello Diogo,

I didn't notice your post. Glad if Dorine gave you solution for your problem.

Regards

2023-08-28 07-00-10
Paulo Torres
Champion

It seems a interesting challenge... I'll try to arrange sometime to think about that.

I've never been through this situation before!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.