Family Circles Forum

0.0.8 not working with data parameter

In new release, nothing gets rendered.

I use it like this:
var fcf=new FamilyCircles.canvas({
data:json,
config:{camera: {target:10816946}},
target:document.getElementById(“circles”)
});

I guess data: parameter changed.
If I use
data:{url:“https://wikitree.sdms.si/function/WTWebFamilyCircles/A.json?WikiTreeID=Trtnik-2&Generations=0&OnlyBlood=1”},
it displays the circles,

If I load the url into json and change data parameter
data:loadedJson,
it doesn’t work.

This is the example, that worked in 0.0.7, but no longer does.
var fcf=new FamilyCircles.canvas(
{
data:{data:[{
id: “10819668”,
type: “person”,
name: “Mitja Dimitrij Mišo (1940-1994)”,
avatar: “/male.gif”,
page: “https://www.wikitree.com/wiki/10819668”,
family: “f10826018m10826017”
}]},
target:document.getElementById(“circles”)
}
);
What changed or how should I call it correctly. I tried a few variations, but nothing worked.

Yes the internal API’s are still evolving. I don’t say much about them because of that (once things settle down I plan to provide documentation for the javascript API’s). The hash for canvas in this release is now processed through a config module. This is what it currently supports:

this.target      = document.body;  // DOM element for rendering in
this.ui          = 'viewer';       // UI to use
                                   // default font file to use
this.font        = "/three/fonts/helvetiker_regular.typeface.json";
this.about       = defaults.about; // about description of canvas
this.text        = defaults.text;  // text description of canvas
this.search      = false;          // show service search panel on connect
this.parseurl    = true;           // parse URL for supported values
this.tools       = defaults.tools; // include tools panel

//this.service      - hash
//      url         - url for service
//      init        - array of id's to load on init
//      action      - if true on connect sets action to explorer
//this.data         - hash
//      url         - url of json file to load
//      hash        -  hash/array of items to load
//      function    - function to call for loading
//this.camera       - hash
//      target      - id to point camera at
//      position    - hash
//         x        - x value for camera
//         y        - y value for camera
//         z        - z value for camera
//      rotation    - hash (?not curently working?)
//         x        - x rotation for camera
//         y        - y rotation for camera
//         z        - z rotation for camera

This will probably still go through a number of changes but let me know if that doesn’t cover what you need for this version. Some areas of the above depending on what you try may have bugs.

So I need to use hash to do what I want.

But it reports an error, that processJSON is missing.
.
fc-min.js:formatted:4716 Uncaught (in promise) TypeError: this.processJSON is not a function
at e.canvas.process (fc-min.js:formatted:4716)
at e.canvas._resourcesloaded (fc-min.js:formatted:4645)
at te.itemEnd (three.min.js:278)
at three.min.js:714

That is a bug. Will fix in next release if you can live with only sending the actual data array something like this should be a work around for 0.0.8.

 document.addEventListener("DOMContentLoaded",function() {
   var data = [{"type":"person","name":"<father>","families":["6"],"id":"1"},{"name":"<mother>","type":"person","families":["6"],"id":"2"},{"id":"3","family":"6","type":"person","name":"<child>"},{"family":"6","type":"person","name":"<child>","id":"4"},{"id":"5","type":"person","family":"6","name":"<child>"},{"type":"family","name":"<family>","id":"6","children":["3","4","5"],"father":"1","mother":"2"}];
   var page=new FamilyCircles.canvas({ 
                  data : { function: testing.bind(document,data)} ,
                  target: document.getElementsByClassName("content")[0]});

   function testing(data) {
     page.processdata(data);
     page.initcamera();
   }
 });

Let me know if that is not going to work for what you need.

It works. But using url does also. Until next release, I will use URL.