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
Option to also enable BorderRadius at the beginning of stack #9288
Comments
Duplicate of #9217 |
Hi sorry if I wasn't clear enough but it's not, the request is about outer borders so getting exactly like the This behavior is only possible to get out of the box if your dataset contains a starting negative value, else you get : I understand why it's made this way since it is probably what you need in most cases. I also understand that I can use the However: in the case the dataset can have So it's just a convenience feature request really, but since it seems to be already somewhat available (by using negative values) I wonder if it's possible to take advantage of it. |
I think you just need the Edit: Your messages are mixed, in the actual issue you are talking about single dataset and in the next comment about stacks (that require multiple datasets), which is the actual use case? |
Hi yes sorry I meant several datasets but stacked on a single bar, so exactly just like the FYI here is how I solved it, by checking for all segments if every previous value are 0/null (for left borders) and every next values are 0/null (for right borders): const borderRadius = 12
const leftBorder = (i, data) =>
data.slice(0, i).every((v) => v === 0 || !v) ? borderRadius : 0
const rightBorder = (i, data) =>
data.slice(i + 1).every((v) => v === 0 || !v) ? borderRadius : 0
const chart = {
data: {
datasets: my_data.map((value, i, data) => ({
data: [value],
borderRadius: {
topLeft: leftBorder(i, data),
bottomLeft: leftBorder(i, data),
topRight: rightBorder(i, data),
bottomRight: rightBorder(i, data),
},
}))
}
} This way I get nice rounded borders for bars whatever the stacked values are. |
Feature Proposal
Following this PR : #8941 Only enable the bar borderRadius at the end of the stacks
I really like what this does although I don't really understand why the bottom part would get a radius only when it has negative value.
Feature Use Case
My use case is the following: a single data set (with several values) without negative value, in an horizontal bar. I just need the bar to look pretty with radius on every corner of the dataset (so just like the
yellow
example of the PR desc but without negative value).The
borderRadius
object syntax works well out of the box until the dataset potentially has empty values, then it becomes a nightmare to handle since every declaration ofborderRadius
has to check against the others in the dataset before setting (or not) the radius.Possible Implementation
A
borderStartStack
bool param that would automatically apply radius to the first non null segment of the stack, wherever its value is negative or not.The text was updated successfully, but these errors were encountered: