Ngx-charts: Legend outside parent

Created on 14 Aug 2019  路  14Comments  路  Source: swimlane/ngx-charts

If I place linechart inside parent with fixed height and set legendPosition="below", the legend is acually outside the parent:

To Reproduce

<div style="position: relative; height: 500px; background: lightsalmon">
  <ngx-charts-line-chart [results]="data" [legend]="true" [xAxis]="true"
     [yAxis]="true" legendPosition="below">
   </ngx-charts-line-chart>
</div>

Screenshots
image

Expected behavior
Legend should be inside parent, otherwise it does not make any sense.

ngx-charts version

"@swimlane/ngx-charts": "^12.0.1",
"@angular/core": "~7.2.0",

Bug

Most helpful comment

I'm running into this issue as well

All 14 comments

Is there any workaround?

I'm experiencing the same behavior. It seems rather undesirable to have to manually add padding to the container if I don't want the legend overlapping the content below the chart.

Not to mention that adding padding seems to break the responsiveness of the chart altogether (not surprising - I've seen that issue mentioned elsewhere).

I'm having similar problems with the chart infinitely resizing when legend is set "below". Here is a stackblitz for reference:

https://ngx-chart-in-flex-c6sutq.stackblitz.io

I have the exact issue

+1

Please do something about this.

I have the same problem. But it's curious because seems to work properly in the page example.
https://swimlane.github.io/ngx-charts/#/ngx-charts/line-chart

is there any update on this? would be very useful to have it working.
Thanks!

I am also having the same problem. Is there a workaround at least?

I'm running into this issue as well

Same issue here, is incredible something like this is happening

Same problem here, I'm defining chart sizes in a configuration utility and this bug is then causing positioning to be incorrect for charts where the Legend is configured for 'below' display!

I have the exact issue

Same here...

Any updates on this?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lokeshdaiya picture lokeshdaiya  路  3Comments

Hypercubed picture Hypercubed  路  3Comments

workfel picture workfel  路  3Comments

stephanrauh picture stephanrauh  路  4Comments

cfremgen picture cfremgen  路  3Comments