dalejung / id3

interactive d3
Apache License 2.0
4 stars 0 forks source link

Think about the layer abstraction. #16

Open dalejung opened 11 years ago

dalejung commented 11 years ago

Right now we have:

Layer.data(df).geom(Line()).geom(Rect())

and

Line().data(df).view()

So Layers are in reality both data and chart builders. In the first example, Layer() is being used to hold data, and Line/Rect are only used for their chart builder. Layer passes its data to the chart builders.

However, in the second example Line().data(df) is a full Layer and then we create a view of of it.

Maybe I'm overthinking this, but Layer seems to be overloaded? Though to be fair, in the first example, Line and Rect do end up being full layers. So maybe I just think it's confusing that a Layer can be a Geom when it has no data, or a DataLayer when it has no chart builder.