jamesleesaunders / d3-ez

D3-EZ Easy Reusable Charts
http://jamesleesaunders.github.io/d3-ez/
GNU General Public License v2.0
51 stars 12 forks source link

Add Line Chart to D3.EZ #45

Closed jamesleesaunders closed 7 years ago

jamesleesaunders commented 9 years ago

Add standard Line Chart to D3.EZ library. This will make it more if a complete library.

Also make so can be area chart also?

jamesleesaunders commented 7 years ago

Also see issue #49

jamesleesaunders commented 7 years ago
      var data2 = d3.nest()
        .key(function(d) { return d.date; })
        .entries(data)
        .map(function(group) {
          series = group.values[0];
          return {
            key: group['key'],
            values: [
              {key: "New York", value: series['New York']},
              {key: "San Francisco", value: series['San Francisco']},
              {key: "Austin", value: series['Austin']},
            ]
          };
        });
      console.log(data2);
      data3 = [ {key: "New York", values: []}, {key: "San Francisco", values: []}, {key: "Austin", values: []} ];
      d3.map(data).values().forEach(function(d) {
        data3[0].values.push({key: dateConvert(d.date), value: parseInt(d['New York'])});
        data3[1].values.push({key: dateConvert(d.date), value: parseInt(d['San Francisco'])});
        data3[2].values.push({key: dateConvert(d.date), value: parseInt(d['Austin'])});
      });
      console.log(data3);
jamesleesaunders commented 7 years ago

Completed by 050231b0cf9ab23f126a7c9c59dd79bae7b9a978.

jamesleesaunders commented 7 years ago

https://www.dashingd3js.com/lessons/d3-arrays