MCPcopy Index your code
hub / github.com/apache/echarts / createMatrixCell

Function createMatrixCell

src/component/matrix/MatrixView.ts:261–410  ·  view source on GitHub ↗
(
    xyLocator: MatrixXYLocator[],
    matrixModel: MatrixModel,
    group: Group,
    ecModel: GlobalModel,
    cellOption: MatrixBaseCellOption | NullUndefined,
    parentItemStyleModel: Model<MatrixCellStyleOption['itemStyle']>,
    parentLabelModel: Model<MatrixCellStyleOption['label']>,
    parentCellModel: Model<MatrixCellStyleOption>,
    shape: RectLike,
    textValue: unknown,
    zrCellDefault: Z2CellDefault,
    tooltipOption: MatrixOption['tooltip'],
    targetType: MatrixTargetType
)

Source from the content-addressed store, hash-verified

259type MatrixTargetType = 'x' | 'y' | 'body' | 'corner';
260
261function createMatrixCell(
262 xyLocator: MatrixXYLocator[],
263 matrixModel: MatrixModel,
264 group: Group,
265 ecModel: GlobalModel,
266 cellOption: MatrixBaseCellOption | NullUndefined,
267 parentItemStyleModel: Model<MatrixCellStyleOption['itemStyle']>,
268 parentLabelModel: Model<MatrixCellStyleOption['label']>,
269 parentCellModel: Model<MatrixCellStyleOption>,
270 shape: RectLike,
271 textValue: unknown,
272 zrCellDefault: Z2CellDefault,
273 tooltipOption: MatrixOption['tooltip'],
274 targetType: MatrixTargetType
275): void {
276 // Do not use getModel - a quick performance optimization.
277 _tmpCellItemStyleModel.option = cellOption ? cellOption.itemStyle : null;
278 _tmpCellItemStyleModel.parentModel = parentItemStyleModel;
279 _tmpCellModel.option = cellOption;
280 _tmpCellModel.parentModel = parentCellModel;
281
282 // Use different z2 because special border may be defined in itemStyle.
283 const z2 = retrieve2(
284 _tmpCellModel.getShallow('z2'),
285 (cellOption && cellOption.itemStyle) ? zrCellDefault.special : zrCellDefault.normal
286 );
287 const tooltipOptionShow = tooltipOption && tooltipOption.show;
288
289 const cellRect = createMatrixRect(shape, _tmpCellItemStyleModel.getItemStyle(), z2);
290 group.add(cellRect);
291
292 const cursorOption = _tmpCellModel.get('cursor');
293 if (cursorOption != null) {
294 cellRect.attr('cursor', cursorOption);
295 }
296 let cellText: Text | NullUndefined;
297
298 if (textValue != null) {
299 let text = textValue + '';
300 _tmpCellLabelModel.option = cellOption ? cellOption.label : null;
301 _tmpCellLabelModel.parentModel = parentLabelModel;
302 // This is to accept `option.textStyle` as the default.
303 _tmpCellLabelModel.ecModel = ecModel;
304
305 const formatter = _tmpCellLabelModel.getShallow('formatter');
306 if (formatter) {
307 const params = {
308 componentType: 'matrix' as const,
309 componentIndex: matrixModel.componentIndex,
310 name: text,
311 value: textValue as unknown,
312 coord: xyLocator.slice() as MatrixXYLocator[],
313 $vars: ['name', 'value', 'coord'] as const
314 };
315 if (isString(formatter)) {
316 text = formatTplSimple(formatter, params);
317 }
318 else if (isFunction(formatter)) {

Callers 2

renderOnDimensionFunction · 0.85
createBodyOrCornerCellsFunction · 0.85

Calls 12

formatTplSimpleFunction · 0.90
setLabelStyleFunction · 0.90
expandOrShrinkRectFunction · 0.90
setTooltipConfigFunction · 0.90
clearTmpModelFunction · 0.90
createMatrixRectFunction · 0.85
cloneFunction · 0.85
getShallowMethod · 0.80
getItemStyleMethod · 0.80
isFunctionFunction · 0.50
addMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…