d3.js

SVG <g> element dragging causes flickering issue using d3

两盒软妹~` 提交于 2020-01-16 19:46:46
问题 I have been trying to use d3 library for drag n drop of dvg element by using transform translate. I am able to drag an element but it flickers while dragging. I have been searching and doing trial and error so far from below links but it doesn't help me. "Stuttering" drag when using d3.behavior.drag() and transform D3.js: Dragging everything in group ('g') by element contained in the group using origin() function How to drag an svg group using d3.js drag behavior? For the last link, I think I

D3js highlight bar one by one continuously

萝らか妹 提交于 2020-01-16 19:10:28
问题 Here is the sample fiddle Below code is to create bar svg.selectAll("rect") .data(dataset, key) .enter() .append("rect") .attr("x", function(d, i) { return xScale(i); }) .attr("y", function(d) { return h - yScale(d.value); }) .attr("width", xScale.rangeBand()) .attr("height", function(d) { return yScale(d.value); }) .attr("fill", function(d) { return "blue"; }) //Tooltip .on("mouseover", function(d) { d3.select(this).style("fill","red"); }) .on("mouseout", function() { d3.select(this).style(

Conditional coloring in dc charts

我与影子孤独终老i 提交于 2020-01-16 18:54:12
问题 I am using dc.js a to create a pie chart to show gain and loss, How can I put some condition based on which the color of the pie chart changes. I have tried using .colors(['#fdd752', '#AEC785', '#a48ad4', '#3acdc7']) // (optional) define color domain to match your data domain if you want to bind data or color .colorDomain([-1750, 1644]) // (optional) define color value accessor .colorAccessor(function (d, i) {console.log(d); return d.value; }) Any ideas? 回答1: Just like X-axis scales, the

Conditional coloring in dc charts

泄露秘密 提交于 2020-01-16 18:53:08
问题 I am using dc.js a to create a pie chart to show gain and loss, How can I put some condition based on which the color of the pie chart changes. I have tried using .colors(['#fdd752', '#AEC785', '#a48ad4', '#3acdc7']) // (optional) define color domain to match your data domain if you want to bind data or color .colorDomain([-1750, 1644]) // (optional) define color value accessor .colorAccessor(function (d, i) {console.log(d); return d.value; }) Any ideas? 回答1: Just like X-axis scales, the

Conditional coloring in dc charts

▼魔方 西西 提交于 2020-01-16 18:53:07
问题 I am using dc.js a to create a pie chart to show gain and loss, How can I put some condition based on which the color of the pie chart changes. I have tried using .colors(['#fdd752', '#AEC785', '#a48ad4', '#3acdc7']) // (optional) define color domain to match your data domain if you want to bind data or color .colorDomain([-1750, 1644]) // (optional) define color value accessor .colorAccessor(function (d, i) {console.log(d); return d.value; }) Any ideas? 回答1: Just like X-axis scales, the

How to group X-axis points in react C3js?

断了今生、忘了曾经 提交于 2020-01-16 18:24:31
问题 I started working on react-c3js and got stuck into some problem. Below is my X-axis array: "axis": {"x": ["4 2018", "4 2018", "5 2018", "5 2018", "6 2018", "6 2018", "6 2018", "6 2018", "6 2018", "6 2018", "6 2018", "6 2018", "6 2018", "7 2018", "7 2018", "7 2018", "7 2018", "7 2018", "7 2018", "7 2018", "7 2018", "7 2018", "7 2018", "7 2018", "7 2018", "7 2018", "8 2018", "8 2018", "8 2018", "8 2018", "8 2018", "8 2018", "8 2018", "8 2018", "8 2018", "8 2018", "8 2018", "8 2018", "8 2018",

sync d3.js map and leaflet map

十年热恋 提交于 2020-01-16 18:02:48
问题 In one application I have both d3 map and leaflet map, I follow Mike's code to sync them(http://bost.ocks.org/mike/leaflet/) and draw svg points on leaflet map. The problem is that some points being cutoff at the edge of SVG container, and other SVG elements added later on (an animated pulse in this case) will only partially shown. I wonder if there's anyway to expand the SVG container based on the features (points) bound. a working demo is here: http://xqin1.github.io/usschools/usac_school

sync d3.js map and leaflet map

我与影子孤独终老i 提交于 2020-01-16 18:00:09
问题 In one application I have both d3 map and leaflet map, I follow Mike's code to sync them(http://bost.ocks.org/mike/leaflet/) and draw svg points on leaflet map. The problem is that some points being cutoff at the edge of SVG container, and other SVG elements added later on (an animated pulse in this case) will only partially shown. I wonder if there's anyway to expand the SVG container based on the features (points) bound. a working demo is here: http://xqin1.github.io/usschools/usac_school

json mysql data to d3 plot

前提是你 提交于 2020-01-16 12:08:27
问题 I am trying to plot mysql data with d3. I am using php to convert to json format but it does not work yet! For testing purposes I followed the steps indicated here I used simple-graph.html with my own php file on XAMPP. include('connect.php'); $result=$con->query("SELECT date, close FROM testable"); echo json_encode($result->fetchAll(PDO::FETCH_ASSOC)); It echoes in json format like so: [{"date":"1-May-12","close":"43.32"},{"date":"30-Apr-12","close":"22.54"},{"date":"27-Apr-12","close":"21