Skip to content

Commit

Permalink
Merge pull request #85 from larsenmtl/master
Browse files Browse the repository at this point in the history
Support for stacked percent plugin
  • Loading branch information
Roundaround committed Aug 1, 2014
2 parents 82473fc + e80e87a commit ace3614
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions js/jquery.flot.tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@
var yPatternWithoutPrecision = "%y";
var customTextPattern = "%ct";

var x, y, customText;
var x, y, customText, p;

// for threshold plugin we need to read data from different place
if (typeof item.series.threshold !== "undefined") {
Expand Down Expand Up @@ -313,9 +313,14 @@
content = content(item.series.label, x, y, item);
}

// percent match for pie charts
if( typeof (item.series.percent) !== 'undefined' ) {
content = this.adjustValPrecision(percentPattern, content, item.series.percent);
// percent match for pie charts and stacked percent
if (typeof (item.series.percent) !== 'undefined'){
p = item.series.percent;
} else if (typeof (item.series.percents) !== 'undefined'){
p = item.series.percents[item.dataIndex];
}
if( typeof p === 'number' ) {
content = this.adjustValPrecision(percentPattern, content, p);
}

// series match
Expand Down

0 comments on commit ace3614

Please sign in to comment.