MCPcopy Create free account
hub / github.com/chartbrew/chartbrew / _getNewChartLayout

Function _getNewChartLayout

client/src/containers/AddChart/AddChart.jsx:65–76  ·  view source on GitHub ↗
(charts)

Source from the content-addressed store, hash-verified

63const _shouldAutoNameChart = (chartId) => _getStoredPendingChartIds().includes(chartId);
64
65const _getNewChartLayout = (charts) => {
66 const layouts = getDashboardLayout(charts);
67 const chartLayout = {};
68
69 Object.keys(layouts).forEach((bp) => {
70 const w = bp === "lg" ? 4 : bp === "md" ? 5 : bp === "sm" ? 3 : bp === "xs" ? 2 : 2;
71 const pos = placeNewWidget(layouts[bp] || [], { w, h: 2 }, bp);
72 chartLayout[bp] = [pos.x, pos.y, pos.w, pos.h];
73 });
74
75 return chartLayout;
76};
77
78/*
79 Container used for setting up a new chart

Callers 1

_createChartFunction · 0.85

Calls 2

placeNewWidgetFunction · 0.90
getDashboardLayoutFunction · 0.85

Tested by

no test coverage detected