-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
Possible to extend horizontal bar controller? #2726
Comments
@daviddevore11 the problem that you're running into is that you are replacing the original horizontalBar controller. I would create a new type Chart.controllers.newHorizontalBar= Chart.controllers.horizontalBar.extend({});
new Chart(canvas, {
type: 'newHorizontalBar',
data: data
}); |
@etimberg When I try to do this the graph switches my labels around to make it seem like a vertical bar chart and the graph is empty |
@etimberg here is a link to a fiddle that I just created |
@daviddevore11 that's because there is no default config for the new chart type. I updated your fiddle to use the same default config as the horizontal bar https://jsfiddle.net/ntcdfs7q/2/ |
In the documentation I see that you can extend the controllers for .line, .bar, .radar, .doughnut, .polarArea, and .bubble. Can you also extend the horizontal bar controller? I am attempting to add target lines to each bar in the graph and I successfully did that by overriding the original controller. I would also like to create other horizontal graphs without the target line but since I overridden the horizontal bar controller it will always draw a target line. Here is my code for the target line with overriding the controller:
The text was updated successfully, but these errors were encountered: