timelines-chart icon indicating copy to clipboard operation
timelines-chart copied to clipboard

"Fill" option for chart sizing

Open jusunglee opened this issue 3 years ago • 1 comments

Hi,

Currently the only lever for controlling chart size is with absolute value-- ideally, to make sure the chart can reactively fill the window size, you should allow percentages as values.

jusunglee avatar Mar 02 '23 19:03 jusunglee

@jusunglee thanks for reaching out.

This responsive functionality is beyond the scope of this library, but you can easily use a 3rd party module to monitor window resize events and inject a width property into timelines-chart.

For example, if you would use element-resize-detector to pick one, you would just need to do something like:

const myChart = TimelinesChart()
  (document.getElementById('chart'));

elementResizeDetectorMaker().listenTo(
  document.getElementById('chart'),
  el => myChart.width(el.offsetWidth)
);

vasturiano avatar Mar 03 '23 19:03 vasturiano