Code Monkey home page Code Monkey logo

Comments (5)

ajturner avatar ajturner commented on May 24, 2024

@abakirov Yes - looking at the Stack

  • (Application)
  • Cedar - JS Functions
  • Vega - specification templates
  • D3 - SceneGraph or JS Functions

We would like to keep the 'customization' as high-level as possible. By doing so we can make it easier to reuse charts as shared and trusted Items in hosted applications. We can do that because we are not running arbitrary Javascript code but only a JSON document that can be validated.

But as you are pointing out - the chart design may go beyond the Vega capabilities, though that may just be a challenge to the community craft such a document. :)

The pattern should be that through encapsulation you can 'swap out' Vega for a custom visualization engine that would then use D3. So then after loading the engine, the Cedar API continues to function.

For example mimicking this chart

image

and a service like

OBJECTID Origin Destination Name Date
1 Sudan Chad Person 1 2012-01-02
2 Somalia Ethiopia Person 1 2012-08-07
3 Sudan Chad Person 1 2013-03-20
4 Sudan Uganda Person 1 2013-07-14

etc.

<script type="text/javascript" src="/chord-graphic.js"></script>

<script>
//create a cedar chart, passing a url to a spec
  var chart = new Cedar({"engine":"chord-graphic"});
  var dataset = {
    "url":"http://maps2.dcgis.dc.gov/dcgis/rest/services/DCGIS_DATA/Education_WebMercator/MapServer/5",
    "mappings":{
      "category1": {"field":"Origin","label":"Origin Country"},
      "category2": {"field":"Destination","label":"Destination Country"}
    }
  };

  //assign to the chart
  chart.dataset = dataset;

  //show the chart
  chart.show({
    elementId: "#chart"
  });
</script>

z

from cedar.

abakirov avatar abakirov commented on May 24, 2024

And what will chord-graphic.js look in this example, something like this?

Cedar.registerEngine("chord-graphic", impl);

... where impl is my own implementation of some well-defined interface?

from cedar.

ajturner avatar ajturner commented on May 24, 2024

@abakirov that's generally the idea. What would you think of that?

from cedar.

abakirov avatar abakirov commented on May 24, 2024

Sounds good to me. I would also add that OOTB vega engine implementation should probably use that same API Cedar.registerEngine("vega", ...). This way people will be able to look at vega implementation and use it as example for their own engine.

from cedar.

ajturner avatar ajturner commented on May 24, 2024

Similar example
http://jlord.us/sheetsee.js/docs/custom-charts.html

from cedar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.