mirror of
https://github.com/chartjs/Chart.js.git
synced 2025-12-08 20:36:08 +00:00
Fix bumpy line on smooth data set (#4944)
Linear scale getPixelForValue() method doesn't round the returned value anymore.
This commit is contained in:
parent
447ca40a7f
commit
e080e782ab
@ -170,11 +170,10 @@ module.exports = function(Chart) {
|
||||
|
||||
if (me.isHorizontal()) {
|
||||
pixel = me.left + (me.width / range * (rightValue - start));
|
||||
return Math.round(pixel);
|
||||
} else {
|
||||
pixel = me.bottom - (me.height / range * (rightValue - start));
|
||||
}
|
||||
|
||||
pixel = me.bottom - (me.height / range * (rightValue - start));
|
||||
return Math.round(pixel);
|
||||
return pixel;
|
||||
},
|
||||
getValueForPixel: function(pixel) {
|
||||
var me = this;
|
||||
|
||||
@ -759,8 +759,8 @@ describe('Chart', function() {
|
||||
|
||||
// Verify that points are at their initial correct location,
|
||||
// then we will reset and see that they moved
|
||||
expect(meta.data[0]._model.y).toBe(333);
|
||||
expect(meta.data[1]._model.y).toBe(183);
|
||||
expect(meta.data[0]._model.y).toBeCloseToPixel(333);
|
||||
expect(meta.data[1]._model.y).toBeCloseToPixel(183);
|
||||
expect(meta.data[2]._model.y).toBe(32);
|
||||
expect(meta.data[3]._model.y).toBe(484);
|
||||
|
||||
|
||||
@ -764,7 +764,7 @@ describe('Core.Tooltip', function() {
|
||||
|
||||
it('Should not update if active element has not changed', function() {
|
||||
var chart = window.acquireChart({
|
||||
type: 'bar',
|
||||
type: 'line',
|
||||
data: {
|
||||
datasets: [{
|
||||
label: 'Dataset 1',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user