小编joh*_*hny的帖子

How to change xaxis label in D3 chart?

The following code shows you my current chart. How I can edit the label of the xaxis to show the years "2015", "2016", "2017", "2018" and "2019"? I am really new in this D3.

var data = new Array (1, 2, 3, 4, 5);
var x_scale = d3.scale.linear()
      .domain([0,d3.max(data, function(d,i) { return i+1 })])
      .range([62,540])
    var xAxis = d3.svg.axis()
      .scale(x_scale)
      .tickSize(0,0)
      .ticks(5)
      .tickPadding(6)
      .orient("bottom");
    d3.select("svg").append("g")
      .call(xAxis)
      .attr("class","xaxis")
      .attr("transform","translate(0,364)");


var y_scale = d3.scale.linear()
  .domain([d3.max(data, function(d) { return d }),0])
  .range([54,364])
var …
Run Code Online (Sandbox Code Playgroud)

label d3.js

2
推荐指数
1
解决办法
2752
查看次数

找到三个最大数字的数组(PHP)

我需要知道如何找到数组的三个最大数字.目前我只能找到最大数量的数组,但我希望有三个最好的数组:

$avg = array();
$avg[20,10,30,50,80,90,220];
echo max($avg);
Run Code Online (Sandbox Code Playgroud)

也许你可以帮我这个?

php arrays max

-4
推荐指数
1
解决办法
67
查看次数

标签 统计

arrays ×1

d3.js ×1

label ×1

max ×1

php ×1