score:1
Accepted answer
You can provide specific tick values to be displayed on a d3 chart.
Firstly, correct your date parser:
var parseDate = d3.time.format("%e-%b-%y %H:%M").parse; // %e instead of %d
First, you need to get the list of tick values you want to display. After you've loaded the csv and processed it, extract the tick values and assign them to your xAxis
:
d3.csv("data.csv", function(error, data) {
data.forEach(function(d) {
d.date = parseDate(d.date);
d.close = +d.close;
});
var tickValues = data.map(function(d) { return d.date; });
xAxis
.tickValues(tickValues)
.tickFormat(d3.time.format('%H:%M'));
Do not forget to remove the ticks
on your current xAxis
definition.
Source: stackoverflow.com
Related Query
- Use D3.js single line graph to display same date but different temperatures
- D3.js/Dc.js different colored line segments for single line in line graph
- d3.js multiple line chart rendering: Same dataset but different curve
- How to draw two line on the same xScale but different time frame
- d3-graphviz: incorrect rendering if I use same graphviz renderer to draw slightly different graph multiple times
- Draw the line use the same y values, plots line at the bottom
- How to use tool tip in Line bar graph using D3 js
- D3js Line graph doesn't go through all of my points when I use .interpolate('basis')?
- wrong date printing on x axis of line graph in d3 with extra tick
- Different tick sizes on the Y axis of a D3js line graph
- D3 line chart same tick on hover gives different values
- D3 line graph with date slider
- Metricsgraphics Date access - Line graph
- Combining Bivariate Graph with Line Graph in a single chart
- How can I draw a continuous line using d3 without needing to click&drag the mouse, but rather just use the mouseover event?
- placing multiple d3 charts on the same page but applying different styling
- d3 - Add single line to grouped bar graph
- I am trying to build a d3js graph but on the x-axis i am getting the timestamps instead of date and time even after i used formatting
- having trouble plotting a D3 line graph where X-Axis is not a date
- why d3 line chart and bar chart display in same morment?
- How do i plot multiple lines in the same line graph using the D3 framework?
- Line Graph using D3 is not starting from the date i want it to
- Charts showing on the same line in non-IE browsers, but on the next line on IE browsers
- Loading data from MySQL to use in D3 for creating line graph
- Plotting a line graph along with Bar graph in d3js. Issue with Date
- d3js Node & line drag, zoom working fine, but when pan all graph - is shaking
- How to add a single data point to a line graph in D3 without redrawing
- d3 js line graph takes two different data formats. how do I differentiate those two?
- How to Create different kinds of grid lines using D3 in the same graph
- Convert existing d3 live stream line graph to use seconds elapsed instead of time
More Query from same tag
- d3js negative and positive barplot looses its alignment when more bars added
- D3.js bar chart animation not exiting correctly
- How to split area-spline area in different colors in c3js
- How to format a date using d3's time.format
- Pie (donut) chart segment order in D3
- Blank screen with d3js
- D3JS Barchart : How to allow repeated x-axis label values?
- D3 Chord Example Hover Issue in IE11
- d3 chart not updating properly
- Position circles on a horizontal axis without overlapping using force layout
- How to arrange dates in a drop-down list according their natural way using D3.js
- Why does this D3 code not produce any output in Jupyter Notebook?
- Javascript D3-fetch write to csv
- d3.geomap is undefined in Grails application
- How to show values in C3.js in Donut Legend?
- d3.classed() with multiple selections
- Arrowed SVG gradient with d3.js
- Generating PDF/SVG/PNG with multiple D3.js graphs on one page
- drawing a rectangle on line chart in d3js and nvd3
- d3js brush how to get values for selection
- How i can draw additional x-axis on point 0 of y-axis in d3 graph
- D3 drag error 'Cannot read property x of undefined'
- Preventing overlap of text in D3 pie chart
- Changing the size of arrow boxes of the sunburst visualization
- d3.js Transition on div not working
- How do I apply two svgs on one html page?
- D3.js text. what is wrong in this code.
- Parsing month/day/year date format in D3
- convert multilevel nested array using into json using javascript
- Changing a Shapes position on the page D3/JS