日期:2014-05-16 浏览次数:20401 次
tooltipFormatter: function (pointFormat) {
var point = this,
series = point.series,
seriesTooltipOptions = series.tooltipOptions,
match = pointFormat.match(/\{(series|point)\.[a-zA-Z]+\}/g),
dataSum = pointFormat.match(/\{(dataSum)\.[0-9]+\}/g),//dataSum 我自己添加的
splitter = /[{\.}]/,
obj,
key,
replacement,
repOptionKey,
parts,
prop,
ratio,//ratio我自己添加的
i,
cfg = { // docs: percentageDecimals, percentagePrefix, percentageSuffix, totalDecimals, totalPrefix, totalSuffix
y: 0, // 0: use 'value' for repOptionKey
open: 0,
high: 0,
low: 0,
close: 0,
percentage: 1, // 1: use the self name for repOptionKey
total: 1
};
// Backwards compatibility to y naming in early Highstock
seriesTooltipOptions.valuePrefix = seriesTooltipOptions.valuePrefix || seriesTooltipOptions.yPrefix;
seriesTooltipOptions.valueDecimals = seriesTooltipOptions.valueDecimals || seriesTooltipOptions.yDecimals;
seriesTooltipOptions.valueSuffix = seriesTooltipOptions.valueSuffix || seriesTooltipOptions.ySuffix;
// loop over the variables defined on the form {series.name}, {point.y} etc
for (i in match) {
key = match[i];
if (isString(key) && key !== pointFormat) { // IE matches more than just the variables
// Split it further into parts
parts = (' ' + key).split(splitter); // add empty string because IE and the rest handles it differently
obj = { 'point': point, 'series': series}[parts[1]];
/*原为prop = parts[2];下面是我改的*/
if (parts[2]