Fix time point lines. Improved logic for using the value in the time scale. Improve value passing in the line and bubble controllers/

This commit is contained in:
Evert Timberg 2016-07-05 20:52:17 -04:00
parent 3cdd66ca58
commit 758698c354
3 changed files with 6 additions and 3 deletions

View File

@ -73,7 +73,7 @@ module.exports = function(Chart) {
// Desired view properties
_model: {
x: reset ? xScale.getPixelForDecimal(0.5) : xScale.getPixelForValue(data, index, dsIndex, me.chart.isCombo),
x: reset ? xScale.getPixelForDecimal(0.5) : xScale.getPixelForValue(typeof data === 'object' ? data : NaN, index, dsIndex, me.chart.isCombo),
y: reset ? yScale.getBasePixel() : yScale.getPixelForValue(data, index, dsIndex),
// Appearance
radius: reset ? 0 : custom.radius ? custom.radius : me.getRadius(data),

View File

@ -181,7 +181,7 @@ module.exports = function(Chart) {
dataset.pointHitRadius = dataset.hitRadius;
}
x = xScale.getPixelForValue(value, index, datasetIndex, me.chart.isCombo);
x = xScale.getPixelForValue(typeof value === 'object' ? value : NaN, index, datasetIndex, me.chart.isCombo);
y = reset ? yScale.getBasePixel() : me.calculatePointY(value, index, datasetIndex);
// Utility

View File

@ -327,7 +327,10 @@ module.exports = function(Chart) {
},
getPixelForValue: function(value, index, datasetIndex) {
var me = this;
value = moment(value);
if (!value || !value.isValid) {
// not already a moment object
value = moment(me.getRightValue(value));
}
var labelMoment = value && value.isValid && value.isValid() ? value : me.getLabelMoment(datasetIndex, index);
if (labelMoment) {