|
|
|
|
|
|
Re: I wondering d3 charting widget. [message #1106891 is a reply to message #1066118] |
Wed, 11 September 2013 17:34 |
Rene Richter Messages: 13 Registered: May 2013 |
Junior Member |
|
|
Okay, I didn't come to a conclusion in respect of the D3/RAP example.
Anyway, maybe someone can remark something on my thoughts.
d3chart.TreeMap = function( parent ) {
this._width = 960;
this._height = 500
this._color = d3.scale.category20c();
var treemap = d3.layout.treemap()
.size([width, height])
.sticky(true)
.value(function(item) { return item.getValue; });
this._items = new d3chart.ItemList();
this._chart = new d3chart.Chart( parent, this );
};
d3chart.TreeMap.prototype = {
addItem: function( item ) {
this._items.add( item );
this._chart._scheduleUpdate();
},
removeItem: function( item ) {
this._items.remove( item );
this._chart._scheduleUpdate();
},
destroy: function() {
this._chart.destroy();
},
initialize: function() {
},
setHeight: function(height){
this._height = height;
}
setWidth: function(width){
this._width = witdh;
}
}
rap.registerTypeHandler( "d3chart.TreeMap", {
factory: function( properties ) {
var parent = rap.getObject( properties.parent );
return new d3chart.TreeMap( parent );
},
destructor: "destroy",
properties: [ "width", "height"],
events: [ "Selection" ]
} );
- Let's start att the bottom: Since I am trying to create a remote object of type 'TreeMap', I wrote a minimal type handler. I am not sure about the properties, consider them as tentative
- I defined an appropriate treemap object and added setters for all properties defined in the handler, capability to add remove items from my itemlist, and destroy() and initialze() -> where are they derived from? who invokes them?
- I my view, there isn't much to be done on the java site, the TreeMap.java has a constructor calling super with remoteType 'd3chart.TreeMap', and setters/getters for the attributes 'width' and 'heigth', the above tree-map.js is addes to the chart Resources
-------
I can't help but get the impression that I still don't have the necessary understanding for the example. Am I on the right track? My next step would be to implement the render function which appears do do all the "d3 stuff".
Any thoughts?
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02485 seconds