d3.js

Rects won't show up on d3 histogram

微笑、不失礼 提交于 2020-01-06 18:13:58
问题 I'm using Polymer to render some d3 charts. When the Polymer is initially rendered I only draw a graph with axes and no data, since the data comes later once the API calls succeed. However, when I get around to adding the 'rect' elements in the svg, despite them showing up in the Chrome devtools element inspector, they don't show up in the chart itself. dataChanged: function() { var data = this.data; var margin = {top: 20, right: 20, bottom: 30, left: 50}, width = this.width - margin.left -

Rects won't show up on d3 histogram

Deadly 提交于 2020-01-06 18:13:21
问题 I'm using Polymer to render some d3 charts. When the Polymer is initially rendered I only draw a graph with axes and no data, since the data comes later once the API calls succeed. However, when I get around to adding the 'rect' elements in the svg, despite them showing up in the Chrome devtools element inspector, they don't show up in the chart itself. dataChanged: function() { var data = this.data; var margin = {top: 20, right: 20, bottom: 30, left: 50}, width = this.width - margin.left -

D3 SVG issue in Internet Explorer

廉价感情. 提交于 2020-01-06 18:05:34
问题 I am having some trouble in displaying a scrolling legends using D3 and SVG. My legends vary based on data and can be of any range. from 1 to 150 here's a simple working fiddle: https://jsfiddle.net/bikrantsharma/eqnnd84v/ On Chrome: everything works fine it scrolls well But in IE the container displays of a smaller height and all the legends are displaying real small and with no scroll coz the max-height is never hit. I have read somewhere that IE does not determine the SVG height correctly

D3 SVG issue in Internet Explorer

巧了我就是萌 提交于 2020-01-06 17:58:37
问题 I am having some trouble in displaying a scrolling legends using D3 and SVG. My legends vary based on data and can be of any range. from 1 to 150 here's a simple working fiddle: https://jsfiddle.net/bikrantsharma/eqnnd84v/ On Chrome: everything works fine it scrolls well But in IE the container displays of a smaller height and all the legends are displaying real small and with no scroll coz the max-height is never hit. I have read somewhere that IE does not determine the SVG height correctly

Unable to display legend for a quantile scale in D3

余生颓废 提交于 2020-01-06 17:36:45
问题 I am trying to display a legend for a heat map I have created, but am unable to do that. Here is my HTML <html> <head> <title>Heat Map Data Visualization</title> </head> <body> <div class='chart-area'> <svg class='chart'></svg> <svg class='legend'></svg> </div> </body> </html> Here is the code for the legend I am trying to create var legend = d3.select('.legend') .data([0].concat(colorScale.quantiles()), function(d){ return d; }); legend.enter() .append('g') .attr('class', 'legend-element');

Uncaught SyntaxError: Unexpected end of JSON input

前提是你 提交于 2020-01-06 16:20:46
问题 I am trying to get d3 design based on input MySQL table value id name parent A 1 A 0 A 2 A1 1 A 3 A2 1 B 4 B 0 B 5 B1 4 php code to get mysql data into json format to use in d3 UPDATED PHP AND JSON RESULT BASED ON @Z-BONE ANSWER index.php <?php if(isset($_GET['input'])) { $con=mysqli_connect("localhost","root","admin321","php"); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $name=$_GET['input']; $sql="SELECT * FROM tab where value LIKE '%".$name

Sort bars on nvd3 charts

有些话、适合烂在心里 提交于 2020-01-06 15:17:50
问题 Is there a easy way to sort bars (ascending or descending) on Nvd3 discreteBarChart or on the HorizontalBarChart . I think a function should be added to the main lib (Nvd3) so that the option can be used as below: .sortAscending(true) //Used for ascending bars according to their value or .sortDescending(true) //Used for descending bars according to their value 回答1: try this, i implemented in my application, include this in your addGraph method before returning chart object var parent = $('svg

How to create legend for D3 Sequence Sunburst?

限于喜欢 提交于 2020-01-06 15:08:11
问题 I'm modifying the original D3 Sequence Sunburst file to better suit my needs. The original colors variable is a hard-coded object. This clearly cannot be the best method. I'm using the flare.json example, which is larger, harder to read, and still much smaller than the json file I will be user after testing. I'd like to randomly generate colors, apply them to each datum in the createvisualization function, but I'm new to D3, and do not know how to 1) fetch names (everything but the leaves)

function to calculate the averages of children's size D3 js

送分小仙女□ 提交于 2020-01-06 15:01:50
问题 Hi I'm doing something like this http://bl.ocks.org/mbostock/1283663 But in this exemple, parent's size are the sum of there children's size, I would like that the parent's size will be the average of there children's size. So i need to Implement a function to calculate the averages as I wish -- function average(d) in my example -- and replace all occurrences of .attr("width", function(d) { return x(d.value); }) with .attr("width", function(d) { return x(average(d)); }). But i don't know how

Specify x-axis labels in D3

会有一股神秘感。 提交于 2020-01-06 14:50:36
问题 I have a stackedAreaChart in d3.js X-axis labels are 9 dates which I have formatted using tickFormat method. However, I want chart to take each date. Currently it takes every 2nd date. var dates = ["Jun 07","Jun 08","Jun 09","Jun 10","Jun 11","Jun 12","Jun 13"]; chart.xAxis.ticks(9); chart.xAxis .tickFormat(function(d,e,f) { if(d===1||d==7){ return '' } return dates[d-1]; }); How can I do that? Thanks! 来源: https://stackoverflow.com/questions/26549761/specify-x-axis-labels-in-d3