1

何らかの理由で、stackedAreaChart が各 y 値に 10 を掛けています。

  var data = [{"key":"New York","values":[["2000","47"],["2001","49"],["2002","49"],["2003","47"],["2004","48"],["2005","49"],["2006","50"],["2007","48"],["2008","48"],["2009","47"],["2010","50"],["2011","49"],["2012","51"]]},{"key":"Los Angeles","values":[["2000","56"],["2001","55"],["2002","55"],["2003","56"],["2004","57"],["2005","56"],["2006","57"],["2007","56"],["2008","57"],["2009","57"],["2010","57"],["2011","55"],["2012","56"]]}] ;

  var colors = d3.scale.category10();
  keyColor = function(d, i) {return colors(d.key)};

  var chart;
  nv.addGraph(function() {
    chart = nv.models.stackedAreaChart()
    .x(function(d) { return d[0] })
    .y(function(d) { return d[1] })
    .color(keyColor)

    chart.xAxis
    .showMaxMin(false)

    chart.yAxis
    .tickFormat(d3.format(',.2f'));

    d3.select('#chart1')
    .datum(data)
    .transition().duration(500).call(chart);

    nv.utils.windowResize(chart.update);

    chart.dispatch.on('stateChange', function(e) { nv.log('New State:', JSON.stringify(e)); });

    return chart;
  });
4

1 に答える 1