mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-07 12:49:07 +02:00
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:
parent
3cdd66ca58
commit
758698c354
@ -73,7 +73,7 @@ module.exports = function(Chart) {
|
|||||||
|
|
||||||
// Desired view properties
|
// Desired view properties
|
||||||
_model: {
|
_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),
|
y: reset ? yScale.getBasePixel() : yScale.getPixelForValue(data, index, dsIndex),
|
||||||
// Appearance
|
// Appearance
|
||||||
radius: reset ? 0 : custom.radius ? custom.radius : me.getRadius(data),
|
radius: reset ? 0 : custom.radius ? custom.radius : me.getRadius(data),
|
||||||
|
@ -181,7 +181,7 @@ module.exports = function(Chart) {
|
|||||||
dataset.pointHitRadius = dataset.hitRadius;
|
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);
|
y = reset ? yScale.getBasePixel() : me.calculatePointY(value, index, datasetIndex);
|
||||||
|
|
||||||
// Utility
|
// Utility
|
||||||
|
@ -327,7 +327,10 @@ module.exports = function(Chart) {
|
|||||||
},
|
},
|
||||||
getPixelForValue: function(value, index, datasetIndex) {
|
getPixelForValue: function(value, index, datasetIndex) {
|
||||||
var me = this;
|
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);
|
var labelMoment = value && value.isValid && value.isValid() ? value : me.getLabelMoment(datasetIndex, index);
|
||||||
|
|
||||||
if (labelMoment) {
|
if (labelMoment) {
|
||||||
|
Loading…
Reference in New Issue
Block a user