* Register a box to a chart. * A box is simply a reference to an object that requires layout. eg. Scales, Legend, Title. * @param {Chart} chart - the chart to use * @param {LayoutItem} item - the item to add to be laid out
(chart, item)
| 289 | * @param {LayoutItem} item - the item to add to be laid out |
| 290 | */ |
| 291 | addBox(chart, item) { |
| 292 | if (!chart.boxes) { |
| 293 | chart.boxes = []; |
| 294 | } |
| 295 | |
| 296 | // initialize item with default values |
| 297 | item.fullSize = item.fullSize || false; |
| 298 | item.position = item.position || 'top'; |
| 299 | item.weight = item.weight || 0; |
| 300 | // @ts-ignore |
| 301 | item._layers = item._layers || function() { |
| 302 | return [{ |
| 303 | z: 0, |
| 304 | draw(chartArea) { |
| 305 | item.draw(chartArea); |
| 306 | } |
| 307 | }]; |
| 308 | }; |
| 309 | |
| 310 | chart.boxes.push(item); |
| 311 | }, |
| 312 | |
| 313 | /** |
| 314 | * Remove a layoutItem from a chart |
nothing calls this directly
no outgoing calls
no test coverage detected