title: Change chart colors
body: <p>I have a bar chart/histogram, all working fine.
  I need to change the text and lines on the chart is on a black background.I
  Also, the bar colors need to be orange.
  I have had a look around the web, and seen some references to .attr("style":...); and have tried this without success.
  Any pointers gratefully received.</p>
  
  <pre><code>&lt;script&gt;
  // set the dimensions of the canvas
  var margin = {top: 20, right: 20, bottom: 70, left: 40},
      width = 1890 - margin.left - margin.right,
      height = 400 - margin.top - margin.bottom;
  
  
  // set the ranges
  var x = d3.scale.ordinal().rangeRoundBands([0, width], .05);
  
  var y = d3.scale.linear().range([height, 0]);
  
  // define the axis
  var xAxis = d3.svg.axis()
      .scale(x)
      .orient("bottom")
  
  
  var yAxis = d3.svg.axis()
      .scale(y)
      .orient("left")
      .ticks(10);
  
  // add the SVG element
  var svg = d3.select("body").append("svg")
      .attr("width", width + margin.left + margin.right)
      .attr("height", height + margin.top + margin.bottom)
      .append("g")
      .attr("transform", 
            "translate(" + margin.left + "," + margin.top + ")");
  
  // load the data
  d3.json("/assets/js/risk_hist_values.json", function(error, data) {
      // the number of columns in this chart
      var numCols = data.length;
      data.forEach(function(d) {
          d.Letter = d.bin_no;
          d.Freq = +d.count;
      });
  
    // scale the range of the data
    x.domain(data.map(function(d) { return d.Letter; }));
    y.domain([0, d3.max(data, function(d) { return d.Freq; })]);
  
  var tip = d3.tip()
    .attr('class', 'd3-tip')
    .offset([-10, 0])
    .html(function(d) {
      return "&lt;strong&gt;Count:&lt;/strong&gt; &lt;span style='color:red'&gt;" + d.count + "&lt;/span&gt;";
    })
  
  
  // call the tips
  svg.call(tip);
  
    // add axis
    svg.append("g")
        .attr("class", "x axis")
        .attr("transform", "translate(0," + height + ")")
        .call(xAxis)
      .selectAll("text")
        .style("text-anchor", "end")
        .attr("dx", "-.8em")
        .attr("dy", "-.55em")
        .attr("transform", "rotate(-90)" );
  
    svg.append("g")
        .attr("class", "y axis")
        .call(yAxis)
        .append("text")
        .attr("transform", "rotate(-90)")
        .attr("y", 5)
        .attr("dy", ".71em")
        .style("text-anchor", "end")
        .text("Count");
  
  
    // Add bar chart
    svg.selectAll("bar")
        .data(data)
        .enter().append("rect")
        .attr("class", "bar")
        .attr("x", function(d) { return x(d.Letter); })
        .attr("width", x.rangeBand())
        .attr("y", function(d) { return y(d.Freq); })
        .on('mouseover', tip.show)
        .on('mouseout', tip.hide)
        .on('click', drill)
        .attr("id", function(d, i){ return 'b_'+i+''; })
        .attr("height", function(d) { return height - y(d.Freq); });
  
  });
  
  function drill(){
      alert( 'drilling' );
  }
  
  &lt;/script&gt;
  </code></pre>