Skip to content

Commit

Permalink
Make storing a related data item more generic
Browse files Browse the repository at this point in the history
  • Loading branch information
stuintrepica committed Mar 27, 2012
1 parent 3982865 commit a2c607a
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions g.pie.js
Expand Up @@ -127,7 +127,8 @@
r: r,
value: values[j],
total: total,
label: that.labels && that.labels[j]
label: that.labels && that.labels[j],
data: that.data[j]
};
cover.mouseover(function () {
fin.call(o);
Expand Down Expand Up @@ -159,7 +160,8 @@
r: r,
value: values[j],
total: total,
label: that.labels && that.labels[j]
label: that.labels && that.labels[j],
data: that.data[j]
};
f.call(o);
})(series[i], covers[i], i);
Expand All @@ -183,7 +185,8 @@
r: r,
value: values[j],
total: total,
label: that.labels && that.labels[j]
label: that.labels && that.labels[j],
data: that.data[j]
};
cover.click(function () { f.call(o); });
})(series[i], covers[i], i);
Expand Down Expand Up @@ -231,14 +234,20 @@
chart.push(chart.labels);
};

var setData = function(data) {
data = data || [];
for (var idx = 0; idx < len; idx++) {
opts.data[idx] && (data[idx] = opts.data[idx]);
}
chart.data = data;
}

if (opts.legend) {
legend(opts.legend, opts.legendothers, opts.legendmark, opts.legendpos);
}

if (opts.domhooks) {
for (var idx = 0; idx < len; idx++) {
covers[idx].domhook = opts.domhooks[idx];
}
if (opts.data) {
setData(opts.data);
}

chart.push(series, covers);
Expand Down

0 comments on commit a2c607a

Please sign in to comment.