d3.js

dc.js / d3.js - How to hide a bar chart x-axis category value if its bar value equals zero?

感情迁移 提交于 2020-01-15 02:32:37
问题 I know this question has been asked before, but I have not found an answer that works for me. I looked into https://github.com/dc-js/dc.js/wiki/FAQ#filter-the-data-before-its-charted and tried the remove_empty_bins function but nothing changed. I also tried the filter_bins function but I am getting the error message "f is not a function". I am working on a dashboard. I want the bar charts to update such that the x-axis categories are removed from the graph when they are zero and will reappear

dc.js / d3.js - How to hide a bar chart x-axis category value if its bar value equals zero?

天大地大妈咪最大 提交于 2020-01-15 02:30:21
问题 I know this question has been asked before, but I have not found an answer that works for me. I looked into https://github.com/dc-js/dc.js/wiki/FAQ#filter-the-data-before-its-charted and tried the remove_empty_bins function but nothing changed. I also tried the filter_bins function but I am getting the error message "f is not a function". I am working on a dashboard. I want the bar charts to update such that the x-axis categories are removed from the graph when they are zero and will reappear

Increasing clickable area of an edge in D3 diagram

a 夏天 提交于 2020-01-14 18:57:27
问题 I have a graph being made by d3, with dagre-d3 sitting on top of it for drawing directed graphs. This gives me what I expect for rendering the graph: To edit the data building the graph, each element is click-able. This is fine for the cases where the edges are rendered with labels, but they don't always have labels, leading to the unlabeled edges being very hard to click to edit. These style assigned to the edges is: #visitGraph .edgePath { cursor: pointer; stroke: #333; stroke-width: 2px;

d3.js moving average with previous and next data values

与世无争的帅哥 提交于 2020-01-14 14:32:07
问题 I'm new to D3 and trying to do a moving average of previous and next values on my data in order to smooth it out. Currently, I have it working using the 2 previous values + the current value. It does work but 1) how would I also use the next values, and 2) what if I wanted to use the 15 previous and 15 next values? (it would be crazy to have 30 individual vars for storing all of them) I'm used to traditional javascript but lost as to how to traverse the data this way in D3. Hope someone can

I can tween a D3 arc's endAngle, but not it's startAngle. What am I doing wrong?

二次信任 提交于 2020-01-14 13:15:03
问题 I'm just playing with this demo and recreating it myself: http://bl.ocks.org/mbostock/5100636 I can define a new endAngle and it'll animate just fine, but now I'm trying to animate the startAngle too. I just can't get it to work. function animateArc(newStart, newEnd) { myArc.transition().duration(750).call(arcTween, newStart, newEnd); function arcTween(transition, newStart, newEnd) { transition.attrTween("d", function(d) { var interpolateStart = d3.interpolate(d.startAngle, startAngle); var

I can tween a D3 arc's endAngle, but not it's startAngle. What am I doing wrong?

我的梦境 提交于 2020-01-14 13:14:36
问题 I'm just playing with this demo and recreating it myself: http://bl.ocks.org/mbostock/5100636 I can define a new endAngle and it'll animate just fine, but now I'm trying to animate the startAngle too. I just can't get it to work. function animateArc(newStart, newEnd) { myArc.transition().duration(750).call(arcTween, newStart, newEnd); function arcTween(transition, newStart, newEnd) { transition.attrTween("d", function(d) { var interpolateStart = d3.interpolate(d.startAngle, startAngle); var

D3: .transition() not working with events

久未见 提交于 2020-01-14 11:51:28
问题 I'm busy plotting a bar chart using D3 in Angular4. // Enter Phase this.chart.selectAll('.bar') .data(this.barData) .enter() .append('rect') .attr('class', 'bar'); // Update Phase let bars = this.chart.selectAll('.bar').transition() .attr('x', (d) => {return this.x(this.parseTime(d.date.toUpperCase()));}) .attr('y', (d) => {return this.y(d.point)}) .attr('width', 15) .attr('height', (d) => {return this.charDimensions.height - this.y(d.point);}) .on("mouseover", function (d) {D3.select(this)

D3: .transition() not working with events

自作多情 提交于 2020-01-14 11:48:46
问题 I'm busy plotting a bar chart using D3 in Angular4. // Enter Phase this.chart.selectAll('.bar') .data(this.barData) .enter() .append('rect') .attr('class', 'bar'); // Update Phase let bars = this.chart.selectAll('.bar').transition() .attr('x', (d) => {return this.x(this.parseTime(d.date.toUpperCase()));}) .attr('y', (d) => {return this.y(d.point)}) .attr('width', 15) .attr('height', (d) => {return this.charDimensions.height - this.y(d.point);}) .on("mouseover", function (d) {D3.select(this)

D3: .transition() not working with events

主宰稳场 提交于 2020-01-14 11:48:26
问题 I'm busy plotting a bar chart using D3 in Angular4. // Enter Phase this.chart.selectAll('.bar') .data(this.barData) .enter() .append('rect') .attr('class', 'bar'); // Update Phase let bars = this.chart.selectAll('.bar').transition() .attr('x', (d) => {return this.x(this.parseTime(d.date.toUpperCase()));}) .attr('y', (d) => {return this.y(d.point)}) .attr('width', 15) .attr('height', (d) => {return this.charDimensions.height - this.y(d.point);}) .on("mouseover", function (d) {D3.select(this)

d3.js change zoom behavior to semantic zoom

喜欢而已 提交于 2020-01-14 11:48:08
问题 I'm doing some tests with d3.js regarding zooming. At the moment, I have successfully implemented geometric zoom in my test, but it has a drawback: the elements under the zoomed g are being scaled. As I understood it, this could be solved by using semantic zooming. The problem is that I need scale in my test, as I'm syncing it with a jQuery.UI slider value . On the other hand, I would like the text elements being resized to maintain their size after a zoom operation. I have an example of my