nvd3.js

rCharts rNVD3 tooltip customisation

我只是一个虾纸丫 提交于 2019-12-19 09:16:11
问题 I have the following problem; I am using the rCharts wrapper around NVD3 to produce a simple line chart. I wish to modify the default tootip behavior. Using the NVD3 library I have been able to do this with the following code; .tooltipContent(function(key,x ,y,e,graph){ var idx = x.replace("s","") var thumbPath = 'snap_' + idx + '.png' return '<h3>' + key + '</h3>' + '<p>' + y + ' at ' + x + '</p>' + '<img src="'+ thumbPath+ '" alt="some_text">' }) This shows different thumbnails for

rCharts rNVD3 tooltip customisation

可紊 提交于 2019-12-19 09:16:06
问题 I have the following problem; I am using the rCharts wrapper around NVD3 to produce a simple line chart. I wish to modify the default tootip behavior. Using the NVD3 library I have been able to do this with the following code; .tooltipContent(function(key,x ,y,e,graph){ var idx = x.replace("s","") var thumbPath = 'snap_' + idx + '.png' return '<h3>' + key + '</h3>' + '<p>' + y + ' at ' + x + '</p>' + '<img src="'+ thumbPath+ '" alt="some_text">' }) This shows different thumbnails for

With NVD3.js (nv.models.lineWithFocusChart), how do you set specific ticks on X-axis, when x values are dates?

青春壹個敷衍的年華 提交于 2019-12-19 04:13:12
问题 I'm using nv.models.lineWithFocusChart, where I'm showing some hourly measurements. So the x domain is dates. What I need is to show a tick per hour on X axis: 00:00 01:00 02:00 ... 24:00 I've tried everything I could find but nothing works. It seems that its easy to set specific ticks when values are not dates. But can't figure out how to do it for dates. Here's the code that creates the graph, if it can help: nv.addGraph -> chart = nv.models.lineWithFocusChart(view) chart.yAxis.tickFormat

NVD3.js multiChart x-axis labels is aligned to multiple lines, but not multiple bars

核能气质少年 提交于 2019-12-19 02:49:29
问题 This question relates to NVD3.js multiChart x-axis labels is aligned to lines, but not bars I am using NVD3.js multiChart to show multiple lines and multiple bars in the chart. All is working fine, but the x-axis labels is aligned only to the line points, not bars. I want to correctly align labels directly below the bars as it should. But I get this: As you can see - x-axis (example, 2014-Feb) is not aligned to Bars . 1) How to align x-axis labels to bars and lines at the same time ? 2) I

nvd3 line chart, how to remove gridlines and yaxis

左心房为你撑大大i 提交于 2019-12-18 15:56:06
问题 I have made a line chart with view finder. Here is my initial code var chart = nv.models.lineWithFocusChart(); // chart.transitionDuration(500); chart.xAxis .tickFormat(d3.format(',g')); chart.xAxis .axisLabel("Date"); chart.xAxis.tickPadding(0); chart.x2Axis .tickFormat(d3.format(',g')); chart.yAxis .tickFormat(d3.format(',.2g')); chart.y2Axis .tickFormat(d3.format(',.2h')); // chart.showYAxis(false); I want to remove the y axis labels ( i.e. i want no number showing on the y axis). I also

NVD3 Line chart tics wrongly aligned to grid when using datetype on xAxis

烂漫一生 提交于 2019-12-18 09:08:16
问题 I am currently working with NVD3 using Angular Directive (angular-nvd3). I have a very simple line chart with very simple data. The problem I have encountered now is that my data is wrongly aligned with the Axis. Example plunker available here: http://plnkr.co/edit/jWEYt6?p=preview , I am using dates on my xAxis, which are parsed using d3 library: tickFormat: function(d) {return d3.time.format('%d/%m')(new Date(d))} Description: I would expect the xAxis labels to be correspondent to the grid.

How to do wordwrap for chart labels using d3.js

痞子三分冷 提交于 2019-12-18 04:07:24
问题 I am trying to implement the horizontal bar chart using d3.js.Some of the chart labels are too long. How to do word wrap for the chart labels on y aixs? Source code: var data = [{"Name": "Label 1", "Count": "428275" }, { "Name": "Label 2", "Count": "365005" }, { "Name": "Label 3", "Count": "327619" }]; var m = [30, 10, 10, 310], w = 1000 - m[1] - m[3], h = 550 - m[0] - m[2]; var format = d3.format(",.0f"); var x = d3.scale.linear().range([0, w + 10]), y = d3.scale.ordinal().rangeRoundBands([0

Real time line graph with nvd3.js

两盒软妹~` 提交于 2019-12-17 22:19:50
问题 I am trying to create a real time graph using nvd3.js which would be updated periodically and with the impression that the data is processed in real time. For now I have been able to create a function which would update the graph periodically but I cannot manage to have a smooth transition between "states" like the line doing a transition to the left. Here is what I did using nvd3.js , here the interesting code is: d3.select('#chart svg') .datum(data) .transition().duration(duration) .call

How to customize color in pie chart of NVD3

瘦欲@ 提交于 2019-12-17 17:54:30
问题 I am trying to use NVD3 http://nvd3.org/livecode/#codemirrorNav a pie chart. But i want to change the default color. How do i change the color. i am not able to do it. 回答1: To use your own colours you will have to override the existing colours, I prefer not to tinker around with the original code. So this is what I did. var myColors = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"]; d3.scale.myColors = function() { return d3.scale

Draw a circle at a point on an NVD3 line chart

半腔热情 提交于 2019-12-14 03:57:23
问题 how to draw a circle on a peak point in line chart nvd3 e.x: nv.addGraph(function() { var chart = nv.models.lineChart() .useInteractiveGuideline(true) ; chart.xAxis .axisLabel('Time (ms)') .tickFormat(d3.format(',r')) ; chart.yAxis .axisLabel('Voltage (v)') .tickFormat(d3.format('.02f')) ; d3.select('#chart svg') .datum(data()) .transition().duration(500) .call(chart) ; nv.utils.windowResize(chart.update); return chart; }); this is an example of line chart and i want to show a circle on