d3.js

d3.js two graphs on same page is on top of each other

核能气质少年 提交于 2020-01-06 12:37:43
问题 I have 2 graphs each in separate angular directive <chart1 ng-model="data" style="display:block;" id="plot1" class="ng-pristine ng-valid"> <svg width="960" height="500" style="right: 0px;">Some data</svg> </chart1> <chart2 ng-model="data" style="display:block;" id="plot1" class="ng-pristine ng-valid"> <svg width="960" height="500" style="right: 0px;">Some data</svg> </chart2> chart1 generation of svg: var svg = d3.select("#plot1").append("svg") .attr("width", width + margin.left + margin

d3.js two graphs on same page is on top of each other

ぃ、小莉子 提交于 2020-01-06 12:37:10
问题 I have 2 graphs each in separate angular directive <chart1 ng-model="data" style="display:block;" id="plot1" class="ng-pristine ng-valid"> <svg width="960" height="500" style="right: 0px;">Some data</svg> </chart1> <chart2 ng-model="data" style="display:block;" id="plot1" class="ng-pristine ng-valid"> <svg width="960" height="500" style="right: 0px;">Some data</svg> </chart2> chart1 generation of svg: var svg = d3.select("#plot1").append("svg") .attr("width", width + margin.left + margin

d3.js two graphs on same page is on top of each other

岁酱吖の 提交于 2020-01-06 12:37:04
问题 I have 2 graphs each in separate angular directive <chart1 ng-model="data" style="display:block;" id="plot1" class="ng-pristine ng-valid"> <svg width="960" height="500" style="right: 0px;">Some data</svg> </chart1> <chart2 ng-model="data" style="display:block;" id="plot1" class="ng-pristine ng-valid"> <svg width="960" height="500" style="right: 0px;">Some data</svg> </chart2> chart1 generation of svg: var svg = d3.select("#plot1").append("svg") .attr("width", width + margin.left + margin

D3.js: How to create the pop-up event when moving mouse on the svg?

南楼画角 提交于 2020-01-06 09:06:16
问题 everyone. I've got one question about how to return the data.value with the "mouse" event. The following code can get the current X-Position(show on the ), while I've no idea how to return the obj.value . I've checked the method used at drought-crops, but still stuck on it. Can anyone give me some ideas about it? I guess some of you have met such kind of scenario. Inspired from Zoomable Area and Zoomable Map Tiles created by mbostock. (Add the following code into Zoomable Area to debug)

D3.js: How to create the pop-up event when moving mouse on the svg?

[亡魂溺海] 提交于 2020-01-06 09:03:03
问题 everyone. I've got one question about how to return the data.value with the "mouse" event. The following code can get the current X-Position(show on the ), while I've no idea how to return the obj.value . I've checked the method used at drought-crops, but still stuck on it. Can anyone give me some ideas about it? I guess some of you have met such kind of scenario. Inspired from Zoomable Area and Zoomable Map Tiles created by mbostock. (Add the following code into Zoomable Area to debug)

How to pass data to c3 graph

梦想的初衷 提交于 2020-01-06 08:45:17
问题 Here is my JS code: var abc = JSON.stringify(dataObject); var chart = c3.generate({ bindto: '#container', data: { json: abc, keys: { x:'_id', value: ['a', 'b','c','d'], }, axis: { x: { type: 'timeseries', } } } }); The above code gives error: undefined is not a function. However if I directly give the same data directly without storing in a variable, the code works. Please let me know what the mistake is. 回答1: i got the Answer , it works fine with me . Remove JSON.stringify(dataObject). it

Clearing and updating svg on click

狂风中的少年 提交于 2020-01-06 08:34:05
问题 From the bl.ocks here, I am attempting to assign an on-click button that: Removes the current shapes, hopefully by a smooth transition. Depending on button click, returns the selected visual. Even if it is on the same visual, it will remove and reload the same one. The transition I am hoping to get is found here but triggered with a click rather than a random interval. I have tried a bunch of different ways without much results, my current attempt is to remove the current rects before calling

D3 Chaining Animations with a for loop

落花浮王杯 提交于 2020-01-06 08:26:05
问题 I want to chain d3 animations over a for loop. What is the best way to achive something like this: for (var i=0; i<dat.length-1; i++) { var a = function(g,dat,i){ /* g.transition().duration(i * 19) .attr("cy", dat[i+1].y1) .attr("cx", dat[i+1].x1) .attr("r", 10);*/ console.log("transform " + dat[i+1].x1); }; var t = setTimeout(a(g,dat,i), i*20); } This is of corse not working, since you can not pass objects to setTimeout functions. 回答1: You can use transition.delay() to chain transitions.

D3 select: submit form dynamically?

限于喜欢 提交于 2020-01-06 07:59:30
问题 I'm using D3. I have click-handling code for an input to stop form submission and do some validation. Then if validation succeeds, I want to submit the form. How do I submit the form programmatically, using D3 selectors? form.submit() says the submit method does not exist. (I'm confident that form is the form element.) I'm also trying form.dispatch('submit') but that does not work either: import { select as $, event as d3_event } from "d3"; $(el).on("click", function() { // prevent form

How can I get the id of a record in a d3 scatter plot?

﹥>﹥吖頭↗ 提交于 2020-01-06 07:42:09
问题 I have already attached my data and assigned the ids as follow: svg.selectAll("circle").data(csv).enter().append("circle") .attr("id", function(d){return "row"+d["ROW ID"];}); "ROW ID" is the name of the column that contains the ids of my data. Now I want to add an on-click event to the circles and save the ID of the currently point in a new variable to use it to call other function. Can anyone tell me how to get the "ROW ID" of the currently selected point? thx 回答1: Do you want something