jamesleesaunders / d3-ez

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

Bug with time series? (read slashdb tutorial) #87

Closed jamesleesaunders closed 6 years ago

jamesleesaunders commented 6 years ago

It looks like there is a possible bug with the line chart bleeding over the top of the chart? See tutorial at: https://www.slashdb.com/2018/02/15/howto-d3js/

NOTE: Also respond to author, Elliot Bricker, with thanks for writing tutorial!

jamesleesaunders commented 6 years ago

In the code o the article changing this:

      // Convert csv to d3-ez data format
      data = [{
        key: "Total Price",
        values: []
      }];
      d3.map(csv).values().forEach(function(d) {
        data[0].values.push({
          key: dateConvert(d.InvoiceDate),
          value: d.Total
        });
      });

to:

      // Convert csv to d3-ez data format
      data = [{
        key: "Total Price",
        values: []
      }];
      d3.map(csv).values().forEach(function(d) {
        data[0].values.push({
          key: dateConvert(d.InvoiceDate),
          value: +d.Total
        });
      });

NOTE: +d.Total fixes the y-axis overrun.