Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var srcs = [ "romney.png", "gingrich.png", "paul.png", "santorum.png", "perry.png"];
- var images = [];
- var loadCount = 0;
- for (var i = 0; i < srcs.length; i++) {
- images[i] = new Image();
- images[i].addEventListener('load', function () {
- loadCount++;
- if (loadCount == srcs.length) {
- drawGraph();
- }
- }, false);
- images[i].src = srcs[i];
- }
- function drawGraph() {
- var xyz = {
- "Romney": images[0],
- "Gingrich": images[1],
- "Paul": images[2],
- "Santorum" : images[3],
- "Perry" : images[4]
- };
- g = new Dygraph(
- document.getElementById("demodiv"), data,
- {
- labels: ["Date","Romney","Gingrich","Paul","Santorum","Perry"],
- pointSize: 1,
- drawPoints: true,
- connectSeparatedPoints: true,
- drawPointCallback: function(g, series, ctx, cx, cy, color, radius) {
- var img = xyz[series];
- console.log(series, cx, cy);
- },
- width:2400,
- height: 800,
- }
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement