score:0
Accepted answer
you should be able to access the scale through xaxis.scale()
. you should run this code after the graph has been drawn to make sure that the scale is set up properly.
score:0
to add some context to the solution by lars:
my xaxis is setup like:
chart.xaxis
.tickvalues([
date.parse('08/24/14'),
date.parse('08/30/14'),
// parsed dates..
])
.tickformat(function(d) {
return d3.time.format('%x')(new date(d))
});
then, after the chart has been rendered (in the callback), i can then get the x position for a certain date value by doing:
chart.xscale()(chart.x()({ x: date.parse('11/01/14') }))
hope this helps someone. cheers.
Source: stackoverflow.com
Related Query
- NVD3.js Get Data Point's Screen Position Within SVG Chart
- How do I get the d3 svg points to stay in their correct position on the leaflet map when zooming?
- How to get the svg position within document?
- MultiBar chart with nvd3 / d3 only shows labels for every other tick on the x-axis. How can I get them all to show up?
- In d3, how to get the interpolated line data from a SVG line?
- custom no data label in nvd3 scatter chart
- nvd3.js : unable to bind onClick event with the data points in the svg
- NVD3 line chart with realtime data
- dc.js add class to data points in multiple charts based on criteria from first chart
- D3 new data at .data() makes svg to redraw instead of updating nodes position
- Get mouse position in SVG co-ordinates after zoom
- Get attributes of existing SVG elements and bind as data with d3.js
- What is the fastest way to get SVG element given a position (x,y)?
- Adding additional data points to a chart
- Generate random points within an svg circle area in d3 or javascript
- How to get SVG path data of TopoJSON feature without adding it to the DOM?
- NVD3 Line Chart doesn't display when data passed using ajax - data.map is not a function
- Loading csv data with d3.csv in nvd3 multiBar Chart example (JSON format)
- Passing data for nvd3 chart from Flask as an argument
- Changing color range in a d3 reusable donut chart depending on the number of data points
- How to plot data points on multi-line chart with multiple y axes
- d3.js v5 : Unable to get data points to show on map of US
- Multiline chart x-axis ticks not aligned with data points
- Get only non-filtered data from dc.js chart (dimension / group)
- D3 line chart does not show tool tip and data points properly
- Scaling a SVG rectangle position based on data
- nvd3 discrete bar chart doesnot take entire svg area
- How to get position of empty SVG group?
- How do you get JSON data and create a line chart with d3.js?
- Javascript / D3.js - draw large data set - improve the speed of zoom and pan in svg chart ploted by d3.js
More Query from same tag
- Draw a multi polygon with metric dimensions over part of a sphere, using d3-geo
- d3.select().append() doesn't work when used multiple times
- How to disable click event after drag stop in d3.js tree
- Trying to render data d3 crossfilter dc.js BarChart. The chart is drawn, but it's empty
- calling an axis based on one of data's attributes
- Mouse event handling in a node and its children
- d3js v4 Create filter function from node values that include arrays
- Reusable d3 charts with optional functionality
- Load local .csv with js and process it with d3.js
- Sorting the bars in a bar chart with dc.js
- How do I put a d3 chart into my chartBox?
- D3.js can't load json file
- D3Plus Scatter Plot X axix String
- D3 V3 Stacked Bar Negative Values
- how to update data in D3 version 4?
- d3 transitioning barchart with variable length
- Using recorded mouse coordinates to draw on d3 canvas
- Collapsible indented tree's initial state
- AngularJS D3JS Donut chart colour change of arc on hover
- How to access parent data inside a nested data in d3.js?
- d3 - unable to add select/option drop down to svg-g element
- How to manually convert point features to SVG coordinates
- Trying to draw SVG to canvas, why is my SVG XML getting truncated?
- How to get the same text of each elements in heat map as the y axis label?
- Conditional manipulation on the text element?
- Understanding JavaScript Doc Notations
- How does d3.csv() work without non-arrow functions?
- Locate link labels and move the labels along with the links
- SVG -> getBBox fails but only half the time
- How to approach filtering nodes and edges rendered via d3.js according to user preference?