d3.js -смещение оси y -на диаграмме с накоплением

Я также разместил этот вопрос в группе Googlehttps://groups.google.com/forum/?fromgroups#!topic/d3 -js/DYiVeC544ws , но заметил, что он предпочитает, чтобы справочные вопросы задавались здесь. У меня просто возникают проблемы со сдвигом оси y -влево от моего графика, чтобы она не мешала первому столбцу. Я предоставил изображение в группе Google, чтобы вы могли видеть, о чем я говорю.

Код для создания оси выглядит следующим образом:

   var MARGINS = {top: 20, right: 20, bottom: 20, left: 60}; // margins around the graph
var xRange = d3.scale.linear().range([MARGINS.left, width - MARGINS.right]), // x range function
    yRange = d3.scale.linear().range([height - MARGINS.top, MARGINS.bottom]), // y range function

    xAxis = d3.svg.axis().scale(xRange).tickSize(16).tickSubdivide(true), // x axis function
    yAxis = d3.svg.axis().scale(yRange).tickSize(10).orient("right").tickSubdivide(true); // y axis function


// create the visualization chart
var vis = d3.select("#chart")
  .append("svg")
   .attr("width", width)
   .attr("height", height + margin);


    // add in the x axis
  vis.append("svg:g") // container element
   .attr("class", "x axis") // so we can style it with CSS
   .attr("transform", "translate(0," + height + ")") // move into position
   //.call(xAxis); // add to the visualisation

  // add in the y axis
  vis.append("svg:g") // container element
   .attr("class", "y axis") // so we can style it with CSS
   .call(yAxis); // add to the visualisation
12
задан Apollo 28 June 2012 в 20:45
поделиться