score:1
Accepted answer
This should provide a generic solution for various ranges (not just up to 50000). The ticks function allows you to choose a certain amount of ticks, dividing by the period size, gives us the wanted result.
yAxis = d3.axisLeft(yScale)
.tickSizeInner(-(w - paddingYaxis - tickSize * 2))
.tickSizeOuter(0)
.tickPadding(tickPadding)
.tickFormat(d3.format(' '))
.ticks(d3.max(data, d => +d['price'] + yPeriod) / 10000);
Source: stackoverflow.com
Related Query
- How to set period for vertical ticks?
- How to set the label for each vertical axis in a parallel coordinates visualization?
- How to set ticks for yAxis using a logarithmic (Symlog) scale?
- How to set text color for my d3 chart title?
- How to set the Origin (drag.origin) for drag behavior in d3 JavaScript library
- How to set fixed no. of ticks on axis in d3.js?
- How to set minimal step for y-axis in d3.js?
- How do I set custom ticks along the Xaxis in D3? or name the bars in a bar chart?
- d3.v4: How to set ticks every Math.PI/2
- How to set Minimum Radius for Circle Pack in D3JS?
- When a d3.behavior.zoom event is triggered programatically, how do you set inital values for translate and scale?
- How to increase time to read d3.json data for large data set and slow networks?
- With NVD3.js (nv.models.lineWithFocusChart), how do you set specific ticks on X-axis, when x values are dates?
- How to set count to zero for missing keys in D3 nest()
- How to prevent ticks from getting too close together for responsive d3 chart
- d3.Js - How to set custom("string") values to `y-Axis` - ticks
- How do I calculate a bounding box for leaflet from a set of points in d3
- How to set background color for svg text tspan without foreign object?
- How to set Position for marker-start?
- How to spcify ticks on x axis for time scale in d3js?
- How do I set the X values for a singled stacked horizontal bar chart using d3.js?
- Can't set the number of ticks on time-based x-axis to custom amount for bar chart
- D3.js version 4: How to properly set the x-axis-intervals for a histogram
- How to set y domain for dc js box plot? Does it handle negative values?
- How can I set a minimum range for an interval for a time scale in d3.js?
- How to properly set the type for property `d` in `path` element in a d3 react typescript application
- How to interact JQuery slider with d3 vertical lines for every data point
- d3 chart: how to set multiple css properties for d3 chart
- how can I set a height and width for this map in d3.js
- Datamaps: How to set conditional highlight fill colors for objects with data
More Query from same tag
- Separate json data from html?
- Center align two text elements without overlap in a rectangle
- D3 sort an array of objects on 2 object properties
- d3.js fisheye; move focus to axis intersection
- D3 Inversion of mouse position to closest tick value on the X-axis
- D3 force-directed graph nodes have no attribute "weight"
- Why is the line in my D3 chart inverting?
- How can I start with all the nodes collapsed in d3js?
- Scaling the filling portion of an SVG path
- Sub selection deletion with animations
- d3 Hexagonal Binning domain and range
- Layering D3 Graphs: Swimlanes + Data Connections
- Mouseover is not working in d3.js by attaching it to circles
- Argument of type 'string[]' is not assignable to parameter of type 'ReadonlyArray<number>'
- How to make a clickable transition bar graph to show 3 graphs in d3 v4?
- D3 Multiple Pie Chart Updates
- how to add values in one single bar in d3 bar chart
- d3Plus and wrapping text
- Shading polygons with d3
- Adding fisheye to axes with D3 JS
- d3 selection append element inside another
- d3.js equivalent to $(this)
- Add a Legend to D3 Force Directed Graph
- d3 linechart transition with missing data
- How to flip the Y axis on my D3 graph?
- Unicode label is not displayed as a Fontawesome icon
- d3js Sunburst with Distortion > v4
- Applying gravity to a bounded d3.js force layout
- D3 line chart - Error: <path> attribute d: Expected number
- d3.js pan and zoom jumps when using mouse after programatic zoom