added a 'no_trend_line' option (#5356)

* added a 'no_trend_line' option

* added missing comma
This commit is contained in:
Yu Xiao 2018-07-06 23:09:25 +09:00 committed by Maxime Beauchemin
parent 252cba20de
commit 7158fb1e9d
3 changed files with 25 additions and 15 deletions

View File

@ -1462,6 +1462,14 @@ export const controls = {
description: t('Whether to display the metric name as a title'),
},
show_trend_line: {
type: 'CheckboxControl',
label: t('Show Trend Line'),
renderTrigger: true,
default: true,
description: t('Whether to display the trend line'),
},
x_axis_showminmax: {
type: 'CheckboxControl',
label: t('X bounds'),

View File

@ -1239,6 +1239,7 @@ export const visTypes = {
controlSetRows: [
['compare_lag', 'compare_suffix'],
['y_axis_format', null],
['show_trend_line', null],
],
},
],

View File

@ -93,23 +93,24 @@ function bigNumberVis(slice, payload) {
if (fd.viz_type === 'big_number') {
// Drawing trend line
if (fd.show_trend_line) {
g.append('path')
.attr('d', function () {
return line(data);
})
.attr('stroke-width', 5)
.attr('opacity', 0.5)
.attr('fill', 'none')
.attr('stroke-linecap', 'round')
.attr('stroke', 'grey');
g.append('path')
.attr('d', function () {
return line(data);
})
.attr('stroke-width', 5)
.attr('opacity', 0.5)
.attr('fill', 'none')
.attr('stroke-linecap', 'round')
.attr('stroke', 'grey');
g = svg.append('g')
.attr('class', 'digits')
.attr('opacity', 1);
g = svg.append('g')
.attr('class', 'digits')
.attr('opacity', 1);
if (vCompare !== null) {
y = (height / 8) * 3;
if (vCompare !== null) {
y = (height / 8) * 3;
}
}
const c = scaleColor(vCompare);