score:1
It turn out it's a bug, in case anyone else need the patch you can use I've done a pull request:
score:2
You could do the following:
Define a function that converts epoch to a nice date. Something like this:
function epochToNiceDate(epoch) { var date = new Date(0); date.setUTCSeconds(epoch); var day = date.getDate(); var month = date.getMonth() + 1; var year = date.getFullYear(); return day + "-" + month + "-" + year; }
Pass a content generator function for your tooltip to your chart (assuming you have useInteractiveGuideline enabled). You could browse the source code of NVD3 and copy/paste the default content generator and then modify it as you wish. Let's use the following one as an example:
chart.interactiveLayer.tooltip.contentGenerator(function (d) { var tooltipTitle = epochToNiceDate(d.value); var tooltip = ""; tooltip += "<table>"; tooltip += "<thead>"; tooltip += "<tr><td colspan='3'><strong class='x-value'>" + tooltipTitle + "</strong></td></tr>"; tooltip += "</thead>"; tooltip += "<tbody>" for(var i in d.series) { var currentSeries = d.series[i]; var color = currentSeries.color; var key = currentSeries.key; var value = currentSeries.value; tooltip += "<tr>"; tooltip += " <td class='legend-color-guide'>"; tooltip += " <div style='background-color: " + color + ";'></div>"; tooltip += " </td>"; tooltip += " <td class='key'>" + key + "</td>"; tooltip += " <td class='value'>" + value + "</td>"; tooltip += "</tr>"; } tooltip += "</tbody>"; tooltip += "</table>"; return tooltip; });
You can see it in action here: https://jsfiddle.net/Luc93/qf4u5439/
Good luck!
Source: stackoverflow.com
Related Query
- NVD3: multiChart wrong format for series
- Change date format for xAxis in nvd3 chart
- Not default json format for nvd3 or d3
- Maintain color mapping for Stacked/Grouped Multi-Bar Chart using NVD3 when the series count fluxuates
- Angular nvD3 Stacked Area Chart Data Series Format
- How do I display dates on the x-axis for nvd3 / d3.js?
- 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?
- Proper format for drawing polygon data in D3
- Understanding nvd3 x-axis date format
- abbreviated month format for x-axis in d3.js
- nvd3 tooltip decimal format
- how to stack series in nvd3 multibar angularjs directive
- C3.js - Show/hide points independently for a data series
- D3 - data format required for cal-heatmap calendar heatmap?
- How can I style a tooltip for an NVD3 Chart?
- custom x axis tooltip for nvd3 scatter chart
- d3 time format for YYYY-MM-DD ie. 2013-02-04
- Best way to format a JSON for D3 Forced Directed
- What format should data be in for a Dangle JS graph?
- Rickshaw : data for multiple series not working
- Programatically disable series on nvd3 Horizontal Multi-Bar Chart
- Correct date format for Rickshaw
- Passing data for nvd3 chart from Flask as an argument
- How to plot different line patterns for different lines in DC.js series chart?
- nvd3 - Format Milliseconds to h:m:s in Chart (Period of Time, not Date)
- How to return Neo4j OGM entities in GraphJSON format instead of tree format for visualization?
- How to use series.stack = false in dimple.js to suppress aggregation; different symbols for each series
- nvd3 remove tooltip content for empty points
- Disable legend click on NVD3 multichart
- Custom label for x axis on nvd3 graphs
More Query from same tag
- Manipulating data prior to display in dimplejs
- How to "map" JSON values from a second Object level with d3.js
- calling svg.selectAll(X).data().enter() multiple times
- D3: two x-axis with independent zoom behavior
- How to make bars have different patterns in d3.js?
- Built-in category colors alternative
- Wrapping long text in d3.js
- D3 Tooltip for updated pie chart
- d3 How to trigger event on the object behind text
- Sizing of SVG foreignObject element to fit HTML element
- Set attribute of circle from another circle's attribute using d3.select?
- Preparing Data to Plot in d3.js from Ruby on Rails Database
- cal-heatmap onclick on day, scroll to the week's section
- Forcing Links to Draw Under Nodes
- unable to select element : node cannot be found
- Adding drop down menu using d3.js
- D3 Path with random colored lines
- I am trying make a sunburst diagram using tornado data
- d3 vertical bar chart
- How to merge two .csv files in javascript?
- d3 functions not working in node.js when rendering charts from the server side
- Interactive SVG / control through links
- how can set customize color to pie chart using D3.js?
- how to make ticks function work in d3.js?
- Getting started with d3.js, what files are needed?
- TypeError for "offsetParent" property of d3 svg selection in Firefox
- How to redraw my d3.js chart with data from html form?
- Using json data in d3
- How to create SVG shapes based on data?
- google maps with d3 paths as a layer using (d3 v4)