nvd3.js

nvd3 piechart.js - How to edit the tooltip? version 1.8

别来无恙 提交于 2020-01-17 13:53:19
问题 I have am using piechart by nvd3. Lately I upgraded nvd3 to 1.8.1 and I need to overwrite tooltip. This is my code from older version: piechartCurrent.tooltip.contentGenerator(function (obj) { content = '<h3 style="background-color: '; content += obj.color + '">'; content += obj.data.key + '</h3><p>$' + Math.round(obj.data.y * 100) / 100 + ' ('+ obj.data.symbols +')</p>'; return content; }); Which looks like this: But I would like to use new style for tooltip: What is html code for new

nvd3 piechart.js - How to edit the tooltip? version 1.8

二次信任 提交于 2020-01-17 13:52:10
问题 I have am using piechart by nvd3. Lately I upgraded nvd3 to 1.8.1 and I need to overwrite tooltip. This is my code from older version: piechartCurrent.tooltip.contentGenerator(function (obj) { content = '<h3 style="background-color: '; content += obj.color + '">'; content += obj.data.key + '</h3><p>$' + Math.round(obj.data.y * 100) / 100 + ' ('+ obj.data.symbols +')</p>'; return content; }); Which looks like this: But I would like to use new style for tooltip: What is html code for new

Howto set custom ticks and labels on Y axis in nvd3

泪湿孤枕 提交于 2020-01-17 04:25:47
问题 I'd like to set custom tick number and labels for my discrete chart done in nvd3. The problem is that labels and values needs to be shown in ratios like 10:1, 8:1 etc. but actual bar height shown as numbers 10, 8 etc. Is there any way to create custom labels on y axis and on mouse over tool-tips in nvd3? 回答1: You can do this using tickFormat (which is actually a raw D3 method): chart.yAxis .tickFormat(function (d) { return d + ':' + 1; }); NVD3 will automatically use that format in the

Formatting/aligning rCharts (nvd3) in shiny app

流过昼夜 提交于 2020-01-16 03:04:13
问题 I am developing a Shiny app which I hope to look like the picture below: However, as I try to achieve this, I am only able to get the following form: I am looking for how to make the output neatly collected, and would appreciate any help. I have looked at a couple of other similar questions here, viz. this and this, but don't think they answer my question (the first talks about adding a mainPanel , but I am using FludiPage and FluidRows . I had thought the columns and rows would automatically

NVD3 chart partly missing grid lines

旧城冷巷雨未停 提交于 2020-01-15 19:18:50
问题 In my chart here, if you can notice, it is missing grid lines for the first 4 and last 4 dates. I tried doing: .ticks(data[0].length) but it didnt help. What am I missing? jsFiddle 回答1: Adding .showMaxMin(false) fixes the problem. chart.xAxis .showMaxMin(false) .axisLabel("My X-Axis") .tickFormat(function(d) { return d3.time.format('%x')(new Date(d)) }); Working example is here 来源: https://stackoverflow.com/questions/24523744/nvd3-chart-partly-missing-grid-lines

NVD3 chart partly missing grid lines

≯℡__Kan透↙ 提交于 2020-01-15 19:18:43
问题 In my chart here, if you can notice, it is missing grid lines for the first 4 and last 4 dates. I tried doing: .ticks(data[0].length) but it didnt help. What am I missing? jsFiddle 回答1: Adding .showMaxMin(false) fixes the problem. chart.xAxis .showMaxMin(false) .axisLabel("My X-Axis") .tickFormat(function(d) { return d3.time.format('%x')(new Date(d)) }); Working example is here 来源: https://stackoverflow.com/questions/24523744/nvd3-chart-partly-missing-grid-lines

How can i add an image in nvd3 piechart legend?

你。 提交于 2020-01-15 11:56:13
问题 I want to add an image in nvd3 piechart legend instead of text. I have this code but it changes only the text in the tooltip with the image. I want to change and the text in the legend with the same image. var testdata = [ { key: "<img src="+"./imgs/facebook.jpg"+">", y: 1 }, { key: ""<img src="+"./imgs/twitter.jpg"+">"", y: 2 } ]; nv.addGraph(function() { var chart = nv.models.pieChart() .x(function(d) { return d.key}) .labelThreshold(.08) .showLabels(true) .color(d3.scale.category10().range

giving axis ticks more space in nvd3

 ̄綄美尐妖づ 提交于 2020-01-15 10:45:27
问题 I am constructing a horizontal bar plot in nvd3 with domain names as x-labels. The domain names, while not too long, are longer than the amount of space given to them. How do I increase the amount of space given to an axis in nvd3 ? jsfiddle example here. 回答1: Apparently, you can specify your own margins. For example: var chart = nv.models.multiBarHorizontalChart() .margin({top: 30, right: 10, bottom: 30, left: 90}) // increase the left margin .x(function(d) { return d[0]; }) .y(function(d) {

giving axis ticks more space in nvd3

半腔热情 提交于 2020-01-15 10:45:08
问题 I am constructing a horizontal bar plot in nvd3 with domain names as x-labels. The domain names, while not too long, are longer than the amount of space given to them. How do I increase the amount of space given to an axis in nvd3 ? jsfiddle example here. 回答1: Apparently, you can specify your own margins. For example: var chart = nv.models.multiBarHorizontalChart() .margin({top: 30, right: 10, bottom: 30, left: 90}) // increase the left margin .x(function(d) { return d[0]; }) .y(function(d) {