d3.js

d3 all branches on top of each other vertical dendogram. r2d3 shiny

情到浓时终转凉″ 提交于 2020-01-06 07:41:28
问题 I want to make a vertical dendogram, however all branches are on top of each other, and I don't understand why. enter image description here this is a dendogram based on the flare dataset... The code is meant to go into a shiny app, and that is why i use r2d3. Not sure if this makes a huge difference as the .js doesn't show the proper tree anyway. the code I use right now is: // !preview r2d3 data = read.csv("flare.csv"), d3_version = 4 // Based on: https://bl.ocks.org/mbostock/4063570 var g

d3 all branches on top of each other vertical dendogram. r2d3 shiny

﹥>﹥吖頭↗ 提交于 2020-01-06 07:41:13
问题 I want to make a vertical dendogram, however all branches are on top of each other, and I don't understand why. enter image description here this is a dendogram based on the flare dataset... The code is meant to go into a shiny app, and that is why i use r2d3. Not sure if this makes a huge difference as the .js doesn't show the proper tree anyway. the code I use right now is: // !preview r2d3 data = read.csv("flare.csv"), d3_version = 4 // Based on: https://bl.ocks.org/mbostock/4063570 var g

Summing arrays in JavaScript using d3.nest() Part II

一世执手 提交于 2020-01-06 07:24:37
问题 I recently posted this question about summing arrays in JavaScript using d3.nest() I got a good solution (two in fact), but it turns out both have an issue when adapted to append additional information: data = [ { continent: 'africa', country: 'gabon', values: [1, 2] }, { continent: 'africa', country: 'chad', values: [3, 4] }, { continent: 'asia', country: 'china', values: [1, 2] } ]; sum_by = 'continent'; rollupAgg = function(data, sum_by) { return d3.nest().key(function(d) { return d[sum_by

How to remove gaps in C3 timeseries chart?

最后都变了- 提交于 2020-01-06 07:23:28
问题 I have a timeseries chart created with C3. The chart has time gaps in the data, and this is very noticeable with a bar chart. Is it possible to remove the gaps? I render the chart as shown below. Notice how there's a gap between 2013-01-03 and 2013-01-06 var chart = c3.generate({ data: { x: 'x', type: 'bar', columns: [ ['x', '2013-01-01', '2013-01-02', '2013-01-03', '2013-01-06', '2013-01-07', '2013-01-08'], ['data1', 30, 200, 100, 400, 150, 250] ] }, axis: { x: { type: 'timeseries', tick: {

d3 trying to open html in div or iframe on click

梦想与她 提交于 2020-01-06 07:18:05
问题 I have a d3 bar chart and I would like to have it so when a bar is clicked on the chart, HTML is loaded in another section of the page. As I've been trying to research how to do this, I am becoming more and more confused. Should I use a <div> or an <iframe> ? I have this which works as far as a clicking event goes: .on("click", function() { alert("Hello world"); }) But I don't think I can use it since I want different bars to open different content. So I also need to figure out how to tie

d3 heatmap using nested json data: how to create grids

笑着哭i 提交于 2020-01-06 06:56:28
问题 Referring to this example here: http://bl.ocks.org/tjdecke/5558084 I would like to create a heatmap of 52 rows, and 7 columns. 52 rows represents the 52 weeks of a year, and 7 column represents 7 days of a week. With a dataset like this: (posting abbreviated version below). "days" signify the 7 days of a week, the numbers inside signify number of activity within a day. "total" signifies total number of activity in a week. "week" seems to be a timestamp of sorts. However, I am having

Running the Event-drops demo

北战南征 提交于 2020-01-06 06:56:09
问题 I am trying to get a d3.js library called Event-Drops working under a windows machine. Specifically, I want to run the demo and learn how it all works by tweaking one thing at a time. Now, the github readme for event-drop has instructions to how to do so but I am unable to get anywhere with them. It recommends you install the relevant dependencies first. I am fairly new to the world of JavaScript and according to what I understand the dependencies would require installation of nodejs and a

D3.js line chart: axis with fixed position

喜你入骨 提交于 2020-01-06 06:52:13
问题 i got a normal line chart written in d3.js body { font: 10px sans-serif; } .axis path, .axis line { fill: none; stroke: #000; shape-rendering: crispEdges; } .x.axis { position: fixed; } .x.axis path { display: none; } .line { fill: none; stroke: steelblue; stroke-width: 1.5px; } var margin = {top: 20, right: 80, bottom: 30, left: 50}, width = 2000 - margin.left - margin.right, height = 500 - margin.top - margin.bottom; var parseDate = d3.time.format("%Y%m%d").parse; var x = d3.time.scale()

d3JS v5 specifying domains from nested data for grouped bar charts

邮差的信 提交于 2020-01-06 06:48:44
问题 I am using d3JS v5 (can include lodash as well). I have data which comes as a variable: var groupeddata = [{Title: "Dummy Data", ID: "46", RFU:20291, barcolor: "#ff7f00"}, {Title: "Dummy Data", ID: "50", RFU:63, barcolor: "#ff7f00"}, {Title: "Dummy Data", ID: "56", RFU:6, barcolor: "#ff7f00"}, {Title: "Dummy Data2", ID: "46", RFU:21, barcolor: "#ff7f00"}, {Title: "Dummy Data2", ID: "50", RFU:18095, barcolor: "#ff7f00"}, {Title: "Dummy Data2", ID: "56", RFU:27278, barcolor: "#ff7f00"}];

Sorting method in d3js not working

早过忘川 提交于 2020-01-06 06:48:13
问题 In this bar chart you can sort by clicking the "sort values" checkbox, it works initialy, but if you try to uncheck the box again it stops working. I get no errors from this either, I suspect that it has something to do with data not being loaded properly or some part of my code is structured poorly. Here's a Plunker 回答1: The reason for the unchecking of the sort values to NOT work was the sortIndex . As the data was being sorted, the original data itself was manipulated and the new sortIndex