GitHub user dosubot[bot] added a comment to the discussion: Bubble chart 
expands y axis to negative values when all data points have y = 0

<!-- Greeting -->
Hi @andreeairimia-ops! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping 
the superset team.

<!-- Answer -->
Superset v3 doesn't have a built-in or UI-based way to dynamically set the 
y-axis max to 1 only when all bubble chart y values are zero. The axis bounds 
are either manually set via the chart controls or automatically inferred, which 
leads to negative values when min = max = 0 due to ECharts' default padding 
behavior. There are no advanced config options or hooks for this in the current 
codebase or UI 
[source](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/plugins/plugin-chart-echarts/src/Bubble/transformProps.ts).

To achieve your desired behavior, you'd need to add logic in the bubble chart 
plugin's `transformProps` function. After building the chart series, check if 
all y values are zero and bounds are unset, then set `min: 0, max: 1` for 
`yAxis` in `echartOptions`. Here’s a rough outline:

```js
const allYZero = data.every(datum => datum[yAxisLabel] === 0);
if (allYZero && yAxisMin == null && yAxisMax == null) {
  echartOptions.yAxis.min = 0;
  echartOptions.yAxis.max = 1;
}
```

Recent PRs have improved axis bounds handling and global min/max calculation, 
but none implement this specific conditional logic 
[source](https://github.com/apache/superset/pull/34526).

Let me know if you want more details on where to add this or how to patch the 
plugin!


<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*

---
<sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback/00c96f03-ece9-4d55-89cb-ebef4d3332e2?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/00c96f03-ece9-4d55-89cb-ebef4d3332e2?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/00c96f03-ece9-4d55-89cb-ebef4d3332e2?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/00c96f03-ece9-4d55-89cb-ebef4d3332e2?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/00c96f03-ece9-4d55-89cb-ebef4d3332e2?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/00c96f03-ece9-4d55-89cb-ebef4d3332e2?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/00c96f03-ece9-4d55-89cb-ebef4d3332e2?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat
 with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)&
 nbsp;[![Join 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share
 on 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/35054)

GitHub link: 
https://github.com/apache/superset/discussions/35054#discussioncomment-14339766

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to