mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 04:09:08 +02:00
Add test for DecimationAlgorithm type (#9010)
* Add test for DecimationAlgorithm type * Allow strings to be set * Linting
This commit is contained in:
parent
55dd426a41
commit
ea7b8cb04f
4
types/index.esm.d.ts
vendored
4
types/index.esm.d.ts
vendored
@ -1961,12 +1961,12 @@ interface BaseDecimationOptions {
|
||||
}
|
||||
|
||||
interface LttbDecimationOptions extends BaseDecimationOptions {
|
||||
algorithm: DecimationAlgorithm.lttb;
|
||||
algorithm: DecimationAlgorithm.lttb | 'lttb';
|
||||
samples?: number;
|
||||
}
|
||||
|
||||
interface MinMaxDecimationOptions extends BaseDecimationOptions {
|
||||
algorithm: DecimationAlgorithm.minmax;
|
||||
algorithm: DecimationAlgorithm.minmax | 'min-max';
|
||||
}
|
||||
|
||||
export type DecimationOptions = LttbDecimationOptions | MinMaxDecimationOptions;
|
||||
|
@ -0,0 +1,72 @@
|
||||
import { Chart, DecimationAlgorithm } from '../../../index.esm';
|
||||
|
||||
const chart = new Chart('id', {
|
||||
type: 'bubble',
|
||||
data: {
|
||||
labels: [],
|
||||
datasets: [{
|
||||
data: []
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
plugins: {
|
||||
decimation: {
|
||||
algorithm: DecimationAlgorithm.lttb,
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
const chart2 = new Chart('id', {
|
||||
type: 'bubble',
|
||||
data: {
|
||||
labels: [],
|
||||
datasets: [{
|
||||
data: []
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
plugins: {
|
||||
decimation: {
|
||||
algorithm: 'lttb',
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
const chart3 = new Chart('id', {
|
||||
type: 'bubble',
|
||||
data: {
|
||||
labels: [],
|
||||
datasets: [{
|
||||
data: []
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
plugins: {
|
||||
decimation: {
|
||||
algorithm: DecimationAlgorithm.minmax,
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
const chart4 = new Chart('id', {
|
||||
type: 'bubble',
|
||||
data: {
|
||||
labels: [],
|
||||
datasets: [{
|
||||
data: []
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
plugins: {
|
||||
decimation: {
|
||||
algorithm: 'min-max',
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
Loading…
Reference in New Issue
Block a user