area

D3.js streamgraph example - generating correct area function values

跟風遠走 提交于 2019-12-01 11:18:16
I'm new to d3js and trying to adapt the streamgraph example from here http://bl.ocks.org/mbostock/4060954 : ...to work with my own data that tracks visitors to an art exhibition from different places (online, guestbook, museum). I've made some progress and I think my data's in the right format but I'm getting some really wonky final y values and my example isn't showing anything. My data starts as csv: index,date,venue,num_visitors 0,4/6/2013,online,3844 0,4/6/2013,museum,789 0,4/6/2013,guestbook,20 1,4/7/2013,online,217 1,4/7/2013,museum,718 1,4/7/2013,guestbook,20 And then I nest it to

Correct usage of stack.values([accessor]) in D3 Streamgraph?

老子叫甜甜 提交于 2019-12-01 09:56:00
问题 I am trying to create a D3 streamgraph chart with additional data per layer using a values accessor, as demonstrated in the D3 API reference and this question at Stack Overflow. The title appends fine, but it does not appear to append the values. Any ideas on what might be going wrong? I'm new to d3 so I'm sure it's straightforward. The code is below. var layers = [ { "name": "apples", "values": [ { "x": 0, "y": 91}, { "x": 1, "y": 290} ] }, { "name": "oranges", "values": [ { "x": 0, "y": 9},

D3.js streamgraph example - generating correct area function values

坚强是说给别人听的谎言 提交于 2019-12-01 08:49:18
问题 I'm new to d3js and trying to adapt the streamgraph example from here http://bl.ocks.org/mbostock/4060954: ...to work with my own data that tracks visitors to an art exhibition from different places (online, guestbook, museum). I've made some progress and I think my data's in the right format but I'm getting some really wonky final y values and my example isn't showing anything. My data starts as csv: index,date,venue,num_visitors 0,4/6/2013,online,3844 0,4/6/2013,museum,789 0,4/6/2013

Java: calculating area of a triangle

最后都变了- 提交于 2019-12-01 06:28:56
import java.lang.Math; import java.awt.* public class Triangle implements Shape { java.awt.Point a; java.awt.Point b; java.awt.Point c; public Triangle(java.awt.Point a, java.awt.Point b, java.awt.Point c) { this.a = a; this.b = b; this.c = c; } public double getArea( ) { double area; return area = Math.abs((a-c)*(b-a)-(a-b)*(c-a)); } ... http://upload.wikimedia.org/math/f/e/5/fe56529cdaaaa9bb2f71c1ad8a1a454f.png <--area formula I am trying to calculate the area of a triangle from 3 points (x,y) from a 2D Cartesian coordinate system. I'm assuming that my above formula correctly yields the area

Java: calculating area of a triangle

自作多情 提交于 2019-12-01 04:12:27
问题 import java.lang.Math; import java.awt.* public class Triangle implements Shape { java.awt.Point a; java.awt.Point b; java.awt.Point c; public Triangle(java.awt.Point a, java.awt.Point b, java.awt.Point c) { this.a = a; this.b = b; this.c = c; } public double getArea( ) { double area; return area = Math.abs((a-c)*(b-a)-(a-b)*(c-a)); } ... http://upload.wikimedia.org/math/f/e/5/fe56529cdaaaa9bb2f71c1ad8a1a454f.png <--area formula I am trying to calculate the area of a triangle from 3 points (x

jQuery or any: Possible to make only a part of a div clickable?

守給你的承諾、 提交于 2019-12-01 01:52:25
is it possible to make only a part of a div clickable -- like a clickmap/imagemap? May with jQuery? Hint: i don't want edit the html (misused template with 200 separate html files). When your div is clicked, the event handler receives the event, so you can test the position of the click. If needed, you might want to use the clicked element position and size, using $(this).offset() , $(this).width() and $(this).height() . For example : $('mydivselector').click(function(e) { if (e.pageY > $(this).offset().top + 0.5*$(this).height()) { // bottom was clicked } else { // up of the div was clicked }

Calculate area under FFT graph in MATLAB

落爺英雄遲暮 提交于 2019-11-30 21:58:59
Currently I did a FFT of a set of data which gives me a plot with frequency at x axis and amplitude at y axis. I would like to calculate the area under the graph to give me the energy. I am not sure how to determinate the area because I am without the equation and also I only want a certain area of the plot rather than whole area under the plot. Is there a way I can do it? There are many ways to do numerical integration with Matlab. Here is an example: %# create some data x = linspace(0,pi/2,100); %# 100 equally spaced points between 0 and pi/2 y = sin(x); %# integrate using trapz, which

How to arrange N rectangles to cover minimum area [duplicate]

不问归期 提交于 2019-11-30 20:48:20
Possible Duplicate: Algorithm needed for packing rectangles in a fairly optimal way I have N rectangles, each of a random size (random width & height). All rectangles are parallel to the X & Y axes. I'm looking for an algorithm that helps me arrange these rectangles side-by-side in a way that the resulting bounding rectangle has minimum area and the potential gaps around / between the input rectangles are as small as possible. Rectangles cannot be rotated and may not overlap each other. (I need these to automate the arrangement of game sprites so I can create sprite sheets and save sprite

How can I calculate the area within a contour in Python using the Matplotlib?

Deadly 提交于 2019-11-30 16:08:57
I am trying to figure out a way to get the area inside a specific contour line? I use matplotlib.pyplot to create my contours. Does anyone have experience for this? Thanks a lot. From the collections attribute of the contour collection, which is returned by the contour function, you can get the paths describing each contour. The paths' vertices attributes then contain the ordered vertices of the contour. Using the vertices you can approximate the contour integral 0.5*(x*dy-y*dx), which by application of Green's theorem gives you the area of the enclosed region. However, the contours must be

Python: Histogram with area normalized to something other than 1

怎甘沉沦 提交于 2019-11-30 15:09:56
问题 Is there a way to tell matplotlib to "normalize" a histogram such that its area equals a specified value (other than 1)? The option "normed = 0" in n, bins, patches = plt.hist(x, 50, normed=0, histtype='stepfilled') just brings it back to a frequency distribution. 回答1: Just calculate it and normalize it to any value you'd like, then use bar to plot the histogram. On a side note, this will normalize things such that the area of all the bars is normed_value . The raw sum will not be normed