Hướng dẫn dùng d3.axisleft JavaScript

ExplorePricing

Duy Nguyenduyknguyen.com

Palette in Hanoi.

Published

2 Likes

3

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Insert cell

Create interactive documents like this one.

Learn new data visualization techniques. Perform complex data analysis.
Publish your findings in a compelling document. All in the same tool.

More from Observable creators

How to use

axisLeft

function

in

Best JavaScript code snippets using d3.axisLeft(Showing top 15 results out of 315)

D3blackbox(function () {
  const axis = d3.axisLeft()
          .tickFormat(d => `${d3.format(".2s")(d)}`)
          .scale(this.props.scale)
          .ticks(this.props.data.length);

  d3.select(this.refs.anchor)
   .call(axis);
})

d3.axisLeft().scale(this.state.yScale)
  .tickFormat(d => `${d}℉`)

render() {
  let graphTranslate = `translate(${this.props.margin.left}, ${this.props.margin.top})`;
  let xAxisTranslate = `translate(0, ${this.props.height.inner})`;
  let yAxisTranslate = `translate(0,0)`;
  let drawAxis = (axis,method) => {
   d3.select(axis)
    .call(method);
  };

  return (
   "histogram" transform={graphTranslate}>
    {this.state.bins.map(this.drawBars)}
    "axis x-axis" transform={xAxisTranslate} ref={(axis) => drawAxis(axis,d3.axisBottom(this.x))}>
    "axis y-axis" transform={yAxisTranslate} ref={(axis) => drawAxis(axis,d3.axisLeft(this.y))}>
   
  );
 }

useCallback(
  g => {
   return g
    .attr("class", "y axis")
    .attr("transform", `translate(${MARGIN.left},0)`)
    .call(d3.axisLeft(y))
    .call(g => g.select(".domain").remove())
    .call(g =>
     g
      .select(".tick:last-of-type text")
      .clone()
      .attr("x", 4)
      .attr("text-anchor", "start")
      .attr("font-weight", "bold")
      .text("Horsepower")
    );
  },
  [y]
 )

.attr("class", "axis")
.attr("transform", `translate(${ margin.left }, ${ margin.top })`)
.call(d3.axisLeft(yScale))
.attr("class", "bar-text")

 .scale(x)
let yAxis = d3.axisLeft()
 .scale(y)
 .ticks(10, "%");

const yAxis = d3.axisLeft(y)
  .ticks(10, "%")

.call(d3.axisLeft(this.y));
.call(d3.axisLeft(this.y))
.append("text")
.attr("fill", "#000")

.transition()
.duration(500)
.call(d3.axisLeft(y));

.call(d3.axisLeft(y).ticks(5))
.append("text")
.attr("transform", "rotate(-90)")

 .scale(x)
let yAxis = d3.axisLeft()
 .scale(y)
 .ticks(10, "%");

D3blackbox(function () {
  const axis = d3.axisLeft()
          .tickFormat(d => `${d3.format(".2s")(d)}`)
          .scale(this.props.scale)
          .ticks(this.props.data.length);

  d3.select(this.refs.anchor)
   .call(axis);
})

d3.axisLeft().scale(this.state.yScale)
  .tickFormat(d => `${d}℉`)