-
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
[BUG] zeroLineIndex is undefined for yAxis, prevents setting of zeroLine attributes #5032
Comments
@adamheald13 I am afraid that the xAxes: [{
afterUpdate: function(scale) {
scale.zeroLineIndex = 0;
},
ticks: {... |
@jcopperfield Thanks for the quick fix. What is the reason for not automatically setting Also, you lose all styling on the yAxis when the last element in the |
@adamheald13 I don't know the reason for not setting the You could create a PR proposing a change. For instance the following code could be added to the file scales/scale.category.js convertTicksToLabels: function() {
var me = this;
me.zeroLineIndex = 0;
Chart.Scale.prototype.convertTicksToLabels.call(me);
} Your second isn't caused by the last element being a non-numeric string, but by the Chart.js/src/core/core.scale.js Lines 755 to 758 in b4d6924
Reducing the fontSize to 27 , will make it work again.
|
Expected Behavior
I would expect
zeroLine
attributes (e.g.zeroLineWidth
) to be set on the yAxis.Current Behavior
Chart.js/src/core/core.scale.js
Line 721 in b4d6924
me.zeroLineIndex
results in undefined for the verticalgridLines
.Breakpoint after causing a re-render.
![undefined me zerolineindex](https://user-images.githubusercontent.com/8510089/33771735-c4187a5a-dbf7-11e7-869e-cdcc5275f7a3.gif)
This behavior appears to have been introduced in 2.7.0. Reverting back to 2.6.0 fixes this particular issue (but introduces others) at least in the browser. In the CodePen below changing to 2.6.0 doesn't seem to fix it.
Context
I'm trying to create charts with matching styled x and y axes.
Environment
The text was updated successfully, but these errors were encountered: