MCPcopy Create free account
hub / github.com/bqplot/bqplot / update_fill

Method update_fill

js/src/Lines.ts:498–535  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

496 }
497
498 update_fill(): void {
499 const fill = this.model.get('fill'),
500 area = fill === 'top' || fill === 'bottom' || fill === 'between';
501
502 const yScale = this.scales.y;
503
504 this.area.defined((d: any) => {
505 return area && d.y !== null && isFinite(yScale.scale(d.y));
506 });
507
508 if (fill == 'bottom') {
509 this.area.y0(this.parent.plotareaHeight);
510 } else if (fill == 'top') {
511 this.area.y0(0);
512 } else if (fill == 'between') {
513 this.area.y0((d: any) => {
514 return yScale.scale(d.y0) + yScale.offset;
515 });
516 }
517 this.d3el
518 .selectAll('.curve')
519 .select('.area')
520 .attr('d', (d: any) => {
521 return this.area(d.values);
522 });
523 this.d3el
524 .selectAll('.curve')
525 .select('.line')
526 .style('fill', (d, i) => {
527 return fill === 'inside' ? this.get_fill_color(d, i) : '';
528 });
529 // update legend fill
530 if (this.legendEl) {
531 this.legendEl.select('path').style('fill', (d, i) => {
532 return fill === 'none' ? '' : this.get_fill_color(d, i);
533 });
534 }
535 }
536
537 get_fill_color(data, index): string {
538 const fillColors: string = this.model.get('fill_colors');

Callers

nothing calls this directly

Calls 1

get_fill_colorMethod · 0.95

Tested by

no test coverage detected