Created
July 18, 2020 11:34
-
-
Save basith374/0e3f84e6d83bd84f33b40fde5309c633 to your computer and use it in GitHub Desktop.
d3 v4 line chart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { scaleLinear, scaleLog, axisLeft, axisBottom, select, line, format } from 'd3'; | |
const yScale = scaleLog().domain([0, 100]).range([300, 0]) | |
const xScale = scaleLinear().domain([1, 100]).range([0, 500]); | |
const pathline = line().x(d => xScale(d.x)).y(d => yScale(d.y)); | |
axisLeft(yScale).tickValues([maxViews, minViews]).tickFormat(format('.2s'))(select('.leftAxis')); | |
axisBottom(xScale).tickValues([1, songs.length])(select('.bottomAxis')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment