Commit Built Files

This commit is contained in:
Tanner Linsley 2015-10-31 18:22:52 -06:00
parent 3d862962f7
commit 93a79ec470
2 changed files with 66 additions and 71 deletions

129
Chart.js vendored
View File

@ -1556,8 +1556,8 @@
// Find Active Elements for hover and tooltips
if (e.type == 'mouseout') {
this.active = this.lastActive = [];
this.tooltipActive = this.lastTooltipActive = [];
this.active = [];
this.tooltipActive = [];
} else {
this.active = function() {
switch (this.options.hover.mode) {
@ -1639,20 +1639,7 @@
// The usual updates
this.tooltip.initialize();
// Active
if (this.tooltipActive.length) {
this.tooltip._model.opacity = 1;
helpers.extend(this.tooltip, {
_active: this.tooltipActive,
});
} else {
// Inactive
this.tooltip._model.opacity = 0;
}
this.tooltip.update();
this.tooltip._active = this.tooltipActive;
}
// Hover animations
@ -1675,12 +1662,13 @@
// If entering, leaving, or changing elements, animate the change via pivot
if ((this.lastActive.length !== this.active.length) ||
(this.lastActive.length === this.active.length && changed) ||
(this.lastTooltipActive.length !== this.tooltipActive.length) ||
(this.lastTooltipActive.length === this.tooltipActive.length && changed)) {
changed) {
if (this.options.tooltips.enabled || this.options.tooltips.custom) {
this.tooltip.update();
}
this.stop();
console.log('render');
// We only need to render at this point. Updating will cause scales to be recomputed generating flicker & using more
// memory than necessary.
@ -2794,63 +2782,70 @@
var ctx = this._chart.ctx;
var element = this._active[0],
labelColors = [],
tooltipPosition;
if(this._active.length){
this._model.opacity = 1;
var tooltipItems = [];
var element = this._active[0],
labelColors = [],
tooltipPosition;
if (this._options.tooltips.mode == 'single') {
var yScale = element._yScale || element._scale; // handle radar || polarArea charts
tooltipItems.push({
xLabel: element._xScale ? element._xScale.getLabelForIndex(element._index, element._datasetIndex) : '',
yLabel: yScale ? yScale.getLabelForIndex(element._index, element._datasetIndex) : '',
index: element._index,
datasetIndex: element._datasetIndex,
});
tooltipPosition = this._active[0].tooltipPosition();
} else {
helpers.each(this._data.datasets, function(dataset, datasetIndex) {
if (!helpers.isDatasetVisible(dataset)) {
return;
}
var currentElement = dataset.metaData[element._index];
var tooltipItems = [];
if (this._options.tooltips.mode == 'single') {
var yScale = element._yScale || element._scale; // handle radar || polarArea charts
tooltipItems.push({
xLabel: currentElement._xScale ? currentElement._xScale.getLabelForIndex(currentElement._index, currentElement._datasetIndex) : '',
yLabel: yScale ? yScale.getLabelForIndex(currentElement._index, currentElement._datasetIndex) : '',
xLabel: element._xScale ? element._xScale.getLabelForIndex(element._index, element._datasetIndex) : '',
yLabel: yScale ? yScale.getLabelForIndex(element._index, element._datasetIndex) : '',
index: element._index,
datasetIndex: datasetIndex,
datasetIndex: element._datasetIndex,
});
tooltipPosition = this._active[0].tooltipPosition();
} else {
helpers.each(this._data.datasets, function(dataset, datasetIndex) {
if (!helpers.isDatasetVisible(dataset)) {
return;
}
var currentElement = dataset.metaData[element._index];
var yScale = element._yScale || element._scale; // handle radar || polarArea charts
tooltipItems.push({
xLabel: currentElement._xScale ? currentElement._xScale.getLabelForIndex(currentElement._index, currentElement._datasetIndex) : '',
yLabel: yScale ? yScale.getLabelForIndex(currentElement._index, currentElement._datasetIndex) : '',
index: element._index,
datasetIndex: datasetIndex,
});
});
helpers.each(this._active, function(active, i) {
labelColors.push({
borderColor: active._view.borderColor,
backgroundColor: active._view.backgroundColor
});
}, this);
tooltipPosition = this._active[0].tooltipPosition();
tooltipPosition.y = this._active[0]._yScale.getPixelForDecimal(0.5);
}
// Build the Text Lines
helpers.extend(this._model, {
title: this.getTitle(tooltipItems, this._data),
beforeBody: this.getBeforeBody(tooltipItems, this._data),
body: this.getBody(tooltipItems, this._data),
afterBody: this.getAfterBody(tooltipItems, this._data),
footer: this.getFooter(tooltipItems, this._data),
});
helpers.each(this._active, function(active, i) {
labelColors.push({
borderColor: active._view.borderColor,
backgroundColor: active._view.backgroundColor
});
}, this);
tooltipPosition = this._active[0].tooltipPosition();
tooltipPosition.y = this._active[0]._yScale.getPixelForDecimal(0.5);
helpers.extend(this._model, {
x: Math.round(tooltipPosition.x),
y: Math.round(tooltipPosition.y),
caretPadding: tooltipPosition.padding,
labelColors: labelColors,
});
}
else{
this._model.opacity = 0;
}
// Build the Text Lines
helpers.extend(this._model, {
title: this.getTitle(tooltipItems, this._data),
beforeBody: this.getBeforeBody(tooltipItems, this._data),
body: this.getBody(tooltipItems, this._data),
afterBody: this.getAfterBody(tooltipItems, this._data),
footer: this.getFooter(tooltipItems, this._data),
});
helpers.extend(this._model, {
x: Math.round(tooltipPosition.x),
y: Math.round(tooltipPosition.y),
caretPadding: tooltipPosition.padding,
labelColors: labelColors,
});
if (this._options.tooltips.custom) {
this._options.tooltips.custom.call(this, this._model);

8
Chart.min.js vendored

File diff suppressed because one or more lines are too long