You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by mi...@apache.org on 2016/02/08 23:49:11 UTC

incubator-zeppelin git commit: [ZEPPELIN-595] Allow displaying decimal format in d3

Repository: incubator-zeppelin
Updated Branches:
  refs/heads/master 51da6584c -> 24e87a62f


[ZEPPELIN-595] Allow displaying decimal format in d3

### What is this PR for?
This PR enables displaying decimal format in built-in nvd3 chart

### What type of PR is it?
Bug Fix

### Is there a relevant Jira issue?
[ZEPPELIN-595](https://issues.apache.org/jira/browse/ZEPPELIN-595)

### Screenshots (if appropriate)
Before
<img width="767" alt="screen shot 2016-02-02 at 2 12 38 pm" src="https://cloud.githubusercontent.com/assets/8503346/12766225/836f42b2-c9b7-11e5-8dd2-9135d76324b0.png">
After
<img width="767" alt="screen shot 2016-02-02 at 2 13 17 pm" src="https://cloud.githubusercontent.com/assets/8503346/12766226/848996e8-c9b7-11e5-8104-b6654686dcd4.png">

### Questions:
* Does the licenses files need update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? No

Author: Mina Lee <mi...@nflabs.com>

Closes #685 from minahlee/ZEPPELIN-595 and squashes the following commits:

574f580 [Mina Lee] Fix typo
f8f3b9f [Mina Lee] Fix typo
d9bd4a9 [Mina Lee] Use thousand grouped with 3 digits round format
53639f5 [Mina Lee] Round float to 3 decimal
834fc13 [Mina Lee] Allow displaying decimal d3 format


Project: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/commit/24e87a62
Tree: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/tree/24e87a62
Diff: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/diff/24e87a62

Branch: refs/heads/master
Commit: 24e87a62f8f3a67e3334d1a1a8d65a5e85784f58
Parents: 51da658
Author: Mina Lee <mi...@nflabs.com>
Authored: Sat Feb 6 11:19:39 2016 -0800
Committer: Mina Lee <mi...@nflabs.com>
Committed: Mon Feb 8 14:48:58 2016 -0800

----------------------------------------------------------------------
 .../src/app/notebook/paragraph/paragraph.controller.js         | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/24e87a62/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
index a985f64..22cef84 100644
--- a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
+++ b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
@@ -1238,7 +1238,9 @@ angular.module('zeppelinWebApp')
 
   };
 
-  var integerFormatter = d3.format(',.1d');
+  var groupedThousandsWith3DigitsFormatter = function(x){
+    return d3.format(',')(d3.round(x, 3));
+  };
 
   var customAbbrevFormatter = function(x) {
     var s = d3.format('.3s')(x);
@@ -1260,7 +1262,7 @@ angular.module('zeppelinWebApp')
     if(d >= Math.pow(10,6)){
       return customAbbrevFormatter(d);
     }
-    return integerFormatter(d);
+    return groupedThousandsWith3DigitsFormatter(d);
   };
 
   var setD3Chart = function(type, data, refresh) {