d3.js

Box plot with dual dimension and dual x-axis using dc.js

时光毁灭记忆、已成空白 提交于 2020-03-04 05:04:10
问题 Is it possible with dc.js to draw two x-axis of a graph i.e. one is below and one is above. One Dimension/ x-axis contain a b and above x-axis contain 1 (a b with below a-axis) 2 (a b with below x-axis). An img is attached to explain the view. If it is possible kindly give some suggestion. Regards. 回答1: As for adding lines between the box plots, here is a hacky solution that works ok. Would probably need some work to make it general. Assume we have the domain ( ['1A', '1B', '2A, '2B', ...] )

Legend not appearing when using document.createElement('canvas')

只愿长相守 提交于 2020-03-03 07:31:27
问题 I followed this Observable post to easily create a legend. Since the line DOM.canvas(1, n) in the ramp works only on Observable, I replaced it with document.createElement("canvas") and also modified the SVG so that it's appended to the main div tag. These changed do not cause any errors however the problem is that the legend is not displayed even though the legend SVG is present in the raw HTML. Here's the link to a JSFiddle. Any guidance would be greatly appreciated. 回答1: The canvas is being

Legend not appearing when using document.createElement('canvas')

▼魔方 西西 提交于 2020-03-03 07:31:08
问题 I followed this Observable post to easily create a legend. Since the line DOM.canvas(1, n) in the ramp works only on Observable, I replaced it with document.createElement("canvas") and also modified the SVG so that it's appended to the main div tag. These changed do not cause any errors however the problem is that the legend is not displayed even though the legend SVG is present in the raw HTML. Here's the link to a JSFiddle. Any guidance would be greatly appreciated. 回答1: The canvas is being

dc.js Incorporate regression chart into existing scatterplot with crossfilter

别说谁变了你拦得住时间么 提交于 2020-03-02 09:41:32
问题 I am using dc.js and crossfilter.js to create a d3 dashboard, and am wondering how to implement a regression line into a scatterplot chart that responds to filtering. I have been playing with a few examples re adding a regression line, but I have been unsuccessful extracting and incorporating the code. I don't have a problem with the math, but rather with how to access the filtered data from the dimension, and then how to add the regression line to to the filtered scatterplot chart (so that

d3 v4 geo draws boundary inverted

梦想与她 提交于 2020-03-01 08:35:13
问题 When I draw the Bermuda Triangle in an SVG element the scale is not what I expect (triangle should extend to edges of box) and the fill is backward (instead of drawing a triangle, it draws a square with a triangle cut out). var geojson = { "features": [ { "type": "Feature", "properties": { "name": "Bermuda Triangle", "area": 1150180 }, "geometry": { "type": "Polygon", "coordinates": [ [ [-64.73, 32.31], [-80.19, 25.76], [-66.09, 18.43], [-64.73, 32.31] ] ] } } ], "type":"FeatureCollection" };

d3 v4 geo draws boundary inverted

微笑、不失礼 提交于 2020-03-01 08:35:05
问题 When I draw the Bermuda Triangle in an SVG element the scale is not what I expect (triangle should extend to edges of box) and the fill is backward (instead of drawing a triangle, it draws a square with a triangle cut out). var geojson = { "features": [ { "type": "Feature", "properties": { "name": "Bermuda Triangle", "area": 1150180 }, "geometry": { "type": "Polygon", "coordinates": [ [ [-64.73, 32.31], [-80.19, 25.76], [-66.09, 18.43], [-64.73, 32.31] ] ] } } ], "type":"FeatureCollection" };

Is there a way to add a highlight to pie chart in d3?

守給你的承諾、 提交于 2020-02-28 07:04:22
问题 I hope I'm using the correct term, but basically I am trying to create highlight along the top of a pie chart in D3. I've seen lot's of things for adding drop shadows but have been unable to make that work for a highlight. So, I tried adding an arc on top of the chart and adding a gaussian blur to it, but there are 2 issues with it: it doesn't transition with the rest of the chart and the highlighting extends above the chart, I can't seem to get it to stay within the edges of the chart. Here

Adding new segments to a Animated Pie Chart in D3.js

时间秒杀一切 提交于 2020-02-27 12:05:13
问题 I am unable to add a segment to a D3.js pie chart. I know I need to use .enter() and .append() to stage the new data -- but I am not sure how to apply that when I have the arcs grouped (which I need for the labels). Here is my update function: var updateChart = function(dataset) { arcs.data(donut(dataset)); arcs.transition() .duration(duration) .attrTween("d", arcTween); sliceLabel.data(donut(dataset)); sliceLabel.transition() .duration(duration) .attr("transform", function(d) { return

Adding new segments to a Animated Pie Chart in D3.js

人走茶凉 提交于 2020-02-27 12:05:07
问题 I am unable to add a segment to a D3.js pie chart. I know I need to use .enter() and .append() to stage the new data -- but I am not sure how to apply that when I have the arcs grouped (which I need for the labels). Here is my update function: var updateChart = function(dataset) { arcs.data(donut(dataset)); arcs.transition() .duration(duration) .attrTween("d", arcTween); sliceLabel.data(donut(dataset)); sliceLabel.transition() .duration(duration) .attr("transform", function(d) { return

how to roll up dc stacked-bar example into single bar?

我怕爱的太早我们不能终老 提交于 2020-02-25 07:14:38
问题 "http://dc-js.github.io/dc.js/examples/stacked-bar.html" I want to roll this kind of dataset into a single bar stacked-bar chart. I changed the speedSumGroup = runDimension.group().reduce(function(p, v) { p[v.Expt] = (p[v.Expt] || 0) + v.Speed; return p; }, function(p, v) { p[v.Expt] = (p[v.Expt] || 0) - v.Speed; return p; }, function() { return {}; }); to speedSumGroup2 = runDimension.groupAll().reduce(function(p, v) { and inspecting the group shows the data rolled up to the single expected.