简体   繁体   中英

Get hAxis height of a column chart (google chart)

I cannot find a way to get the dimensions nor the position of the hAxis of my Column chart.

I've tried those but none work (all return null ).

cli.getBoundingBox('hAxis#0#gridline');
cli.getBoundingBox('hAxis#gridline');
cli.getBoundingBox('hAxis#0');
cli.getBoundingBox('hAxis');

Posting my code would be complicated, it's a Angular 5 app, so there is components and services everywhere. But I figured out I can get the height of what I want by doing so

function getHeight(cli) {
  var chartBox = cli.getBoundingBox('chart');
  var areaBox = cli.getBoundingBox('chartarea');

  return chartBox.height - areaBox.height;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM