Open roestigraben opened 4 years ago
I'm having the same problem with the combo chart.
I need to have the y axis on the bar chart and line chart scaled equally.
Edit: We fixed it.
in combo-chart.component.ts
@Input() yScaleMax;
getYDomain() {
const values = this.results.map((d) => d.value);
const min = Math.min(0, ...values);
const max = Math.max(...values);
if (this.yLeftAxisScaleFactor) {
const minMax = this.yLeftAxisScaleFactor(min, max);
return [Math.min(0, minMax.min), minMax.max];
} else {
return [min, this.yScaleMax];
}
}
And then set your [yScaleMax]="yScaleMax" in the chart in ex. app-component.ts
<combo-chart-component
*ngIf="isLoaded"
[view]="view"
[scheme]="colorScheme"
[results]="revenueData"
[lineChart]="revenueGoals"
[colorSchemeLine]="lineChartScheme"
[gradient]="gradient"
[xAxis]="showXAxis"
[yAxis]="showYAxis"
[showXAxisLabel]="showXAxisLabel"
[showYAxisLabel]="showYAxisLabel"
[xAxisLabel]="xAxisLabel"
[yAxisLabel]="yAxisLabel"
[yScaleMax]="yScaleMax"
>
>
</combo-chart-component>
Describe the bug Originally I want to use the Combo Chart. Here I want the Y axis being the same for the 2 series (bar chart and line chart). It does not work So, I tried on the plain Vertical Line Chart and use the documentation referred stackblitz of (https://stackblitz.com/edit/swimlane-line-chart?embed=1&file=app/app.component.ts) It does not work neither.
To Reproduce Steps to reproduce the behavior:
Expected behavior A clear and concise description of what you expected to happen.
Screenshots
Demo use the URL and paste yScaleMax = 500000; into app.component.ts and paste [yScaleMax]="yScaleMax" into app.component.html
ngx-charts version "@swimlane/ngx-charts": "^13.0.2",
Additional context Add any other context about the problem here.