d3.js

How to set y axis (yDomain) value to max in D3 Js

你。 提交于 2019-12-25 01:55:15
问题 In My D3 chart, How to set yDomain to the max value. Any suggestions ? If we see on nov 10 my line and area is going out of the box. My Code sandbox here I am calculating the two domains separately for yDomainMagnitude and yDomainStartupMagnitude, but now how to consolidate or take the union of both and assign to yDomain. var yDomainMagnitude = d3.extent(data, function(d) { return d.magnitude; }); var yDomainStartupMagnitude = d3.extent(data, function(d) { return d.startupMagnitude; }); var

Angular + d3.js: Data binding with SVG text attr?

北战南征 提交于 2019-12-25 01:53:05
问题 I'm working on a visualization that involves updating a text element that appear inside of a circle. Something like: <g> <circle></circle> <text>My text that needs updating</text> </g> Along with this small visual is a d3 brush being used as a slider. On brush/brushend, I need to <text>Update the text here</text> , based on data associated with a time scale along the slider's x-axis. I have two Angular directives. One that contains the circle, the other that is the slider. In my slider

d3 js - update transition with multiple lines

无人久伴 提交于 2019-12-25 01:49:42
问题 Almost got it - the y-axis and the two paths update as they should. The text value dosen't and part of the problem is the selection, i select the wrong way. And then it doesn't adhere to the changes in y but instead goes galloping off. Code that almost work: // First transition the line & label to the new city. var t0 = level.data(dsMainArr).transition().duration(750); t0.selectAll(".line") .attr("d", function(d) { return line(d.values); }) .style("stroke", function(d) { return color(d.name);

Transitioning bar chart with combobox variable toggle in d3.js

烈酒焚心 提交于 2019-12-25 01:44:37
问题 I've developed a simple d3.js line graph that allows the user to toggle between variables in a json: http://plnkr.co/edit/8r0DBxVFgY6SJKbukWh5?p=preview However, I need this to be a bar graph instead of a line graph and I can't figure out how to transition bars, or anything else that uses a selectAll to draw, for that matter, such as points. In this case, I've been drawing the bars in the d3.json function like so: svg.selectAll(".bar") .data(data) .enter().append("rect") .attr("class", "bar")

d3 chart redraw not working on window resize

﹥>﹥吖頭↗ 提交于 2019-12-25 01:34:32
问题 I'm displaying several equivalent line charts using d3, that I'm building using a single chart() function, which accepts all the chart data. This chart() function is called as required by a draw() function, which loops through all the placeholder chart elements on the page. I want to redraw all charts when the viewport is resized. So, to do this I'm removing the existing charts using d3.select("svg").remove(); , then calling my draw() function again. Unfortunately, when the charts are redrawn

How to hide folders using partition layout based on available space in D3?

元气小坏坏 提交于 2019-12-25 01:32:48
问题 I am using the Zoomable Icicle layout example in D3 found here: http://bl.ocks.org/mbostock/1005873 and would like to hide some sub-folders within a folder based on certain conditions i.e. if it has not been recently modified and based on available screen space (if this is possible). I would then like the sub-folders that meet the criteria to make up the entire space underneath their parent folders, but the parent folder should have an arrow to show that there are hidden sub-folders within

D3 - Update pattern in stacked area chart

青春壹個敷衍的年華 提交于 2019-12-25 01:16:20
问题 I have a demo here It's a D3 stacked area chart within an Angular app. I wanted to have a D3 Update pattern in this chart put I can't get it to work using the normal method I use. This doesn't seem to work. areaGroup.selectAll('path') .data(data) areaGroup .enter() .append('path') .attr('class', (d, i) => 'path_'+(i+1) ) .attr('d', areaGenerator) How can I use the General Update Pattern with a Stacked Area Chart 来源: https://stackoverflow.com/questions/56872020/d3-update-pattern-in-stacked

D3 dynamic network slow when adding nodes realtime

霸气de小男生 提交于 2019-12-25 00:52:31
问题 I am struggling to work out why my codepen is slow when I stream the nodes and links real-time. In the codepen, I have simulated the real-time stuff by having links1 and nodes1 array. I am adding the nodes and links using forEach and calling add_prc and add_conn respectively which internally calls the refresh to display the newly added node or link. please click the reset button to start the simulation. 回答1: Minor change to fix a major issue. Here's a screenshot which will clearly explain the

D3 chart: While using d3.axisLeft(y) method, how do I prevent Y-Axis grid-lines from using the entire chart width

孤街浪徒 提交于 2019-12-25 00:52:16
问题 First of all, I apologize for such a long post and my absolute beginner knowledge about D3 framework. I have managed to draw the following chart using D3 framework. However, I am not been able to accomplish the following things: 1) Cannot draw Y-Axis vertical sideline 2) Cannot make the Y-Axis ticks to align centered. At the moment they all are left-aligned 3) Cannot make the color of X-Axis baseline same as Y-Axis gridlines 4) Cannot make the label "Growth Target (7)" center-aligned Right

Ploting box plot from statistical summary data

巧了我就是萌 提交于 2019-12-25 00:29:39
问题 I would like to add a box plot to my page. Something like this (using Plotly.js). The problem with implementing the example from the link above is that the plotly.js library expect all the points, whereas I only have access to the already computed statistical data. In other words, I would like to plot the graphic by passing max , min , med , avr , stdev (statistical data of the series) instead of all the data points themselves. P.s.: Using plotly.js is not a requirement. I could go with D3.js