Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 4EFCB200D16 for ; Tue, 10 Oct 2017 08:39:28 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 40F76160BE3; Tue, 10 Oct 2017 06:39:28 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id F3F66160BE1 for ; Tue, 10 Oct 2017 08:39:23 +0200 (CEST) Received: (qmail 63166 invoked by uid 500); 10 Oct 2017 06:28:42 -0000 Mailing-List: contact commits-help@superset.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@superset.incubator.apache.org Delivered-To: mailing list commits@superset.incubator.apache.org Received: (qmail 63157 invoked by uid 99); 10 Oct 2017 06:28:42 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Oct 2017 06:28:42 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 7A6D481AB0; Tue, 10 Oct 2017 06:17:53 +0000 (UTC) Date: Tue, 10 Oct 2017 06:17:53 +0000 To: "commits@superset.apache.org" Subject: [incubator-superset] branch master updated: add annotation option and a linear color map for heatmap viz. (#3634) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <150761627369.22310.15430456429505588832@gitbox.apache.org> From: maximebeauchemin@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: incubator-superset X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: ca67a7a4e983d7fa88f5885ab9393bb7e7f27c5b X-Git-Newrev: 5ad4167512e81468c09ce856f4054bb16e3af5b0 X-Git-Rev: 5ad4167512e81468c09ce856f4054bb16e3af5b0 X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated archived-at: Tue, 10 Oct 2017 06:39:28 -0000 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 5ad4167 add annotation option and a linear color map for heatmap viz. (#3634) 5ad4167 is described below commit 5ad4167512e81468c09ce856f4054bb16e3af5b0 Author: Yu Xiao AuthorDate: Tue Oct 10 15:17:51 2017 +0900 add annotation option and a linear color map for heatmap viz. (#3634) * add annotation option and a linear color map for heatmap viz. * error fixes. * fixes for requested changes --- .../assets/javascripts/explore/stores/controls.jsx | 9 +++++++++ superset/assets/javascripts/explore/stores/visTypes.js | 1 + superset/assets/javascripts/modules/colors.js | 7 +++++++ superset/assets/visualizations/heatmap.js | 18 ++++++++++++++++++ 4 files changed, 35 insertions(+) diff --git a/superset/assets/javascripts/explore/stores/controls.jsx b/superset/assets/javascripts/explore/stores/controls.jsx index 8d470f0..d2851ee 100644 --- a/superset/assets/javascripts/explore/stores/controls.jsx +++ b/superset/assets/javascripts/explore/stores/controls.jsx @@ -202,6 +202,7 @@ export const controls = { ['blue_white_yellow', 'blue/white/yellow'], ['white_black', 'white/black'], ['black_white', 'black/white'], + ['dark_blue', 'light/dark blue'], ], default: 'blue_white_yellow', clearable: false, @@ -1086,6 +1087,14 @@ export const controls = { description: t('Whether to display the legend (toggles)'), }, + show_values: { + type: 'CheckboxControl', + label: t('Show Values'), + renderTrigger: true, + default: false, + description: t('Whether to display the numerical values within the cells'), + }, + x_axis_showminmax: { type: 'CheckboxControl', label: t('X bounds'), diff --git a/superset/assets/javascripts/explore/stores/visTypes.js b/superset/assets/javascripts/explore/stores/visTypes.js index 4cdabf8..0459b38 100644 --- a/superset/assets/javascripts/explore/stores/visTypes.js +++ b/superset/assets/javascripts/explore/stores/visTypes.js @@ -976,6 +976,7 @@ export const visTypes = { ['left_margin', 'bottom_margin'], ['y_axis_bounds', 'y_axis_format'], ['show_legend', 'show_perc'], + ['show_values'], ['sort_x_axis', 'sort_y_axis'], ], }, diff --git a/superset/assets/javascripts/modules/colors.js b/superset/assets/javascripts/modules/colors.js index 8e3e521..803b683 100644 --- a/superset/assets/javascripts/modules/colors.js +++ b/superset/assets/javascripts/modules/colors.js @@ -94,6 +94,13 @@ export const spectrums = { 'black', 'white', ], + dark_blue: [ + '#EBF5F8', + '#6BB1CC', + '#357E9B', + '#1B4150', + '#092935', + ], }; export const getColorFromScheme = (function () { diff --git a/superset/assets/visualizations/heatmap.js b/superset/assets/visualizations/heatmap.js index 002af8a..d86253d 100644 --- a/superset/assets/visualizations/heatmap.js +++ b/superset/assets/visualizations/heatmap.js @@ -130,6 +130,24 @@ function heatmapVis(slice, payload) { .attr('height', height) .style('position', 'relative'); + if (fd.show_values) { + const cells = svg.selectAll('rect') + .data(data) + .enter() + .append('g') + .attr('transform', `translate(${margin.left}, ${margin.top})`); + + cells.append('text') + .attr('transform', d => `translate(${xRbScale(d.x)}, ${yRbScale(d.y)})`) + .attr('y', yRbScale.rangeBand() / 2) + .attr('x', xRbScale.rangeBand() / 2) + .attr('text-anchor', 'middle') + .attr('dy', '.35em') + .text(d => valueFormatter(d.v)) + .attr('font-size', Math.min(yRbScale.rangeBand(), xRbScale.rangeBand()) / 3 + 'px') + .attr('fill', d => d.v >= payload.data.extents[1] / 2 ? 'white' : 'black'); + } + if (fd.show_legend) { const legendScaler = colorScalerFactory( fd.linear_color_scheme, null, null, payload.data.extents); -- To stop receiving notification emails like this one, please contact ['"commits@superset.apache.org" '].