Closed 17839359913 closed 1 year ago
this is because uPlot generally prefers crisp edges, rounded to pixel boundaries.
you can turn this off globally or on a per-series basis:
for series with hundreds or thousands of datapoints, turning this off is not a good idea because the rendering code uses is-same-pixel comparisons to improve drawing performance. but in the case of bars with only a few dozen points, it should not have any measurable effect.
Thank you very much. May I ask for your advice? Can you tell me the reason for the ambiguity?
Can you tell me the reason for the ambiguity?
i dont understand your question. what is ambiguous here?
I have a new problem where the first and last points are always rendered in half. Is there any way to solve this problem?
you can expand the time range a little. uPlot will not expand the time range automatically.
https://jsfiddle.net/0bvks7cw/1/
let data = [
[0, 1, 2, 3, 4, 5, 6],
[1, 2, 3, 4, 3, 2, 1],
];
const opts = {
width: 800,
height: 400,
scales: {
x: {
time: false,
range: (u, from, to) => {
let pad = (to - from) * 0.05;
return [from - pad, to + pad];
},
},
},
series: [
{},
{
stroke: "red",
fill: "#ff000020",
paths: uPlot.paths.bars(),
},
],
};
let u = new uPlot(opts, data, document.body);
Thank you very much.
I have a new question. If you move the mouse quickly, hook.setSeries will execute very frequently, and the transparency of the series will change frequently, feeling very jittery. Is there any way to add interception? Just like useDebounce
no, not currently: https://github.com/leeoniya/uPlot/issues/787
But this is really very performance intensive. If there are 100 series, it is very important to me
what solution do you suggest?
In some cases, the gap of the bar chart is not uniform, with an error of 0.5px。 Is this a known problem?