echarts icon indicating copy to clipboard operation
echarts copied to clipboard

Bar Position: Can we get the x,y,width and height of a particular bar?

Open RavalikaP opened this issue 3 years ago • 3 comments

What problem does this feature solve?

I want to add one graphic element on top, left, right (it can be any position). I want to add graphic elements on particular bar based on index or value. So, do we get the position of the bar to add graphic element.

What does the proposed API look like?

Adding graphic element on top of bars.

RavalikaP avatar Feb 17 '22 13:02 RavalikaP

Just as I said before, you still can get the elements via internal APIs.

// get the series model
const model = myChart.getModel().getSeriesByIndex(0); // `getSeriesByType`/`getSeriesByName` is available
// get the series view
const view = myChart.getViewOfSeriesModel(model);
// get the element group
const group = view.group;
// get all the elements in the group
const elements = view.group.childrenRef();
// get the bounding rectangle of one element
const boundingRect = elements[0].getBoundingRect();

plainheart avatar Feb 18 '22 06:02 plainheart

@plainheart, In case of line chart how we will be adding?

RavalikaP avatar Feb 22 '22 05:02 RavalikaP

This issue has been automatically marked as stale because it did not have recent activity. It will be closed in 7 days if no further activity occurs. If you wish not to mark it as stale, please leave a comment in this issue.

github-actions[bot] avatar Feb 22 '24 21:02 github-actions[bot]

This issue has been automatically closed because it did not have recent activity. If this remains to be a problem with the latest version of Apache ECharts, please open a new issue and link this to it. Thanks!

github-actions[bot] avatar Feb 29 '24 21:02 github-actions[bot]