MCPcopy Index your code
hub / github.com/bqplot/bqplot / create_figure_image

Function create_figure_image

js/src/test/widget-utils.ts:502–554  ·  view source on GitHub ↗
(manager, ipywidgetImage)

Source from the content-addressed store, hash-verified

500}
501
502export async function create_figure_image(manager, ipywidgetImage) {
503 const layout = await create_model(
504 manager,
505 '@jupyter-widgets/base',
506 'LayoutModel',
507 'LayoutView',
508 'layout_figure1',
509 { _dom_classes: '', width: '400px', height: '500px' }
510 );
511
512 const scale_x = await create_model_bqscales(
513 manager,
514 'LinearScale',
515 'scale_x',
516 {
517 allow_padding: false,
518 }
519 );
520 const scale_y = await create_model_bqscales(
521 manager,
522 'LinearScale',
523 'scale_y',
524 {
525 allow_padding: false,
526 }
527 );
528
529 const scales = { x: scale_x.toJSON(), y: scale_y.toJSON() };
530 const imageModel = await create_model_bqplot(manager, 'Image', 'image1', {
531 scales: scales,
532 image: ipywidgetImage.toJSON(),
533 preserve_domain: {},
534 _view_module_version: '*',
535 _view_module: 'bqplot',
536 });
537 let figureModel;
538 try {
539 figureModel = await create_model_bqplot(manager, 'Figure', 'figure1', {
540 scale_x: scale_x.toJSON(),
541 scale_y: scale_y.toJSON(),
542 layout: layout.toJSON(),
543 _dom_classes: [],
544 figure_padding_y: 0,
545 fig_margin: { bottom: 0, left: 0, right: 0, top: 0 },
546 marks: [imageModel.toJSON()],
547 });
548 } catch (e) {
549 console.error('error', e);
550 }
551 const figure = await create_view(manager, figureModel);
552 await manager.display_view(undefined, figure);
553 return { figure: figure, image: await figure.mark_views.views[0] };
554}
555export function getFills(selection: any) {
556 return selection.nodes().map((el) => el.style.fill);
557}

Callers 1

image.tsFile · 0.90

Calls 5

create_modelFunction · 0.85
create_model_bqscalesFunction · 0.85
create_model_bqplotFunction · 0.85
create_viewFunction · 0.85
display_viewMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…