nvd3.js

React: Pass function to a child not working

送分小仙女□ 提交于 2019-12-11 14:28:02
问题 I am having trouble with passing a function to child in React . I read multiple threads on stackoverflow that talk about binding such functions to this or using arrow functions, but still can not resolve it. Basically I need to pass function called datum to d3.select().datum() : class BarChart extends React.Component { constructor(props){ super(props) this.createBarChart = this.createBarChart.bind(this) } componentDidMount() { this.createBarChart() } componentDidUpdate() { this.createBarChart

Appending text to points in angular-nvd3

瘦欲@ 提交于 2019-12-11 14:06:48
问题 I'm currently redesigning some visualizations to go from static embedded output from R to interactive graphs using angular-nvd3. I've made considerable progress and have nearly finished re-implementing all the options necessary. However, the last part that is evading me is figuring out how to add persistent labels to all the data points. While I have customized tooltips for this, it was one of the client requests to have names display as a toggle, so I don't think I can get around it. Is

NVD3 Chart responsive issue

邮差的信 提交于 2019-12-11 13:45:41
问题 NVD3 Responsive issue I have code from my second page where I used the exactly same chart like here. But on that page it is responsive and I am trying to figure out why the chart is not responsive here. var colors = ["rgba(74, 210, 255, .8)", "rgba(85, 172, 238, .8)", "rgba(205, 32, 31, .8)"]; d3.scale.colors = function() { return d3.scale.ordinal().range(colors); }; var colors = d3.scale.colors(); /*var colors = d3.scale.category20();*/ var keyColor = function(d, i) {return colors(d.key)};

Javascript Date object returning December 31st 1969

穿精又带淫゛_ 提交于 2019-12-11 12:09:34
问题 If you are using a date in the form of milliseconds does it need to be converted to a string in order for the Date object to recognize it? "values":[ {x:1390636800000 , y:12} , { x:1390640400000 , y:17} , { x:1390644000000 , y:17}, { x:1390647600000 , y:15}, { x:1390651200000 , y:8} ] If so, how would i go about converting it so that it is used properly by chart.xAxis .axisLabel("Time (s)") .tickFormat(function(d){return d3.time.format('%I%p')(new Date(d))}); and it doesn't spit out the

Angular NVD3 Change Colors In Legends Also

穿精又带淫゛_ 提交于 2019-12-11 10:58:17
问题 I am using AngularJS wrapper of NVD3 -angularjs-nvd3-directives. I managed to change colors in the chart but the colors are not reflected in the legends. Here is the fiddle http://jsfiddle.net/vishal1shukla2/NChH9/1/ <div ng-app='nvd3TestApp'> <div ng-controller="ExampleCtrl"> <nvd3-pie-chart data="exampleData" id="exampleId" showLabels="true" x="xFunction()" y="yFunction()" donut="true" donutRatio="0.3" donutLabelsOutside="false" width="400" height="400" color="colorFunction()" showLegend=

Line Graph using D3 is not starting from the date i want it to

让人想犯罪 __ 提交于 2019-12-11 10:55:20
问题 Below is my line graph where I am using 2 lines to show different values, One line is blue and the other is red. however the red line i want to start from 'Dec 27'(half way of the graph) instead of the start of the graph. I have been looking ways to do this but honestly I'm not sure how I can. if someone is able to show me how i would appreciate that a lot. Thanks you in advance! This is my css: path.line { fill: none; stroke: #004ecc; stroke-width: 4px; } path.line2 { fill: none; stroke:

Add vertical line to line chart in rChart NVD3 (nPlot)

倾然丶 夕夏残阳落幕 提交于 2019-12-11 09:56:00
问题 I would like to add several vertical lines indicating particular events in a line chart created with nPlot. Any suggestions? library(reshape2) library(ggplot2) library(rCharts) ecm <- reshape2::melt(economics[,c('date', 'uempmed', 'psavert')], id = 'date') p7 <- nPlot(value ~ date, group = 'variable', data = ecm, type = 'lineWithFocusChart') Final goal: add vertical lines with labels at 'date' = '1967-11-30', '2001-11-30', '1968-01-31', etc. 回答1: Ok, so this should answer the question. I

Recovering x-axis value on click - NVD3 LineChart

自古美人都是妖i 提交于 2019-12-11 09:04:24
问题 Is there any way to recover the x axis value on click event in the lineChart() of NVD3? The closest I get is by this answer: nvd3.js : unable to bind onClick event with the data points in the svg But what I want is to recover the x axis value and redirect to another page, passing it as parameter. I tried this approach too, similar as one that I use on multiBarChart, but unsuccessful: $("g.nv-point-paths").on("hover", function (d) { $("path").off("click"); $("path").on("click", function (d) {

draw horizontal lines for bars in nvd3 multi bar chart

让人想犯罪 __ 提交于 2019-12-11 08:53:17
问题 I want to draw 2 horizontal lines for each of the bars in this nvd3 multibar chart Here is the fiddle I have few queries Why is yValueScale(0) not starting from 0 of the plot How do I start drawing the lines from where the bar starts? The xValueScale("A") does not start from the start of the bar of A How do I get to know the width of the bar to draw the line of length equal to the bar width 回答1: You are appending the line to the wrong "container". The svg variable is the entire svg container,

nvd3 multibar chart: toggle default values to show

廉价感情. 提交于 2019-12-11 08:29:42
问题 I'm new to d3 and am trying to learn using nvd3. Right now, I'm playing with the multibar chart here. I'm trying to set it so that on the page load, "Stream #1" and "Stream #2" are toggled to the disabled state — that is, only "Stream #0" should be displayed when the page is loaded, and you should have to click the "Stream #1" and "Stream #2" buttons to toggle those values on the graph. There doesn't seem any documentation that shows setting the default state as an option, so I've tried to