MCPcopy
hub / github.com/apache/echarts / updateCommon

Function updateCommon

src/chart/bar/PictorialBarView.ts:884–950  ·  view source on GitHub ↗
(
    bar: PictorialBarElement,
    opt: CreateOpts,
    symbolMeta: SymbolMeta
)

Source from the content-addressed store, hash-verified

882}
883
884function updateCommon(
885 bar: PictorialBarElement,
886 opt: CreateOpts,
887 symbolMeta: SymbolMeta
888) {
889 const dataIndex = symbolMeta.dataIndex;
890 const itemModel = symbolMeta.itemModel;
891 // Color must be excluded.
892 // Because symbol provide setColor individually to set fill and stroke
893 const emphasisModel = itemModel.getModel('emphasis');
894 const emphasisStyle = emphasisModel.getModel('itemStyle').getItemStyle();
895 const blurStyle = itemModel.getModel(['blur', 'itemStyle']).getItemStyle();
896 const selectStyle = itemModel.getModel(['select', 'itemStyle']).getItemStyle();
897 const cursorStyle = itemModel.getShallow('cursor');
898
899 const focus = emphasisModel.get('focus');
900 const blurScope = emphasisModel.get('blurScope');
901 const hoverScale = emphasisModel.get('scale');
902
903 eachPath(bar, function (path) {
904 if (path instanceof ZRImage) {
905 const pathStyle = path.style;
906 path.useStyle(zrUtil.extend({
907 // TODO other properties like dx, dy ?
908 image: pathStyle.image,
909 x: pathStyle.x, y: pathStyle.y,
910 width: pathStyle.width, height: pathStyle.height
911 }, symbolMeta.style));
912 }
913 else {
914 path.useStyle(symbolMeta.style);
915 }
916
917 const emphasisState = path.ensureState('emphasis');
918 emphasisState.style = emphasisStyle;
919
920 if (hoverScale) {
921 // NOTE: Must after scale is set after updateAttr
922 emphasisState.scaleX = path.scaleX * 1.1;
923 emphasisState.scaleY = path.scaleY * 1.1;
924 }
925
926 path.ensureState('blur').style = blurStyle;
927 path.ensureState('select').style = selectStyle;
928
929 cursorStyle && (path.cursor = cursorStyle);
930 path.z2 = symbolMeta.z2;
931 });
932
933 const barPositionOutside = opt.valueDim.posDesc[+(symbolMeta.boundingLength > 0)];
934 const barRect = bar.__pictorialBarRect;
935 barRect.ignoreClip = true;
936
937 setLabelStyle(
938 barRect, getLabelStatesModels(itemModel),
939 {
940 labelFetcher: opt.seriesModel,
941 labelDataIndex: dataIndex,

Callers 1

renderMethod · 0.70

Calls 10

setLabelStyleFunction · 0.90
getLabelStatesModelsFunction · 0.90
getDefaultLabelFunction · 0.90
toggleHoverEmphasisFunction · 0.90
eachPathFunction · 0.85
getItemStyleMethod · 0.80
getShallowMethod · 0.80
getDataMethod · 0.65
getModelMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…