Qlik Community

QlikView Extensions

Discussion Board for collaboration on QlikView Extensions.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Extension issue

Hello, I have  a problem in implementing an extension into my qvw.

The code  is the following one:

<!DOCTYPE html>

<html>

<body>

<script src="http://d3js.org/d3.v3.min.js"></script>

<script src="http://d3js.org/topojson.v1.min.js"></script>

<script src="http://datamaps.github.io/scripts/datamaps.world.min.js"></script>

<div id="container" style="position: relative; width: 500px; height: 300px;"></div>

<script>

    var map = new Datamap({

        element: document.getElementById('container'),

        fills: {

            defaultFill: 'rgba(23,48,210,0.9)' //any hex, color name or rgb/rgba value

        }

    });

</script>

</body>

</html>

and it's working fine ; the libraries are working and the javascript code is working fibe.

I tried to implement it in qlikview:

Qva.LoadScript("http://datamaps.github.io/scripts/datamaps.world.min.js", function() {

Qva.LoadScript("http://d3js.org/topojson.v1.min.js", function() {

Qva.LoadScript("http://d3js.org/d3.v3.min.js", function() {

Qva.AddExtension('map2', function() {

var html="";

var _this = this;

html='<div id="container"; style="position: relative; width: 300px; height: 140px;"></div>';

var map = new Datamap({

        element: document.getElementById('container'),

        fills: {

            defaultFill: 'rgba(23,48,210,0.9)' //any hex, color name or rgb/rgba value

        }

    });

this.Element.innerHTML+=html;

},true);

});

});

});

and I receive the following error:

'An error has occured in the script on this page

LINE: 0

CHAR: 0

ERROR: Script error

CODE: 0

url: http://d3js.org/d3.v3.min.js

Can you please help me? Thank you very much!

Tags (3)
1 Solution

Accepted Solutions
Employee
Employee

Re: Extension issue

The problem is that you're trying to run d3 on a div that hasn't been added to the extension yet.  If you simply move this.Element.innerHTML += html; to be above the code that adds the map, it works fine.  I tested this code and I saw a map:

Qva.LoadScript("http://datamaps.github.io/scripts/datamaps.world.min.js", function() {

  Qva.LoadScript("http://d3js.org/topojson.v1.min.js", function() {

  Qva.LoadScript("http://d3js.org/d3.v3.min.js", function() {

  Qva.AddExtension('map2', function() {

  var html = "";

  var _this = this;

  html = '<div id="container"; style="position: relative; width: 300px; height: 140px;"></div>';

  this.Element.innerHTML += html;

  var map = new Datamap({

  element : document.getElementById('container'),

  fills : {

  defaultFill : 'rgba(23,48,210,0.9)' //any hex, color name or rgb/rgba value

  }

  });

  }, true);

  });

  });

});

8 Replies
Employee
Employee

Re: Extension issue

The problem is that you're trying to run d3 on a div that hasn't been added to the extension yet.  If you simply move this.Element.innerHTML += html; to be above the code that adds the map, it works fine.  I tested this code and I saw a map:

Qva.LoadScript("http://datamaps.github.io/scripts/datamaps.world.min.js", function() {

  Qva.LoadScript("http://d3js.org/topojson.v1.min.js", function() {

  Qva.LoadScript("http://d3js.org/d3.v3.min.js", function() {

  Qva.AddExtension('map2', function() {

  var html = "";

  var _this = this;

  html = '<div id="container"; style="position: relative; width: 300px; height: 140px;"></div>';

  this.Element.innerHTML += html;

  var map = new Datamap({

  element : document.getElementById('container'),

  fills : {

  defaultFill : 'rgba(23,48,210,0.9)' //any hex, color name or rgb/rgba value

  }

  });

  }, true);

  });

  });

});

Not applicable

Re: Extension issue

Hello, I tried on another computer and it worked perfectly, but on mine didn't worked.

Same error in including Javascript library d3..

Do you have any hints?

Not applicable

Re: Extension issue

Also on antoher computer didn't worked. So, on 2 didn't worked, on another it worked. I don't think it's a proxy issue.

Employee
Employee

Re: Extension issue

What version of IE are the computers running?

Not applicable

Re: Extension issue

Internet Explorer 8

Employee
Employee

Re: Extension issue

Is the computer who has it working running IE 9 or higher?

Not applicable

Re: Extension issue

Hello!!!

Thank you very much!!!!!

I installed Internet explorer 9. Seems that the version of the javascript library was working on IE 9+.

Thank you, again!!!!!!!!!!!

Employee
Employee

Re: Extension issue

No problem!

D3 is a javascript library that only works with more modern browsers such as IE9 and above.