From b57d6b738c633a6f53286b42a59d3d6df8d7f92f Mon Sep 17 00:00:00 2001 From: Nick Partridge Date: Fri, 10 Jan 2020 08:47:39 -0600 Subject: [PATCH] [7.x] [TSVB] Add domain fit option to 0 opacity tsvb line charts (#54314) (#54402) * [TSVB] Add domain fit option to 0 opacity tsvb line charts (#54314) - Line charts is TSVB will no again fit to the data and provide a padding when away from the zero baseline * remove erroneous @elastic/apm-rum dependency --- 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 d23474f0a9422..a35721eae75ea 100644 --- a/package.json +++ b/package.json @@ -111,7 +111,7 @@ "dependencies": { "@babel/core": "^7.5.5", "@babel/register": "^7.7.0", - "@elastic/charts": "^16.0.2", + "@elastic/charts": "^16.1.0", "@elastic/datemath": "5.0.2", "@elastic/ems-client": "1.0.5", "@elastic/eui": "17.3.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 32869005611b6..ed80e60e8e995 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1869,10 +1869,10 @@ debug "^3.1.0" lodash.once "^4.1.1" -"@elastic/charts@^16.0.2": - version "16.0.2" - resolved "https://registry.yarnpkg.com/@elastic/charts/-/charts-16.0.2.tgz#35068a08a19534da62e9bcad700cc7b2a15bc55a" - integrity sha512-0tVyltAmAPOAfiRU1iKYk3b9++4oTn6IXvyM4SSj7Ukh5Y90XXmOtGEUPnZTiRPmup9MJi4srrm9ra9k/Kq4UQ== +"@elastic/charts@^16.1.0": + version "16.1.0" + resolved "https://registry.yarnpkg.com/@elastic/charts/-/charts-16.1.0.tgz#67cf11625dcd7e1c2cf16ef53349e6a68a73f5b1" + integrity sha512-0jZ7thhGmYC0ZdEVkxfg6M66epCD7k7BfYIi12FnrmIK+mUD2IPhR8b2TJXvaojPryN4YTNreGRncQ9R58fOoQ== dependencies: "@types/d3-shape" "^1.3.1" classnames "^2.2.6"