echarts
echarts copied to clipboard
Bar Position: Can we get the x,y,width and height of a particular bar?
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.
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, In case of line chart how we will be adding?
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.
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!