question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Second Y-Axis with its own scale, width, tooltips, ...

See original GitHub issue

I’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:closed
  • Created 7 years ago
  • Reactions:10
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

23reactions
hgoeblcommented, Jan 27, 2017

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.

4reactions
marjan-georgievcommented, Jan 27, 2017

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:

  • What would be the base chart? Bar, line, area, anything?
  • How would the second dimension be visualized? By a bar, line, area, anything?
  • What happens when someone wants another layer on top of these 2?

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Apexcharts - How to change the y-axis step size value and ...
In the tooltip, I am not getting the string. It's only displaying the number. enter image description here. var options = { series:...
Read more >
Customize X-axis and Y-axis properties - Power BI
In this tutorial, you'll learn many different ways to customize the X-axis and Y-axis of your visuals. Not all visuals have axes.
Read more >
The drawing API Y-axis object | RGraph.net
The Y-axis object allows you to have extra Y axes in your chart. Formerly this was an independent function but it's now been...
Read more >
Scale Configuration - ZingChart
On the y-axis, the scale automatically calculates the ending (maximum) and step scale values based on the size of your data.
Read more >
Tooltip - Chart.js
# Tooltip Configuration ; intersect, boolean, interaction.intersect, If true, the tooltip mode applies only when the mouse position intersects ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found