You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2018/07/06 14:09:27 UTC
[incubator-superset] branch master updated: added a 'no_trend_line'
option (#5356)
This is an automated email from the ASF dual-hosted git repository.
maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
The following commit(s) were added to refs/heads/master by this push:
new 7158fb1 added a 'no_trend_line' option (#5356)
7158fb1 is described below
commit 7158fb1e9d4883416c0c56bb2cff2ba560174bdb
Author: Yu Xiao <xi...@gmail.com>
AuthorDate: Fri Jul 6 23:09:25 2018 +0900
added a 'no_trend_line' option (#5356)
* added a 'no_trend_line' option
* added missing comma
---
superset/assets/src/explore/controls.jsx | 8 ++++++
superset/assets/src/explore/visTypes.js | 1 +
superset/assets/src/visualizations/big_number.js | 35 ++++++++++++------------
3 files changed, 27 insertions(+), 17 deletions(-)
diff --git a/superset/assets/src/explore/controls.jsx b/superset/assets/src/explore/controls.jsx
index 0281fe1..310a0b6 100644
--- a/superset/assets/src/explore/controls.jsx
+++ b/superset/assets/src/explore/controls.jsx
@@ -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'),
diff --git a/superset/assets/src/explore/visTypes.js b/superset/assets/src/explore/visTypes.js
index b0037ec..e3b34e9 100644
--- a/superset/assets/src/explore/visTypes.js
+++ b/superset/assets/src/explore/visTypes.js
@@ -1239,6 +1239,7 @@ export const visTypes = {
controlSetRows: [
['compare_lag', 'compare_suffix'],
['y_axis_format', null],
+ ['show_trend_line', null],
],
},
],
diff --git a/superset/assets/src/visualizations/big_number.js b/superset/assets/src/visualizations/big_number.js
index 54d87fa..3d81c55 100644
--- a/superset/assets/src/visualizations/big_number.js
+++ b/superset/assets/src/visualizations/big_number.js
@@ -93,23 +93,24 @@ function bigNumberVis(slice, payload) {
if (fd.viz_type === 'big_number') {
// Drawing 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 = svg.append('g')
- .attr('class', 'digits')
- .attr('opacity', 1);
-
- if (vCompare !== null) {
- y = (height / 8) * 3;
+ 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 = svg.append('g')
+ .attr('class', 'digits')
+ .attr('opacity', 1);
+
+ if (vCompare !== null) {
+ y = (height / 8) * 3;
+ }
}
const c = scaleColor(vCompare);