From e3c2f31ea7b1e875c3990fc79c2a381b1db3def1 Mon Sep 17 00:00:00 2001 From: Nick Partridge Date: Sat, 11 Jan 2020 12:18:37 -0600 Subject: [PATCH] [TSVB] Add domain fit option to 0 opacity tsvb line charts (#54314) (#54517) - Line charts is TSVB will no again fit to the data and provide a padding when away from the zero baseline --- package.json | 2 +- .../public/components/vis_types/timeseries/vis.js | 4 ++++ yarn.lock | 8 ++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index bec106e6ccf5f..2eaf071e239da 100644 --- a/package.json +++ b/package.json @@ -106,7 +106,7 @@ "dependencies": { "@babel/core": "^7.5.5", "@babel/register": "^7.7.0", - "@elastic/charts": "^13.5.12", + "@elastic/charts": "~13.5.13", "@elastic/datemath": "5.0.2", "@elastic/ems-client": "1.0.5", "@elastic/eui": "14.5.1", diff --git a/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/timeseries/vis.js b/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/timeseries/vis.js index 982aca8d3b813..d269d7c3546ec 100644 --- a/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/timeseries/vis.js +++ b/src/legacy/core_plugins/vis_type_timeseries/public/components/vis_types/timeseries/vis.js @@ -79,10 +79,14 @@ export class TimeseriesVisualization extends Component { static getYAxisDomain = model => { const axisMin = get(model, 'axis_min', '').toString(); const axisMax = get(model, 'axis_max', '').toString(); + const fit = model.series + ? model.series.filter(({ hidden }) => !hidden).every(({ fill }) => fill === '0') + : model.fill === '0'; return { min: axisMin.length ? Number(axisMin) : undefined, max: axisMax.length ? Number(axisMax) : undefined, + fit, }; }; diff --git a/yarn.lock b/yarn.lock index ffc9a5c0b776b..736d04f2f2eff 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1070,10 +1070,10 @@ debug "^3.1.0" lodash.once "^4.1.1" -"@elastic/charts@^13.5.12": - version "13.5.12" - resolved "https://registry.yarnpkg.com/@elastic/charts/-/charts-13.5.12.tgz#95bd92389ec5fb411debfa5979091b6da2e4b123" - integrity sha512-MMNuebZ5jmzXkUJZr/mSvmtWNIR0gWGBtbqpZBfq3T9WRQPvnEHeE/N1WmXw2BSvwN86fy1i0gr52izh/nfzjQ== +"@elastic/charts@~13.5.13": + version "13.5.13" + resolved "https://registry.yarnpkg.com/@elastic/charts/-/charts-13.5.13.tgz#332455af6f990f196a7544af14fabd123b81892e" + integrity sha512-TlzIwmBIlXsxdD27Ltfl+BuIWqTh7OtKQMVAbARYsWsrBhf+GphxoVT7spWyBPIrUuMLegP4T6I5mC1XhkqNgA== dependencies: "@types/d3-shape" "^1.3.1" classnames "^2.2.6"