-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Line chart reference Lines #422
Line chart reference Lines #422
Conversation
@marjan-georgiev just wanted to check to see if you had a chance to look at this. Let me know if there is anything that needs to be changed. |
This is an awesome feature, but we can probably make it more generic, so it would support any number of reference lines, and would allow reference lines other than the min, avg, max ones defined here. We could achieve this just by simplifying the refLines format from this:
to this:
And in the y-axis-ticks component you can just iterate over this array and render all lines. By doing that, I would now be able to define a custom reference line:
and would not be limited only to those 3. What do you think? |
That makes sense. I'll make the changes. Thanks for the feedback! |
…ny reference lines as desired.
@marjan-georgiev updated the PR with the changes you mentioned. This ended up being a cleaner implementation so thanks for the suggestions. Let me know if you see anything else. I thought about adding this to the bart charts as well but I think the reference line would have be implemented slightly different where the line would have to be in front of the bar to see it clearly. Could be a starting point to create bullet charts as well although that would have be on each bar series rather than across the entire chart. Let me know if you have any thoughts here. |
Great, thanks! Let's discuss this for the bar chart in a separate issue. |
Hello, an option to custom stroke color of theses limits? |
@marjan-georgiev can reply my last comment? thanks |
What kind of change does this PR introduce? (check one with "x")
What is the current behavior? (You can also link to an open issue here)
You are not able to add reference lines to the line charts.
What is the new behavior?
Ability to add up to 3 reference lines and range and labels to line charts
Demo Testing:
npm start
[showRefLines]="showRefLines" [showRefLabels]="showRefLabels" [referenceLines]="refLines"
Reference line data testing:
This PR also supports 2 different types of reference lines for line charts single and a range.
To test this change
[referenceLines]="refLines"
to[referenceLines]="avgRefLine"
Example of single reference line:
avgRefLine = { value: 37750, name: 'Average' };
Example of reference lines with a range:
refLines = [ { max: { value: 42500, name: 'Maximum' }, avg: { value: 37750, name: 'Average' }, min: { value: 33000, name: 'Minimum' } } ];
Does this PR introduce a breaking change? (check one with "x")
If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...
Other information:
![reference-lines-testing](https://user-images.githubusercontent.com/8234649/27236014-cb7cd974-5288-11e7-9c34-a68788a3029e.gif)