angular-chart.js icon indicating copy to clipboard operation
angular-chart.js copied to clipboard

Can't get [horizontal bar] chart height to increase when adding additional labels

Open BenjaminThomson opened this issue 9 years ago • 2 comments

Overview

I've got a horizontal chart that updates works great as data and the labels are changed. However, I want the height of the chart to increase if a new chart series (i.e. bar) is added so I can keep the bars and their spacing the same height and in proportion to the height of the chart.

I sure this isn't a bug and more a fundamental miss-understanding of how things work on my part.

I have tried the following code but it doesn't seem to change the height at all:

$scope.$on('chart-create', function(evt, chart) { chart.height = $scope.chartLabels.length * 45; chart.resize(); }'

I've played around with the chart-update event and the response/maintainAspectRation options too but nothing seemed to work.

Here is a jsbin template https://jsbin.com/decogom/edit?html,js,output).

BenjaminThomson avatar Sep 01 '17 02:09 BenjaminThomson

I can't get the horizontal-chart to appear. It's just a empty white space unlike the other charts. Any ideas on this?

<canvas id="horizontal" class="chart chart-horizontal-bar ng-isolate-scope" chart-data="data" chart-labels="labels" height="522" width="1046" style="display: block; width: 523px; height: 261px;"></canvas>

template: $scope.labels = ['2006', '2007', '2008', '2009', '2010', '2011', '2012']; $scope.series = ['Series A', 'Series B']; controller: $scope.data = [ [65, 59, 80, 81, 56, 55, 40], [28, 48, 40, 19, 86, 27, 90] ];

emok032 avatar Jul 29 '20 16:07 emok032

This is a usage question or stale support request from several years ago. As we are currently modernizing the library to support Chart.js v4 and TypeScript, we are closing stale issues. If this is still a problem in the latest version, please open a new issue with a modern reproduction.

jtblin avatar Apr 29 '26 10:04 jtblin