mgskjaeveland / sgvizler

Sgvizler: SPARQL result set visualisation javascript library
http://mgskjaeveland.github.io/sgvizler/
MIT License
31 stars 13 forks source link

Sankey -- TypeError: Func is not a constructor. #75

Open freaksN opened 6 years ago

freaksN commented 6 years ago

I know that SgVizler supports all the major chart types offered by the Google Visualization API. I was wondering if Sankey Diagrams were also supported. I've tried to use sankey diagrams but the console spits out an error google.visualization.Sankey -- TypeError: Func is not a constructor. I've also checked the class in the Google API and it says that in order to load this diagram you need to load the class name google.visualization.Sankey. So it shouldn't be a typo on my side.

freaksN commented 6 years ago

After little more research I've found out that google.visualization.WordTree produces the same error google.visualization.WordTree-- TypeError: Func is not a constructor.

How can I send the query and get the results through sgvlizler and then use these functions ? What would be way to configure this in the script ?

mgskjaeveland commented 6 years ago

I see now that my reply by email to github has not appeared. Here is what is wrote to your first post:

This visualisation function is not registered in Sgvizler (just because it is was not available at the time Sgvizler was developed).

Try to add it to registry.js, which specifies the google libraries required to load:

registry = {
  google: {
    visualization: {
      DataTable: { t: 'core',
                   d: { i: GVIZ }
      },

      ...

      Sankey: { d: { i: 'sankey' } }

For Wordtree, try to set WordTree: { d: { i: 'wordtree' } }.

freaksN commented 6 years ago

@mgskjaeveland Thanks for your suggestion. Yes this seems to be the right way but in order it to function properly sgvizler.js Line 715 needs to be changed as well. Just add the following there too. registry = { google: { visualization: { DataTable: { t: 'core', d: { i: GVIZ } }, ....... Sankey: { d: { i: 'sankey' } }

freaksN commented 6 years ago

Do you know how could I add sankey.node.colors and sankey.link.colors to the options menu ? endpointURL("http://data.linkedmdb.org/sparql") .endpointOutputFormat("jsonp") .chartFunction("google.visualization.ColumnChart") .chartWidth(1100) .chartHeight(1100) something like .nodeColors .nodeLink ???