-
-
Notifications
You must be signed in to change notification settings - Fork 391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
filled legend markers without filled path #383
Comments
this might be a useful setting to add. until then... since these legend markers are in the dom, you can use uPlot's init hook to to set their |
need to think about where to stick this api. probably: opts.legend.marker: (self, seriesIdx) => {
return {
fill,
stroke,
width,
};
// or raw html or svg element...
return document.createElement("div");
} |
Using the commented code in legendAsTooltipPlugin in the init() it was indeed easy:
did the trick. Thanks for the pointer in this direction! |
i ended up having to fix this after fixing series gradient strokes/fills, since they cannot be re-used for css you can now explicitly define them via callbacks: {
legend: {
stroke: (u, seriesIdx) => "red",
fill: (u, seriesIdx) => "blue",
}
} it's also done similarly in the new demo: https://leeoniya.github.io/uPlot/demos/gradient-fill.html, which sounds like what you want: {
legend: {
fill: (u, seriesIdx) => u.series[seriesIdx].stroke(u, seriesIdx),
}
} |
Since you added the ability to specify stroke and fill as a function, i would like to also specify width as a function. |
i'll think about it: #403 |
I would like to be able to create solid colored markers. Right now (as I can find) it used the fill property to fill the marker, but that also creates an effect on the chart which I don't want. Is there a way to do this?
I derive this from uPlot.js
let indic = placeDiv(LEGEND_MARKER, label);
indic.style.borderColor = s.width ? s.stroke : i > 0 && s.points.width ? s.points.stroke : null;
indic.style.backgroundColor = s.fill || null;
So as an example I would like the blue transparant box to be solid blue, without creating fills in the chart itself.
The text was updated successfully, but these errors were encountered: