Second Y-Axis with its own scale, width, tooltips, ...
See original GitHub issueI’m submitting a … (check one with “x”)
[ ] bug report => search github for a similar issue or PR before submitting
[x] feature request
[ ] support request => Please do not submit support request here
Current behavior A line-chart or bar-chart can only show lines/bars in one dimension, let’s say an amount of money. If one would like to show the number of purchased items (as an example), this isn’t possible.
Expected behavior By adding input properties like ‘y2Axis’, ‘y2Scale’, … it should be possible to visualize lines/bars in a second dimension.
Reproduction of the problem
What is the motivation / use case for changing the behavior? already explained
Please tell us about your environment:
- ngx-charts version: 4.0.x
- Angular version: 2.3.x
- Browser: [all]
- Language: [all]
Question
How is this library meant to be used? Should we just use the “outer”, high-level components like ngx-charts-line-chart
, or would it also be ok to build own components by composing “low-level” components/directives like they are used in ngx-charts-line-chart
. And do you think one should extend
your components (with TypeScript / ES6 class extensions mechanisms, or fork / copy and adapt components? BTW is there a mailing list, a google group or the like where such questions can be discussed?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:10
- Comments:8 (3 by maintainers)
Top GitHub Comments
I think you’re closing this feature request quite fast. Don’t you think providing a second y-scale is a very commonly used case and some users might vote for this feature?
The example is not really extending something. In case of a second Y-axis there are so many aspects which must be adopted (e.g. calculating width) so really many changes have to be made in lots of places. I regard this not a case every consumer of ngx-charts should do by it’s own.
Or maybe I misunderstood the intention of ngx-charts and the provided ready-to-use charts are more or less only examples how to build own charts? Thanks anyway.
Adding a second scale introduces another dimension to the chart and adds another level of complexity, which is very hard to implement in a generic way that would fit all use cases, but much easier to implement as a custom chart that solves a particular use case.
There are several questions that would need to be answered here:
We would have to account for all of these possible combinations (line on top of bars, bars on top of line, lines on top of area, etc.), and yet there will still be a case where someone would need something extra added or modified.
The simplest approach is to build a custom chart. You can start by copying the chart you would like to extend, and modify it in any way you like. You only need to solve your own use case, so it should be way simpler.
Again, the out-of-the-box charts that we provide solve many of the most common use cases, and we offer them as ready-made components. For edge cases or cases not covered by them, custom charts are the way to go. This is why we also expose all of the building-block components through the main module.
Edit: I’m reopening the issue in case someone else wants to comment on it.