mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
1. Increases the top margin to 5 and the right margin to 1 to avoid cutting off the chart because overflow is hidden for the directives mlEventRateChart and mlMultiMetricJobChart. The top margin gives enough room to avoid cutting off y-axis labels. The right margin is a tweak to not cut off the gray border by 1 pixel to the right. 2. Fixes how the domain for mlEventRateChart is calculated. The domain gets now extended by 1 barsInterval, otherwise the last bar will start at the end of vizWidth and overflow the chart (the overflow is hidden so the visible chart missed one bar).
This commit is contained in:
parent
83dd263048
commit
87b2117cb4
2 changed files with 9 additions and 3 deletions
|
@ -29,7 +29,7 @@ module.directive('mlEventRateChart', function () {
|
|||
|
||||
let svgWidth = 0;
|
||||
const barChartHeight = scope.eventRateChartHeight;
|
||||
const margin = { top: 0, right: 0, bottom: 20, left: scope.chartTicksMargin.width };
|
||||
const margin = { top: 5, right: 1, bottom: 20, left: scope.chartTicksMargin.width };
|
||||
const svgHeight = barChartHeight + margin.top + margin.bottom;
|
||||
let vizWidth = svgWidth - margin.left - margin.right;
|
||||
const chartLimits = { max: 0, min: 0 };
|
||||
|
@ -120,9 +120,15 @@ module.directive('mlEventRateChart', function () {
|
|||
}
|
||||
swimlaneXScale.domain(d3.extent(finerData, d => d.date));
|
||||
|
||||
|
||||
// Extend the time range/domain at the end by 1 barsInterval,
|
||||
// otherwise the last bar will start at the end of vizWidth
|
||||
// and overflow the chart.
|
||||
const timeExtent = d3.extent(data, d => d.date);
|
||||
timeExtent[1] = new Date(timeExtent[1].getTime() + scope.chartData.barsInterval);
|
||||
barChartXScale = d3.time.scale()
|
||||
.range([0, vizWidth])
|
||||
.domain(d3.extent(data, d => d.date));
|
||||
.domain(timeExtent);
|
||||
|
||||
chartLimits.max = d3.max(data, (d) => d.value);
|
||||
chartLimits.min = 0;
|
||||
|
|
|
@ -27,7 +27,7 @@ module.directive('mlMultiMetricJobChart', function () {
|
|||
|
||||
let svgWidth = 0;
|
||||
const lineChartHeight = scope.chartHeight;
|
||||
const margin = { top: 0, right: 0, bottom: 20, left: scope.chartTicksMargin.width };
|
||||
const margin = { top: 5, right: 1, bottom: 20, left: scope.chartTicksMargin.width };
|
||||
const svgHeight = lineChartHeight + margin.top + margin.bottom;
|
||||
let vizWidth = svgWidth - margin.left - margin.right;
|
||||
const chartLimits = { max: 0, min: 0 };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue