ngx-charts
ngx-charts copied to clipboard
Add yScaleMin/xScaleMin to more chart types
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 - use StackOverflow (add the
ngx-charts
tag) or the gitter chat for support questions
What is the motivation / use case for changing the behavior? Charts like vertical bar chart have a yScaleMin value, but the grouped vertical bar chart does not. I would like to set a min value to set a better focus for the difference in values.
Please tell us about your environment:
- ngx-charts version: 9.0.0
I need xScaleMin for ngx-charts-bar-horizontal-stacked.
I want to have a chart with a x-axis going from -100 to +100. I added xAxisTicks: [-100, -50, 0, 50, 100] but it doesn't get used. He only uses the Ticks where he has values in the data.
I can force him to get to +100 with xScaleMax. I also want to set the min (eg. with xScaleMin) for that specific reason. Here you have your use case ;)
Here is the code that needs to be changed in https://github.com/swimlane/ngx-charts/blob/master/src/bar-chart/bar-horizontal-stacked.component.ts
add after line 124:
@Input() xScaleMin: number;
change line 234:
const min = Math.min(0, ...domain);
to:
const min = this.xScaleMin ? Math.min(this.xScaleMin, ...domain) : Math.min(0, ...domain);
Then it should work for my use-case.
Related PRs #866 , #909
Has this been resolved?