mirror of
https://github.com/chartjs/Chart.js.git
synced 2026-03-04 15:34:04 +01:00
Consider all timestamps for bar measuring (#7421)
* Consider all timestamps for bar measuring * Fix watched tests for updated file names * Add test of sparse bar time scales
This commit is contained in:
@@ -14,7 +14,7 @@ module.exports = function(karma) {
|
||||
// we will prefer the unminified build which is easier to browse and works
|
||||
// better with source mapping. In other cases, pick the minified build to
|
||||
// make sure that the minification process (terser) doesn't break anything.
|
||||
const regex = args.watch ? /Chart\.js$/ : /Chart\.min\.js$/;
|
||||
const regex = args.watch ? /chart\.js$/ : /chart\.min\.js$/;
|
||||
const build = builds.filter(v => v.output.file.match(regex))[0];
|
||||
|
||||
if (args.watch) {
|
||||
|
||||
@@ -686,7 +686,7 @@ class TimeScale extends Scale {
|
||||
me._majorUnit = !tickOpts.major.enabled || me._unit === 'year' ? undefined
|
||||
: determineMajorUnit(me._unit);
|
||||
me._table = buildLookupTable(getTimestampsForTable(me), min, max, distribution);
|
||||
me._offsets = computeOffsets(me._table, getDataTimestamps(me), min, max, options);
|
||||
me._offsets = computeOffsets(me._table, timestamps, min, max, options);
|
||||
|
||||
if (options.reverse) {
|
||||
ticks.reverse();
|
||||
|
||||
57
test/fixtures/scale.time/bar-large-gap-between-data.js
vendored
Normal file
57
test/fixtures/scale.time/bar-large-gap-between-data.js
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
var date = moment('May 24 2020', 'MMM DD YYYY');
|
||||
|
||||
module.exports = {
|
||||
threshold: 0.05,
|
||||
config: {
|
||||
type: 'bar',
|
||||
data: {
|
||||
datasets: [{
|
||||
backgroundColor: 'rgba(255, 0, 0, 0.5)',
|
||||
data: [
|
||||
{
|
||||
x: date.clone().add(-2, 'day'),
|
||||
y: 20,
|
||||
},
|
||||
{
|
||||
x: date.clone().add(-1, 'day'),
|
||||
y: 30,
|
||||
},
|
||||
{
|
||||
x: date,
|
||||
y: 40,
|
||||
},
|
||||
{
|
||||
x: date.clone().add(1, 'day'),
|
||||
y: 50,
|
||||
},
|
||||
{
|
||||
x: date.clone().add(7, 'day'),
|
||||
y: 10,
|
||||
}
|
||||
]
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
legend: false,
|
||||
scales: {
|
||||
x: {
|
||||
display: false,
|
||||
type: 'time',
|
||||
distribution: 'linear',
|
||||
ticks: {
|
||||
source: 'auto'
|
||||
},
|
||||
time: {
|
||||
unit: 'day'
|
||||
}
|
||||
},
|
||||
y: {
|
||||
display: false
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
options: {
|
||||
spriteText: true
|
||||
}
|
||||
};
|
||||
BIN
test/fixtures/scale.time/bar-large-gap-between-data.png
vendored
Normal file
BIN
test/fixtures/scale.time/bar-large-gap-between-data.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.7 KiB |
Reference in New Issue
Block a user