File: stemplot.js

package info (click to toggle)
r-cran-dygraphs 1.1.1.6%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,232 kB
  • sloc: javascript: 10,787; sh: 19; makefile: 15
file content (21 lines) | stat: -rw-r--r-- 570 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/**
 * stem plotter extracted from series.R
 */
function stemPlotter(e) { 
   var ctx = e.drawingContext; 
   var points = e.points; 
   var y_bottom = e.dygraph.toDomYCoord(0);
   ctx.fillStyle = e.color; 
   for (var i = 0; i < points.length; i++) { 
      var p = points[i]; 
      var center_x = p.canvasx;
      var center_y = p.canvasy; 
      ctx.beginPath(); 
      ctx.moveTo(center_x, y_bottom); 
      ctx.lineTo(center_x, center_y); 
      ctx.stroke();
      ctx.beginPath(); 
      ctx.arc(center_x, center_y, 3, 0, 2*Math.PI); 
      ctx.stroke();
   }
}