misoproject / dataset

JavaScript library that makes managing the data behind client-side visualisations easy
http://misoproject.com
GNU General Public License v2.0
1.18k stars 99 forks source link

need to be able to modify column value before coersion #87

Closed iros closed 12 years ago

iros commented 12 years ago

For example, when parsing a dollar amount like $53,400 need to be able to first change to 53400.

Adding a property called before on column type override that's a function that takes a single value. For example:

var ds = new Miso.Dataset({
      data : {
        columns : [
          { name : 'vals', data : [1,2,3,4,5,6,7,8,9,10] }
        ]
      },
      columns : [
        { name : 'vals', type : 'number', before : function(v) {
            return v * 10;
        }}
      ],
      strict : true
    });