gerbermichi opened a new pull request, #43515:
URL: https://github.com/apache/superset/pull/43515

   ### SUMMARY
   
   The ECharts axis option `minInterval` was not configurable from the UI. 
Without it, ECharts picks tick steps on its own, which produces fractional 
ticks on integer metrics (0, 0.5, 1, 1.5 …) and, on time axes, tick steps that 
do not match the granularity the user cares about.
   
   This PR exposes `minInterval` as a "Minimum Interval" control for both the X 
and the Y axis of the **Bar Chart** and the **Line Chart**.
   
   Details:
   
   - Two new shared controls in `plugin-chart-echarts/src/controls.tsx`: 
`x_axis_min_interval` and `y_axis_min_interval` (numeric `TextControl`, 
`renderTrigger: true`, empty by default).
   - `Timeseries/transformProps.ts` maps them onto `xAxis.minInterval` / 
`yAxis.minInterval`. Empty, non-numeric or non-positive values are ignored, so 
the default behaviour is unchanged and ECharts keeps calculating ticks 
automatically.
   - On the X axis a user-defined value takes precedence over the interval 
derived from the time grain (the existing `force_max_interval` behaviour is 
untouched when the control is empty).
   - For horizontal bar charts the value follows the existing axis swap, so "X 
Axis" in the control panel always refers to the axis the user sees as X.
   
   On a time axis the value is expressed in milliseconds; this is stated in the 
control description.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A - the control panel gains one input per axis; chart rendering is 
unchanged unless a value is entered.
   
   ### TESTING INSTRUCTIONS
   
   1. Create a Bar Chart with an integer metric (e.g. `COUNT(*)`) whose values 
are small, so the Y axis shows fractional ticks.
   2. Go to *Customize → Chart Options → Y Axis* and set **Minimum Interval** 
to `1`. The Y axis now only shows whole numbers, without a requery.
   3. Switch *Bar orientation* to Horizontal and confirm the control moves to 
the matching axis section and still applies to the value axis.
   4. Set *Customize → Chart Options → X Axis → Minimum Interval* to `86400000` 
on a temporal X axis and confirm the labels are at least one day apart.
   5. Clear both fields and confirm the axes fall back to the automatic ECharts 
ticks.
   6. Repeat steps 2 and 4 with a Line Chart.
   
   Automated tests: `npm run test -- plugins/plugin-chart-echarts/test` (821 
tests). New unit tests cover applying the value to both axes, the swap for 
horizontal bar charts, ignoring empty/invalid input, and the presence of the 
controls in both control panels.
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [x] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to