d3.js

D3 JS - tick spacing on time axis gets messed up by month boundary

一笑奈何 提交于 2020-01-13 16:54:08
问题 Using d3.js, I found that when using a time scale for the x-axis, the major tick marks get messed up on a new month boundary. It appears to create a new tick mark on the new month even if that results in a tick too close to the previous tick. Not only does this mess up the even spacing along the axis, it also makes the tick labels overlap and look pretty ugly. See the demo at the bottom of the question to show what I mean (scroll to the right to see the problem area). Do I need a custom multi

x-axis dates don't align with y-axis data in nvd3

无人久伴 提交于 2020-01-13 13:04:15
问题 I am using NVD3 with Flask and I have dates on the x-axis. As you can see the lines on x-axis don't coincide with the points. I printing out the day, month, year and hours on the x-axis. I don't understand why the dates are not equally spaced i.e the 'hours' are not the same even though my x-axis data is, so that the lines are more than "24 hrs" apart. I think this is causing the problem. (Edited) My code is: nv.addGraph(function() { var chart = nv.models.lineChart(); chart.xAxis .tickFormat

x-axis dates don't align with y-axis data in nvd3

China☆狼群 提交于 2020-01-13 13:03:15
问题 I am using NVD3 with Flask and I have dates on the x-axis. As you can see the lines on x-axis don't coincide with the points. I printing out the day, month, year and hours on the x-axis. I don't understand why the dates are not equally spaced i.e the 'hours' are not the same even though my x-axis data is, so that the lines are more than "24 hrs" apart. I think this is causing the problem. (Edited) My code is: nv.addGraph(function() { var chart = nv.models.lineChart(); chart.xAxis .tickFormat

How to update d3 table?

血红的双手。 提交于 2020-01-13 12:24:27
问题 I have some problem to update my d3.js table when mousemoving. Here is a simplified example in jsfiddle. Here is the main code: function mousemove() { var newdata = [{Variable: "x", Value: 1}, {Variable: "y", Value: 1}] table.selectAll("tbody.tr") .data(newdata) .enter() .append("tr") .selectAll("td") .data(function(row) { return columns.map(function(column) { return {column: column, value: row[column]}; }); }) .enter() .append("td") .text(function(d) { return d.value; }); }; namely, how can

How to update d3 table?

 ̄綄美尐妖づ 提交于 2020-01-13 12:24:02
问题 I have some problem to update my d3.js table when mousemoving. Here is a simplified example in jsfiddle. Here is the main code: function mousemove() { var newdata = [{Variable: "x", Value: 1}, {Variable: "y", Value: 1}] table.selectAll("tbody.tr") .data(newdata) .enter() .append("tr") .selectAll("td") .data(function(row) { return columns.map(function(column) { return {column: column, value: row[column]}; }); }) .enter() .append("td") .text(function(d) { return d.value; }); }; namely, how can

D3 axis labels become too fine grained when zoomed in

我的梦境 提交于 2020-01-13 08:55:33
问题 I'm trying to create an axis function that the ticks/labels are dynamic meaning they hide/show automatically. BUT on top of that, I want at some zoom level to stop rendering more ticks/labels. Here's an example: At first the axis shows the years, then when you zoom in the ticks become Months, and when you zoom further in it shows the days (I.E., Dec 28). Except I want to restrict d3 such that when zooming further than the months, it doesn't render any more ticks because months are the

D3 axis labels become too fine grained when zoomed in

十年热恋 提交于 2020-01-13 08:55:11
问题 I'm trying to create an axis function that the ticks/labels are dynamic meaning they hide/show automatically. BUT on top of that, I want at some zoom level to stop rendering more ticks/labels. Here's an example: At first the axis shows the years, then when you zoom in the ticks become Months, and when you zoom further in it shows the days (I.E., Dec 28). Except I want to restrict d3 such that when zooming further than the months, it doesn't render any more ticks because months are the

d3.js and TypeScript compilation error

你离开我真会死。 提交于 2020-01-13 08:22:55
问题 I'm working through the example Force Dragging I and have been able to get this to work with plain JavaScript. However, I have a compilation error when trying to use TypeScript. The problem code (with extraneous parts removed) is: import * as d3 from "d3"; interface INode { id: string; group: number; } interface ILink { source: string; target: string; value: number; } interface IGraph { nodes: INode[]; links: ILink[]; } var svg = d3.select("svg"); d3.json("data/miserables.json", function

What is the proper way to use D3's projection.stream()?

岁酱吖の 提交于 2020-01-13 07:32:48
问题 So I'm experimenting a bit with D3's geo stream API , and things feel a bit hazy. I've been reading through the documentation here: https://github.com/mbostock/d3/wiki/Geo-Streams One point of confusion I have is the proper implementation of stream transforms. Let's say I create one: //a stream transform that applies a simple translate [20,5]: var transform = d3.geo.transform({ point:function(){this.stream.point(x+20,y+5)} }) Per the documentation, this.stream references the "wrapped stream."

Angular2 and D3.js Gantt chart

守給你的承諾、 提交于 2020-01-13 07:01:31
问题 I have an angular2 app which i am attempting to implement a Gantt chart from d3.js into. I am trying to use the following example http://bl.ocks.org/dk8996/5538271. obviously this uses javascript rather than typescript. However i have got most of it seeming ok, but i get one issue. Here is my whole method: createSchedule() { var tasks = [{"startDate":new Date("Sun Dec 09 01:36:45 EST 2012"),"endDate":new Date("Sun Dec 09 02:36:45 EST 2012"),"taskName":"E Job","status":"RUNNING"}]; var