Closed AnnEthan closed 4 months ago
you can add some filters: https://jsfiddle.net/0f56tder/1/
let data = [
[0, 1],
[0, 5],
];
const onlyInts = (u, splits) => splits.map(s => Number.isInteger(s) ? s : null);
const opts = {
width: 800,
height: 400,
scales: {
x: {
time: false,
},
},
axes: [
{},
{
filter: onlyInts,
grid: { filter: onlyInts },
ticks: { filter: onlyInts }
}
],
series: [
{},
{
label: "Scanning 1",
stroke: "#0000ff",
},
],
};
let u = new uPlot(opts, data, document.body);
or you can provide your own axis.incrs
array that only contains integer increments.
or you can provide your own axis.splits
function that only creates integer splits.
I convert non-integers to Null through filter, but why does the orange region still have an axis
you forgot to filter axis.ticks
, as shown above: ticks: { filter: onlyInts }
thanks!!!