jonavila commented on issue #8841: min/max on yAxis for bar charts, makes the bars go outside limits URL: https://github.com/apache/incubator-echarts/issues/8841#issuecomment-516034572 @suremicro No need to go the custom chart route. I've solved this using a similar solution to yours but instead of creating a custom chart, I update each bar's layout properties. You can update each bar's layout by registering a layout function before initializing your chart. Example: ```js echarts.registerLayout(myCustomLayoutFunction); echarts.init(myChartContainer); function myCustomLayoutFunction(ecModel) { ecModel.eachSeries(seriesComponent => { const data = seriesComponent.getData(); data.each(idx => { const layout = data.getItemLayout(idx); if (layout) { const newLayout = echarts.graphic.clipRectByRect( layout, seriesComponent.coordinateSystem.grid.getRect(), ); if (newLayout) { ({ x: layout.x, y: layout.y, width: layout.width, height: layout.height } = newLayout); } } }); } } ``` I use this technique of registering layout functions for my charts quite often to do things like dynamically showing or hiding series labels depending if they fit.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
