You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@superset.apache.org by GitBox <gi...@apache.org> on 2018/04/23 07:20:07 UTC

[GitHub] mistercrunch closed pull request #3408: Added Features to Country Map Viz Type

mistercrunch closed pull request #3408: Added Features to Country Map Viz Type
URL: https://github.com/apache/incubator-superset/pull/3408
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/superset/assets/backendSync.json b/superset/assets/backendSync.json
index 71e7130328..03984c6566 100644
--- a/superset/assets/backendSync.json
+++ b/superset/assets/backendSync.json
@@ -1,249 +1,608 @@
 {
   "controls": {
     "datasource": {
-      "type": "SelectControl",
+      "type": "DatasourceControl",
       "label": "Datasource",
-      "isLoading": true,
-      "clearable": false,
       "default": null,
-      "description": ""
+      "description": null
     },
     "viz_type": {
-      "type": "SelectControl",
+      "type": "VizTypeControl",
       "label": "Visualization Type",
-      "clearable": false,
       "default": "table",
+      "description": "The type of visualization to display"
+    },
+    "metrics": {
+      "type": "SelectControl",
+      "multi": true,
+      "label": "Metrics",
+      "validators": [
+        null
+      ],
+      "valueKey": "metric_name",
+      "description": "One or many metrics to display"
+    },
+    "y_axis_bounds": {
+      "type": "BoundsControl",
+      "label": "Y Axis Bounds",
+      "renderTrigger": true,
+      "default": [
+        null,
+        null
+      ],
+      "description": "Bounds for the Y axis. When left empty, the bounds are dynamically defined based on the min/max of the data. Note that this feature will only expand the axis range. It won't narrow the data's extent."
+    },
+    "order_by_cols": {
+      "type": "SelectControl",
+      "multi": true,
+      "label": "Ordering",
+      "default": [],
+      "description": "One or many metrics to display"
+    },
+    "metric": {
+      "type": "SelectControl",
+      "label": "Metric",
+      "clearable": false,
+      "description": "Choose the metric",
+      "validators": [
+        null
+      ],
+      "valueKey": "metric_name"
+    },
+    "metric_2": {
+      "type": "SelectControl",
+      "label": "Right Axis Metric",
+      "default": null,
+      "validators": [
+        null
+      ],
+      "clearable": true,
+      "description": "Choose a metric for right axis",
+      "valueKey": "metric_name"
+    },
+    "stacked_style": {
+      "type": "SelectControl",
+      "label": "Stacked Style",
       "choices": [
         [
-          "dist_bar",
-          "Distribution - Bar Chart",
-          "/static/assets/images/viz_thumbnails/dist_bar.png"
+          "stack",
+          "stack"
         ],
         [
-          "pie",
-          "Pie Chart",
-          "/static/assets/images/viz_thumbnails/pie.png"
+          "stream",
+          "stream"
         ],
         [
-          "line",
-          "Time Series - Line Chart",
-          "/static/assets/images/viz_thumbnails/line.png"
+          "expand",
+          "expand"
+        ]
+      ],
+      "default": "stack",
+      "description": ""
+    },
+    "linear_color_scheme": {
+      "type": "ColorSchemeControl",
+      "label": "Linear Color Scheme",
+      "choices": [
+        [
+          "fire",
+          "fire"
         ],
         [
-          "dual_line",
-          "Time Series - Dual Axis Line Chart",
-          "/static/assets/images/viz_thumbnails/dual_line.png"
+          "blue_white_yellow",
+          "blue/white/yellow"
         ],
         [
-          "bar",
-          "Time Series - Bar Chart",
-          "/static/assets/images/viz_thumbnails/bar.png"
+          "white_black",
+          "white/black"
         ],
         [
-          "compare",
-          "Time Series - Percent Change",
-          "/static/assets/images/viz_thumbnails/compare.png"
+          "black_white",
+          "black/white"
         ],
         [
-          "area",
-          "Time Series - Stacked",
-          "/static/assets/images/viz_thumbnails/area.png"
+          "yellow_green",
+          "yellow/green"
         ],
         [
-          "table",
-          "Table View",
-          "/static/assets/images/viz_thumbnails/table.png"
+          "yellow_green_blue",
+          "yellow/green/blue"
         ],
         [
-          "markup",
-          "Markup",
-          "/static/assets/images/viz_thumbnails/markup.png"
+          "green_blue",
+          "green/blue"
         ],
         [
-          "pivot_table",
-          "Pivot Table",
-          "/static/assets/images/viz_thumbnails/pivot_table.png"
+          "blue_green",
+          "blue/green"
         ],
         [
-          "separator",
-          "Separator",
-          "/static/assets/images/viz_thumbnails/separator.png"
+          "purple_blue_green",
+          "purple/blue/green"
         ],
         [
-          "word_cloud",
-          "Word Cloud",
-          "/static/assets/images/viz_thumbnails/word_cloud.png"
+          "purple_blue",
+          "purple/blue"
         ],
         [
-          "treemap",
-          "Treemap",
-          "/static/assets/images/viz_thumbnails/treemap.png"
+          "blue_purple",
+          "blue/purple"
         ],
         [
-          "cal_heatmap",
-          "Calendar Heatmap",
-          "/static/assets/images/viz_thumbnails/cal_heatmap.png"
+          "red_purple",
+          "red/purple"
         ],
         [
-          "box_plot",
-          "Box Plot",
-          "/static/assets/images/viz_thumbnails/box_plot.png"
+          "purple_red",
+          "purple/red"
         ],
         [
-          "bubble",
-          "Bubble Chart",
-          "/static/assets/images/viz_thumbnails/bubble.png"
+          "orange_red",
+          "orange/red"
         ],
         [
-          "bullet",
-          "Bullet Chart",
-          "/static/assets/images/viz_thumbnails/bullet.png"
+          "yellow_orange_red",
+          "yellow/orange/red"
         ],
         [
-          "big_number",
-          "Big Number with Trendline",
-          "/static/assets/images/viz_thumbnails/big_number.png"
+          "yellow_orange_brown",
+          "yellow/orange/brown"
         ],
         [
-          "big_number_total",
-          "Big Number",
-          "/static/assets/images/viz_thumbnails/big_number_total.png"
+          "purples",
+          "purples"
         ],
         [
-          "histogram",
-          "Histogram",
-          "/static/assets/images/viz_thumbnails/histogram.png"
+          "blues",
+          "blues"
         ],
         [
-          "sunburst",
-          "Sunburst",
-          "/static/assets/images/viz_thumbnails/sunburst.png"
+          "greens",
+          "greens"
         ],
         [
-          "sankey",
-          "Sankey",
-          "/static/assets/images/viz_thumbnails/sankey.png"
+          "oranges",
+          "oranges"
         ],
         [
-          "directed_force",
-          "Directed Force Layout",
-          "/static/assets/images/viz_thumbnails/directed_force.png"
+          "reds",
+          "reds"
         ],
         [
-          "country_map",
-          "Country Map",
-          "/static/assets/images/viz_thumbnails/country_map.png"
+          "greys",
+          "greys"
         ],
         [
-          "world_map",
-          "World Map",
-          "/static/assets/images/viz_thumbnails/world_map.png"
+          "purple_orange",
+          "purple/orange"
         ],
         [
-          "filter_box",
-          "Filter Box",
-          "/static/assets/images/viz_thumbnails/filter_box.png"
+          "brown_bluegreen",
+          "brown/bluegreen"
         ],
         [
-          "iframe",
-          "iFrame",
-          "/static/assets/images/viz_thumbnails/iframe.png"
+          "purple_green",
+          "purple/green"
         ],
         [
-          "para",
-          "Parallel Coordinates",
-          "/static/assets/images/viz_thumbnails/para.png"
+          "pink_yellowgreen",
+          "pink/yellowgreen"
         ],
         [
-          "heatmap",
-          "Heatmap",
-          "/static/assets/images/viz_thumbnails/heatmap.png"
+          "red_blue",
+          "red/blue"
         ],
         [
-          "horizon",
-          "Horizon",
-          "/static/assets/images/viz_thumbnails/horizon.png"
+          "red_grey",
+          "red/grey"
         ],
         [
-          "mapbox",
-          "Mapbox",
-          "/static/assets/images/viz_thumbnails/mapbox.png"
+          "red_yellow_blue",
+          "red/yellow/blue"
+        ],
+        [
+          "spectral",
+          "spectral"
+        ],
+        [
+          "red_yellow_green",
+          "red/yellow/green"
         ]
       ],
-      "description": "The type of visualization to display"
-    },
-    "metrics": {
-      "type": "SelectControl",
-      "multi": true,
-      "label": "Metrics",
-      "validators": [
-        null
-      ],
-      "description": "One or many metrics to display"
-    },
-    "order_by_cols": {
-      "type": "SelectControl",
-      "multi": true,
-      "label": "Ordering",
-      "default": [],
-      "description": "One or many metrics to display"
-    },
-    "metric": {
-      "type": "SelectControl",
-      "label": "Metric",
-      "clearable": false,
-      "description": "Choose the metric"
-    },
-    "metric_2": {
-      "type": "SelectControl",
-      "label": "Right Axis Metric",
-      "choices": [],
-      "default": [],
-      "description": "Choose a metric for right axis"
+      "default": "blue_white_yellow",
+      "description": "",
+      "renderTrigger": true,
+      "schemes": {
+        "blue_white_yellow": [
+          "#00d1c1",
+          "#ffffff",
+          "#ffb400"
+        ],
+        "fire": [
+          "white",
+          "yellow",
+          "red",
+          "black"
+        ],
+        "white_black": [
+          "white",
+          "black"
+        ],
+        "black_white": [
+          "black",
+          "white"
+        ],
+        "yellow_green": [
+          "#ffffe5",
+          "#f7fcb9",
+          "#d9f0a3",
+          "#addd8e",
+          "#78c679",
+          "#41ab5d",
+          "#238443",
+          "#006837",
+          "#004529"
+        ],
+        "yellow_green_blue": [
+          "#ffffd9",
+          "#edf8b1",
+          "#c7e9b4",
+          "#7fcdbb",
+          "#41b6c4",
+          "#1d91c0",
+          "#225ea8",
+          "#253494",
+          "#081d58"
+        ],
+        "green_blue": [
+          "#f7fcf0",
+          "#e0f3db",
+          "#ccebc5",
+          "#a8ddb5",
+          "#7bccc4",
+          "#4eb3d3",
+          "#2b8cbe",
+          "#0868ac",
+          "#084081"
+        ],
+        "blue_green": [
+          "#f7fcfd",
+          "#e5f5f9",
+          "#ccece6",
+          "#99d8c9",
+          "#66c2a4",
+          "#41ae76",
+          "#238b45",
+          "#006d2c",
+          "#00441b"
+        ],
+        "purple_blue_green": [
+          "#fff7fb",
+          "#ece2f0",
+          "#d0d1e6",
+          "#a6bddb",
+          "#67a9cf",
+          "#3690c0",
+          "#02818a",
+          "#016c59",
+          "#014636"
+        ],
+        "purple_blue": [
+          "#fff7fb",
+          "#ece7f2",
+          "#d0d1e6",
+          "#a6bddb",
+          "#74a9cf",
+          "#3690c0",
+          "#0570b0",
+          "#045a8d",
+          "#023858"
+        ],
+        "blue_purple": [
+          "#f7fcfd",
+          "#e0ecf4",
+          "#bfd3e6",
+          "#9ebcda",
+          "#8c96c6",
+          "#8c6bb1",
+          "#88419d",
+          "#810f7c",
+          "#4d004b"
+        ],
+        "red_purple": [
+          "#fff7f3",
+          "#fde0dd",
+          "#fcc5c0",
+          "#fa9fb5",
+          "#f768a1",
+          "#dd3497",
+          "#ae017e",
+          "#7a0177",
+          "#49006a"
+        ],
+        "purple_red": [
+          "#f7f4f9",
+          "#e7e1ef",
+          "#d4b9da",
+          "#c994c7",
+          "#df65b0",
+          "#e7298a",
+          "#ce1256",
+          "#980043",
+          "#67001f"
+        ],
+        "orange_red": [
+          "#fff7ec",
+          "#fee8c8",
+          "#fdd49e",
+          "#fdbb84",
+          "#fc8d59",
+          "#ef6548",
+          "#d7301f",
+          "#b30000",
+          "#7f0000"
+        ],
+        "yellow_orange_red": [
+          "#ffffcc",
+          "#ffeda0",
+          "#fed976",
+          "#feb24c",
+          "#fd8d3c",
+          "#fc4e2a",
+          "#e31a1c",
+          "#bd0026",
+          "#800026"
+        ],
+        "yellow_orange_brown": [
+          "#ffffe5",
+          "#fff7bc",
+          "#fee391",
+          "#fec44f",
+          "#fe9929",
+          "#ec7014",
+          "#cc4c02",
+          "#993404",
+          "#662506"
+        ],
+        "purples": [
+          "#fcfbfd",
+          "#efedf5",
+          "#dadaeb",
+          "#bcbddc",
+          "#9e9ac8",
+          "#807dba",
+          "#6a51a3",
+          "#54278f",
+          "#3f007d"
+        ],
+        "blues": [
+          "#f7fbff",
+          "#deebf7",
+          "#c6dbef",
+          "#9ecae1",
+          "#6baed6",
+          "#4292c6",
+          "#2171b5",
+          "#08519c",
+          "#08306b"
+        ],
+        "greens": [
+          "#f7fcf5",
+          "#e5f5e0",
+          "#c7e9c0",
+          "#a1d99b",
+          "#74c476",
+          "#41ab5d",
+          "#238b45",
+          "#006d2c",
+          "#00441b"
+        ],
+        "oranges": [
+          "#fff5eb",
+          "#fee6ce",
+          "#fdd0a2",
+          "#fdae6b",
+          "#fd8d3c",
+          "#f16913",
+          "#d94801",
+          "#a63603",
+          "#7f2704"
+        ],
+        "reds": [
+          "#fff5f0",
+          "#fee0d2",
+          "#fcbba1",
+          "#fc9272",
+          "#fb6a4a",
+          "#ef3b2c",
+          "#cb181d",
+          "#a50f15",
+          "#67000d"
+        ],
+        "greys": [
+          "#ffffff",
+          "#f0f0f0",
+          "#d9d9d9",
+          "#bdbdbd",
+          "#969696",
+          "#737373",
+          "#525252",
+          "#252525",
+          "#000000"
+        ],
+        "purple_orange": [
+          "#b35806",
+          "#e08214",
+          "#fdb863",
+          "#fee0b6",
+          "#f7f7f7",
+          "#d8daeb",
+          "#b2abd2",
+          "#8073ac",
+          "#542788"
+        ],
+        "brown_bluegreen": [
+          "#8c510a",
+          "#bf812d",
+          "#dfc27d",
+          "#f6e8c3",
+          "#f5f5f5",
+          "#c7eae5",
+          "#80cdc1",
+          "#35978f",
+          "#01665e"
+        ],
+        "purple_green": [
+          "#762a83",
+          "#9970ab",
+          "#c2a5cf",
+          "#e7d4e8",
+          "#f7f7f7",
+          "#d9f0d3",
+          "#a6dba0",
+          "#5aae61",
+          "#1b7837"
+        ],
+        "pink_yellowgreen": [
+          "#c51b7d",
+          "#de77ae",
+          "#f1b6da",
+          "#fde0ef",
+          "#f7f7f7",
+          "#e6f5d0",
+          "#b8e186",
+          "#7fbc41",
+          "#4d9221"
+        ],
+        "red_blue": [
+          "#b2182b",
+          "#d6604d",
+          "#f4a582",
+          "#fddbc7",
+          "#f7f7f7",
+          "#d1e5f0",
+          "#92c5de",
+          "#4393c3",
+          "#2166ac"
+        ],
+        "red_grey": [
+          "#b2182b",
+          "#d6604d",
+          "#f4a582",
+          "#fddbc7",
+          "#ffffff",
+          "#e0e0e0",
+          "#bababa",
+          "#878787",
+          "#4d4d4d"
+        ],
+        "red_yellow_blue": [
+          "#d73027",
+          "#f46d43",
+          "#fdae61",
+          "#fee090",
+          "#ffffbf",
+          "#e0f3f8",
+          "#abd9e9",
+          "#74add1",
+          "#4575b4"
+        ],
+        "spectral": [
+          "#9e0142",
+          "#d53e4f",
+          "#f46d43",
+          "#fdae61",
+          "#fee08b",
+          "#ffffbf",
+          "#e6f598",
+          "#abdda4",
+          "#66c2a5",
+          "#3288bd",
+          "#5e4fa2"
+        ],
+        "red_yellow_green": [
+          "#a50026",
+          "#d73027",
+          "#f46d43",
+          "#fdae61",
+          "#fee08b",
+          "#ffffbf",
+          "#d9ef8b",
+          "#a6d96a",
+          "#66bd63",
+          "#1a9850",
+          "#006837"
+        ]
+      },
+      "isLinear": true
     },
-    "stacked_style": {
+    "bucket_number": {
       "type": "SelectControl",
-      "label": "Stacked Style",
+      "label": "Number of Buckets",
       "choices": [
         [
-          "stack",
-          "stack"
+          "3",
+          "3"
         ],
         [
-          "stream",
-          "stream"
+          "4",
+          "4"
         ],
         [
-          "expand",
-          "expand"
+          "5",
+          "5"
+        ],
+        [
+          "6",
+          "6"
+        ],
+        [
+          "7",
+          "7"
+        ],
+        [
+          "8",
+          "8"
+        ],
+        [
+          "9",
+          "9"
+        ],
+        [
+          "10",
+          "10"
+        ],
+        [
+          "11",
+          "11"
+        ],
+        [
+          "12",
+          "12"
         ]
       ],
-      "default": "stack",
-      "description": ""
+      "default": "3",
+      "description": "The number of buckets want to break your dataset into."
     },
-    "linear_color_scheme": {
+    "scale_type": {
       "type": "SelectControl",
-      "label": "Linear Color Scheme",
+      "label": "Type of Scale",
       "choices": [
         [
-          "fire",
-          "fire"
-        ],
-        [
-          "blue_white_yellow",
-          "blue/white/yellow"
+          "threshold",
+          "linear threshold"
         ],
         [
-          "white_black",
-          "white/black"
+          "quantile",
+          "quantile"
         ],
         [
-          "black_white",
-          "black/white"
+          "quantize",
+          "quantize"
         ]
       ],
-      "default": "blue_white_yellow",
-      "description": ""
+      "default": "linear",
+      "description": "The type of scale you want to apply to your dataset."
     },
     "normalize_across": {
       "type": "SelectControl",
@@ -730,6 +1089,13 @@
       "default": false,
       "description": null
     },
+    "pivot_margins": {
+      "type": "CheckboxControl",
+      "label": "Show totals",
+      "renderTrigger": false,
+      "default": true,
+      "description": "Display total row/column"
+    },
     "show_markers": {
       "type": "CheckboxControl",
       "label": "Show Markers",
@@ -785,29 +1151,21 @@
     },
     "select_country": {
       "type": "SelectControl",
-      "label": "Country Name Type",
+      "label": "Country Name",
       "default": "France",
       "choices": [
-        [
-          "Algeria",
-          "Algeria"
-        ],
         [
           "Belgium",
           "Belgium"
         ],
         [
-          "Brasil",
-          "Brasil"
+          "Brazil",
+          "Brazil"
         ],
         [
           "China",
           "China"
         ],
-        [
-          "Germany",
-          "Germany"
-        ],
         [
           "Egypt",
           "Egypt"
@@ -816,6 +1174,10 @@
           "France",
           "France"
         ],
+        [
+          "Germany",
+          "Germany"
+        ],
         [
           "Italy",
           "Italy"
@@ -825,8 +1187,8 @@
           "Morocco"
         ],
         [
-          "Nederlanden",
-          "Nederlanden"
+          "Netherlands",
+          "Netherlands"
         ],
         [
           "Russia",
@@ -844,6 +1206,10 @@
           "Uk",
           "Uk"
         ],
+        [
+          "Ukraine",
+          "Ukraine"
+        ],
         [
           "Usa",
           "Usa"
@@ -880,14 +1246,18 @@
       "multi": true,
       "label": "Group by",
       "default": [],
-      "description": "One or many controls to group by"
+      "includeTime": false,
+      "description": "One or many controls to group by",
+      "valueKey": "column_name"
     },
     "columns": {
       "type": "SelectControl",
       "multi": true,
       "label": "Columns",
       "default": [],
-      "description": "One or many controls to pivot as columns"
+      "includeTime": false,
+      "description": "One or many controls to pivot as columns",
+      "valueKey": "column_name"
     },
     "all_columns": {
       "type": "SelectControl",
@@ -960,7 +1330,46 @@
         ]
       ],
       "default": "auto",
-      "description": "Bottom marging, in pixels, allowing for more room for axis labels"
+      "renderTrigger": true,
+      "description": "Bottom margin, in pixels, allowing for more room for axis labels"
+    },
+    "left_margin": {
+      "type": "SelectControl",
+      "freeForm": true,
+      "label": "Left Margin",
+      "choices": [
+        [
+          "auto",
+          "auto"
+        ],
+        [
+          50,
+          "50"
+        ],
+        [
+          75,
+          "75"
+        ],
+        [
+          100,
+          "100"
+        ],
+        [
+          125,
+          "125"
+        ],
+        [
+          150,
+          "150"
+        ],
+        [
+          200,
+          "200"
+        ]
+      ],
+      "default": "auto",
+      "renderTrigger": true,
+      "description": "Left margin, in pixels, allowing for more room for axis labels"
     },
     "granularity": {
       "type": "SelectControl",
@@ -1263,77 +1672,16 @@
       "description": "Pandas resample fill method"
     },
     "since": {
-      "type": "SelectControl",
+      "type": "DateFilterControl",
       "freeForm": true,
       "label": "Since",
-      "default": "7 days ago",
-      "choices": [
-        [
-          "1 hour ago",
-          "1 hour ago"
-        ],
-        [
-          "12 hours ago",
-          "12 hours ago"
-        ],
-        [
-          "1 day ago",
-          "1 day ago"
-        ],
-        [
-          "7 days ago",
-          "7 days ago"
-        ],
-        [
-          "28 days ago",
-          "28 days ago"
-        ],
-        [
-          "90 days ago",
-          "90 days ago"
-        ],
-        [
-          "1 year ago",
-          "1 year ago"
-        ],
-        [
-          "100 year ago",
-          "100 year ago"
-        ]
-      ],
-      "description": "Timestamp from filter. This supports free form typing and natural language as in `1 day ago`, `28 days` or `3 years`"
+      "default": "7 days ago"
     },
     "until": {
-      "type": "SelectControl",
+      "type": "DateFilterControl",
       "freeForm": true,
       "label": "Until",
-      "default": "now",
-      "choices": [
-        [
-          "now",
-          "now"
-        ],
-        [
-          "1 day ago",
-          "1 day ago"
-        ],
-        [
-          "7 days ago",
-          "7 days ago"
-        ],
-        [
-          "28 days ago",
-          "28 days ago"
-        ],
-        [
-          "90 days ago",
-          "90 days ago"
-        ],
-        [
-          "1 year ago",
-          "1 year ago"
-        ]
-      ]
+      "default": "now"
     },
     "max_bubble_size": {
       "type": "SelectControl",
@@ -1558,6 +1906,12 @@
       "isInt": true,
       "description": "Defines the size of the rolling window function, relative to the time granularity selected"
     },
+    "min_periods": {
+      "type": "TextControl",
+      "label": "Min Periods",
+      "isInt": true,
+      "description": "The minimum number of rolling periods required to show a value. For instance if you do a cumulative sum on 7 days you may want your \"Min Period\" to be 7, so that all data points shown are the total of 7 periods. This will hide the \"ramp up\" taking place over the first 7 periods"
+    },
     "series": {
       "type": "SelectControl",
       "label": "Series",
@@ -1568,24 +1922,39 @@
       "type": "SelectControl",
       "label": "Entity",
       "default": null,
-      "description": "This define the element to be plotted on the chart"
+      "validators": [
+        null
+      ],
+      "description": "This defines the element to be plotted on the chart"
     },
     "x": {
       "type": "SelectControl",
       "label": "X Axis",
+      "description": "Metric assigned to the [X] axis",
       "default": null,
-      "description": "Metric assigned to the [X] axis"
+      "validators": [
+        null
+      ],
+      "valueKey": "metric_name"
     },
     "y": {
       "type": "SelectControl",
       "label": "Y Axis",
       "default": null,
-      "description": "Metric assigned to the [Y] axis"
+      "validators": [
+        null
+      ],
+      "description": "Metric assigned to the [Y] axis",
+      "valueKey": "metric_name"
     },
     "size": {
       "type": "SelectControl",
       "label": "Bubble Size",
-      "default": null
+      "default": null,
+      "validators": [
+        null
+      ],
+      "valueKey": "metric_name"
     },
     "url": {
       "type": "TextControl",
@@ -1632,7 +2001,11 @@
       "type": "SelectControl",
       "freeForm": true,
       "label": "Table Timestamp Format",
-      "default": "smart_date",
+      "default": "%Y-%m-%d %H:%M:%S",
+      "validators": [
+        null
+      ],
+      "clearable": false,
       "choices": [
         [
           "smart_date",
@@ -1746,7 +2119,41 @@
     "x_axis_format": {
       "type": "SelectControl",
       "freeForm": true,
-      "label": "X axis format",
+      "label": "X Axis Format",
+      "renderTrigger": true,
+      "default": ".3s",
+      "choices": [
+        [
+          ".3s",
+          ".3s | 12.3k"
+        ],
+        [
+          ".3%",
+          ".3% | 1234543.210%"
+        ],
+        [
+          ".4r",
+          ".4r | 12350"
+        ],
+        [
+          ".3f",
+          ".3f | 12345.432"
+        ],
+        [
+          "+,",
+          "+, | +12,345.4321"
+        ],
+        [
+          "$,.2f",
+          "$,.2f | $12,345.43"
+        ]
+      ],
+      "description": "D3 format syntax: https://github.com/d3/d3-format"
+    },
+    "x_axis_time_format": {
+      "type": "SelectControl",
+      "freeForm": true,
+      "label": "X Axis Format",
       "renderTrigger": true,
       "default": "smart_date",
       "choices": [
@@ -1776,7 +2183,7 @@
     "y_axis_format": {
       "type": "SelectControl",
       "freeForm": true,
-      "label": "Y axis format",
+      "label": "Y Axis Format",
       "renderTrigger": true,
       "default": ".3s",
       "choices": [
@@ -1810,7 +2217,7 @@
     "y_axis_2_format": {
       "type": "SelectControl",
       "freeForm": true,
-      "label": "Right axis format",
+      "label": "Right Axis Format",
       "default": ".3s",
       "choices": [
         [
@@ -1843,6 +2250,7 @@
     "markup_type": {
       "type": "SelectControl",
       "label": "Markup Type",
+      "clearable": false,
       "choices": [
         [
           "markdown",
@@ -1854,6 +2262,9 @@
         ]
       ],
       "default": "markdown",
+      "validators": [
+        null
+      ],
       "description": "Pick your favorite markup language"
     },
     "rotation": {
@@ -2039,6 +2450,12 @@
       "default": true,
       "description": "Whether to display the legend (toggles)"
     },
+    "show_map_legend": {
+      "type": "CheckboxControl",
+      "label": "Map Legend",
+      "default": true,
+      "description": "Whether to apply filter when table cell is clicked"
+    },
     "x_axis_showminmax": {
       "type": "CheckboxControl",
       "label": "X bounds",
@@ -2046,19 +2463,19 @@
       "default": true,
       "description": "Whether to display the min and max values of the X axis"
     },
-    "rich_tooltip": {
+    "y_axis_showminmax": {
       "type": "CheckboxControl",
-      "label": "Rich Tooltip",
+      "label": "Y bounds",
       "renderTrigger": true,
       "default": true,
-      "description": "The rich tooltip shows a list of all series for that point in time"
+      "description": "Whether to display the min and max values of the Y axis"
     },
-    "y_axis_zero": {
+    "rich_tooltip": {
       "type": "CheckboxControl",
-      "label": "Y Axis Zero",
-      "default": false,
+      "label": "Rich Tooltip",
       "renderTrigger": true,
-      "description": "Force the Y axis to start at 0 instead of the minimum value"
+      "default": true,
+      "description": "The rich tooltip shows a list of all series for that point in time"
     },
     "y_log_scale": {
       "type": "CheckboxControl",
@@ -2078,12 +2495,14 @@
       "type": "CheckboxControl",
       "label": "Donut",
       "default": false,
+      "renderTrigger": true,
       "description": "Do you want a donut or a pie?"
     },
     "labels_outside": {
       "type": "CheckboxControl",
       "label": "Put labels outside",
       "default": true,
+      "renderTrigger": true,
       "description": "Put the labels outside the pie?"
     },
     "contribution": {
@@ -2369,6 +2788,235 @@
       "label": "Cache Timeout (seconds)",
       "hidden": true,
       "description": "The number of seconds before expiring the cache"
+    },
+    "order_by_entity": {
+      "type": "CheckboxControl",
+      "label": "Order by entity id",
+      "description": "Important! Select this if the table is not already sorted by entity id, else there is no guarantee that all events for each entity are returned.",
+      "default": true
+    },
+    "min_leaf_node_event_count": {
+      "type": "SelectControl",
+      "freeForm": false,
+      "label": "Minimum leaf node event count",
+      "default": 1,
+      "choices": [
+        [
+          1,
+          "1"
+        ],
+        [
+          2,
+          "2"
+        ],
+        [
+          3,
+          "3"
+        ],
+        [
+          4,
+          "4"
+        ],
+        [
+          5,
+          "5"
+        ],
+        [
+          6,
+          "6"
+        ],
+        [
+          7,
+          "7"
+        ],
+        [
+          8,
+          "8"
+        ],
+        [
+          9,
+          "9"
+        ],
+        [
+          10,
+          "10"
+        ]
+      ],
+      "description": "Leaf nodes that represent fewer than this number of events will be initially hidden in the visualization"
+    },
+    "color_scheme": {
+      "type": "ColorSchemeControl",
+      "label": "Color Scheme",
+      "default": "bnbColors",
+      "renderTrigger": true,
+      "choices": [
+        [
+          "bnbColors",
+          "bnbColors"
+        ],
+        [
+          "d3Category10",
+          "d3Category10"
+        ],
+        [
+          "d3Category20",
+          "d3Category20"
+        ],
+        [
+          "d3Category20b",
+          "d3Category20b"
+        ],
+        [
+          "d3Category20c",
+          "d3Category20c"
+        ],
+        [
+          "googleCategory10c",
+          "googleCategory10c"
+        ],
+        [
+          "googleCategory20c",
+          "googleCategory20c"
+        ]
+      ],
+      "description": "The color scheme for rendering chart",
+      "schemes": {
+        "bnbColors": [
+          "#ff5a5f",
+          "#7b0051",
+          "#007A87",
+          "#00d1c1",
+          "#8ce071",
+          "#ffb400",
+          "#b4a76c",
+          "#ff8083",
+          "#cc0086",
+          "#00a1b3",
+          "#00ffeb",
+          "#bbedab",
+          "#ffd266",
+          "#cbc29a",
+          "#ff3339",
+          "#ff1ab1",
+          "#005c66",
+          "#00b3a5",
+          "#55d12e",
+          "#b37e00",
+          "#988b4e"
+        ],
+        "d3Category10": [
+          "#1f77b4",
+          "#ff7f0e",
+          "#2ca02c",
+          "#d62728",
+          "#9467bd",
+          "#8c564b",
+          "#e377c2",
+          "#7f7f7f",
+          "#bcbd22",
+          "#17becf"
+        ],
+        "d3Category20": [
+          "#1f77b4",
+          "#aec7e8",
+          "#ff7f0e",
+          "#ffbb78",
+          "#2ca02c",
+          "#98df8a",
+          "#d62728",
+          "#ff9896",
+          "#9467bd",
+          "#c5b0d5",
+          "#8c564b",
+          "#c49c94",
+          "#e377c2",
+          "#f7b6d2",
+          "#7f7f7f",
+          "#c7c7c7",
+          "#bcbd22",
+          "#dbdb8d",
+          "#17becf",
+          "#9edae5"
+        ],
+        "d3Category20b": [
+          "#393b79",
+          "#5254a3",
+          "#6b6ecf",
+          "#9c9ede",
+          "#637939",
+          "#8ca252",
+          "#b5cf6b",
+          "#cedb9c",
+          "#8c6d31",
+          "#bd9e39",
+          "#e7ba52",
+          "#e7cb94",
+          "#843c39",
+          "#ad494a",
+          "#d6616b",
+          "#e7969c",
+          "#7b4173",
+          "#a55194",
+          "#ce6dbd",
+          "#de9ed6"
+        ],
+        "d3Category20c": [
+          "#3182bd",
+          "#6baed6",
+          "#9ecae1",
+          "#c6dbef",
+          "#e6550d",
+          "#fd8d3c",
+          "#fdae6b",
+          "#fdd0a2",
+          "#31a354",
+          "#74c476",
+          "#a1d99b",
+          "#c7e9c0",
+          "#756bb1",
+          "#9e9ac8",
+          "#bcbddc",
+          "#dadaeb",
+          "#636363",
+          "#969696",
+          "#bdbdbd",
+          "#d9d9d9"
+        ],
+        "googleCategory10c": [
+          "#3366cc",
+          "#dc3912",
+          "#ff9900",
+          "#109618",
+          "#990099",
+          "#0099c6",
+          "#dd4477",
+          "#66aa00",
+          "#b82e2e",
+          "#316395"
+        ],
+        "googleCategory20c": [
+          "#3366cc",
+          "#dc3912",
+          "#ff9900",
+          "#109618",
+          "#990099",
+          "#0099c6",
+          "#dd4477",
+          "#66aa00",
+          "#b82e2e",
+          "#316395",
+          "#994499",
+          "#22aa99",
+          "#aaaa11",
+          "#6633cc",
+          "#e67300",
+          "#8b0707",
+          "#651067",
+          "#329262",
+          "#5574a6",
+          "#3b3eac"
+        ]
+      }
     }
   }
 }
\ No newline at end of file
diff --git a/superset/assets/javascripts/components/Checkbox.jsx b/superset/assets/javascripts/components/Checkbox.jsx
index b0564ae6b8..ec87553587 100644
--- a/superset/assets/javascripts/components/Checkbox.jsx
+++ b/superset/assets/javascripts/components/Checkbox.jsx
@@ -12,7 +12,7 @@ export default function Checkbox({ checked, onChange, style }) {
     <span style={style}>
       <i
         className={`fa fa-check ${checked ? 'text-primary' : 'text-transparent'}`}
-        onClick={onChange.bind(!checked)}
+        onClick={onChange.bind(null, !checked)}
         style={{
           border: '1px solid #aaa',
           borderRadius: '2px',
diff --git a/superset/assets/javascripts/explore/components/controls/ColorSchemeControl.jsx b/superset/assets/javascripts/explore/components/controls/ColorSchemeControl.jsx
index db51792cfc..9487c6cc41 100644
--- a/superset/assets/javascripts/explore/components/controls/ColorSchemeControl.jsx
+++ b/superset/assets/javascripts/explore/components/controls/ColorSchemeControl.jsx
@@ -1,9 +1,9 @@
 import React from 'react';
+import d3 from 'd3';
 import PropTypes from 'prop-types';
 import { Creatable } from 'react-select';
 import ControlHeader from '../ControlHeader';
 
-import { colorScalerFactory } from '../../../modules/colors';
 
 const propTypes = {
   description: PropTypes.string,
@@ -42,19 +42,23 @@ export default class ColorSchemeControl extends React.PureComponent {
 
   renderOption(key) {
     const currentScheme = key.value ?
-      this.props.schemes[key.value] :
-      this.props.schemes[defaultProps.value];
+        this.props.schemes[key.value] :
+        this.props.schemes[defaultProps.value];
 
     let colors = currentScheme;
     if (this.props.isLinear) {
-      const colorScaler = colorScalerFactory(currentScheme);
+      const linearDomain = [];
+      for (let x = 0; x < currentScheme.length; x++) {
+        linearDomain.push(x / currentScheme.length);
+      }
+      const colorScaler = d3.scale.linear().domain(linearDomain).range(currentScheme);
       colors = [...Array(20).keys()].map(d => (colorScaler(d / 20)));
     }
 
     const list = colors.map((color, i) => (
       <li
         key={`${currentScheme}-${i}`}
-        style={{ backgroundColor: color, border: `1px solid ${color === 'white' ? 'black' : color}` }}
+        style={{ backgroundColor: color, border: `1px solid ${'#D3D3D3'}` }}
       >&nbsp;</li>
     ));
     return (<ul className="color-scheme-container">{list}</ul>);
diff --git a/superset/assets/javascripts/explore/stores/controls.jsx b/superset/assets/javascripts/explore/stores/controls.jsx
index 9cce39413c..9d73fdc035 100644
--- a/superset/assets/javascripts/explore/stores/controls.jsx
+++ b/superset/assets/javascripts/explore/stores/controls.jsx
@@ -164,6 +164,33 @@ export const controls = {
       ['blue_white_yellow', 'blue/white/yellow'],
       ['white_black', 'white/black'],
       ['black_white', 'black/white'],
+      ['yellow_green', 'yellow/green'],
+      ['yellow_green_blue', 'yellow/green/blue'],
+      ['green_blue', 'green/blue'],
+      ['blue_green', 'blue/green'],
+      ['purple_blue_green', 'purple/blue/green'],
+      ['purple_blue', 'purple/blue'],
+      ['blue_purple', 'blue/purple'],
+      ['red_purple', 'red/purple'],
+      ['purple_red', 'purple/red'],
+      ['orange_red', 'orange/red'],
+      ['yellow_orange_red', 'yellow/orange/red'],
+      ['yellow_orange_brown', 'yellow/orange/brown'],
+      ['purples', 'purples'],
+      ['blues', 'blues'],
+      ['greens', 'greens'],
+      ['oranges', 'oranges'],
+      ['reds', 'reds'],
+      ['greys', 'greys'],
+      ['purple_orange', 'purple/orange'],
+      ['brown_bluegreen', 'brown/bluegreen'],
+      ['purple_green', 'purple/green'],
+      ['pink_yellowgreen', 'pink/yellowgreen'],
+      ['red_blue', 'red/blue'],
+      ['red_grey', 'red/grey'],
+      ['red_yellow_blue', 'red/yellow/blue'],
+      ['spectral', 'spectral'],
+      ['red_yellow_green', 'red/yellow/green'],
     ],
     default: 'blue_white_yellow',
     description: '',
@@ -172,6 +199,26 @@ export const controls = {
     isLinear: true,
   },
 
+  bucket_number: {
+    type: 'SelectControl',
+    label: 'Number of Buckets',
+    choices: formatSelectOptions(['3', '4', '5', '6', '7', '8', '9', '10', '11', '12']),
+    default: '7',
+    description: 'The number of buckets want to break your dataset into.',
+  },
+
+  scale_type: {
+    type: 'SelectControl',
+    label: 'Type of Scale',
+    choices: [
+      ['threshold', 'linear threshold'],
+      ['quantile', 'quantile'],
+      ['quantize', 'quantize'],
+    ],
+    default: 'threshold',
+    description: 'The type of scale you want to apply to your dataset.',
+  },
+
   normalize_across: {
     type: 'SelectControl',
     label: 'Normalize Across',
@@ -1002,6 +1049,13 @@ export const controls = {
     description: 'Whether to display the legend (toggles)',
   },
 
+  show_map_legend: {
+    type: 'CheckboxControl',
+    label: 'Map Legend',
+    default: true,
+    description: 'Whether to apply filter when table cell is clicked',
+  },
+
   x_axis_showminmax: {
     type: 'CheckboxControl',
     label: 'X bounds',
@@ -1334,5 +1388,7 @@ export const controls = {
     description: 'The color scheme for rendering chart',
     schemes: ALL_COLOR_SCHEMES,
   },
+
 };
+
 export default controls;
diff --git a/superset/assets/javascripts/explore/stores/visTypes.js b/superset/assets/javascripts/explore/stores/visTypes.js
index 318d3327c1..b3d4a799e4 100644
--- a/superset/assets/javascripts/explore/stores/visTypes.js
+++ b/superset/assets/javascripts/explore/stores/visTypes.js
@@ -804,6 +804,8 @@ export const visTypes = {
         label: 'Options',
         controlSetRows: [
           ['select_country'],
+          ['number_format', 'show_map_legend'],
+          ['scale_type', 'bucket_number'],
           ['linear_color_scheme'],
         ],
       },
diff --git a/superset/assets/javascripts/modules/colors.js b/superset/assets/javascripts/modules/colors.js
index 9897e4c228..7a9c011747 100644
--- a/superset/assets/javascripts/modules/colors.js
+++ b/superset/assets/javascripts/modules/colors.js
@@ -1,4 +1,3 @@
-import $ from 'jquery';
 import d3 from 'd3';
 
 // Color related utility functions go in this object
@@ -76,7 +75,7 @@ export const ALL_COLOR_SCHEMES = {
 export const spectrums = {
   blue_white_yellow: [
     '#00d1c1',
-    'white',
+    '#ffffff',
     '#ffb400',
   ],
   fire: [
@@ -93,6 +92,33 @@ export const spectrums = {
     'black',
     'white',
   ],
+  yellow_green: ['#ffffe5', '#f7fcb9', '#d9f0a3', '#addd8e', '#78c679', '#41ab5d', '#238443', '#006837', '#004529'],
+  yellow_green_blue: ['#ffffd9', '#edf8b1', '#c7e9b4', '#7fcdbb', '#41b6c4', '#1d91c0', '#225ea8', '#253494', '#081d58'],
+  green_blue: ['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#0868ac', '#084081'],
+  blue_green: ['#f7fcfd', '#e5f5f9', '#ccece6', '#99d8c9', '#66c2a4', '#41ae76', '#238b45', '#006d2c', '#00441b'],
+  purple_blue_green: ['#fff7fb', '#ece2f0', '#d0d1e6', '#a6bddb', '#67a9cf', '#3690c0', '#02818a', '#016c59', '#014636'],
+  purple_blue: ['#fff7fb', '#ece7f2', '#d0d1e6', '#a6bddb', '#74a9cf', '#3690c0', '#0570b0', '#045a8d', '#023858'],
+  blue_purple: ['#f7fcfd', '#e0ecf4', '#bfd3e6', '#9ebcda', '#8c96c6', '#8c6bb1', '#88419d', '#810f7c', '#4d004b'],
+  red_purple: ['#fff7f3', '#fde0dd', '#fcc5c0', '#fa9fb5', '#f768a1', '#dd3497', '#ae017e', '#7a0177', '#49006a'],
+  purple_red: ['#f7f4f9', '#e7e1ef', '#d4b9da', '#c994c7', '#df65b0', '#e7298a', '#ce1256', '#980043', '#67001f'],
+  orange_red: ['#fff7ec', '#fee8c8', '#fdd49e', '#fdbb84', '#fc8d59', '#ef6548', '#d7301f', '#b30000', '#7f0000'],
+  yellow_orange_red: ['#ffffcc', '#ffeda0', '#fed976', '#feb24c', '#fd8d3c', '#fc4e2a', '#e31a1c', '#bd0026', '#800026'],
+  yellow_orange_brown: ['#ffffe5', '#fff7bc', '#fee391', '#fec44f', '#fe9929', '#ec7014', '#cc4c02', '#993404', '#662506'],
+  purples: ['#fcfbfd', '#efedf5', '#dadaeb', '#bcbddc', '#9e9ac8', '#807dba', '#6a51a3', '#54278f', '#3f007d'],
+  blues: ['#f7fbff', '#deebf7', '#c6dbef', '#9ecae1', '#6baed6', '#4292c6', '#2171b5', '#08519c', '#08306b'],
+  greens: ['#f7fcf5', '#e5f5e0', '#c7e9c0', '#a1d99b', '#74c476', '#41ab5d', '#238b45', '#006d2c', '#00441b'],
+  oranges: ['#fff5eb', '#fee6ce', '#fdd0a2', '#fdae6b', '#fd8d3c', '#f16913', '#d94801', '#a63603', '#7f2704'],
+  reds: ['#fff5f0', '#fee0d2', '#fcbba1', '#fc9272', '#fb6a4a', '#ef3b2c', '#cb181d', '#a50f15', '#67000d'],
+  greys: ['#ffffff', '#f0f0f0', '#d9d9d9', '#bdbdbd', '#969696', '#737373', '#525252', '#252525', '#000000'],
+  purple_orange: ['#b35806', '#e08214', '#fdb863', '#fee0b6', '#f7f7f7', '#d8daeb', '#b2abd2', '#8073ac', '#542788'],
+  brown_bluegreen: ['#8c510a', '#bf812d', '#dfc27d', '#f6e8c3', '#f5f5f5', '#c7eae5', '#80cdc1', '#35978f', '#01665e'],
+  purple_green: ['#762a83', '#9970ab', '#c2a5cf', '#e7d4e8', '#f7f7f7', '#d9f0d3', '#a6dba0', '#5aae61', '#1b7837'],
+  pink_yellowgreen: ['#c51b7d', '#de77ae', '#f1b6da', '#fde0ef', '#f7f7f7', '#e6f5d0', '#b8e186', '#7fbc41', '#4d9221'],
+  red_blue: ['#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#f7f7f7', '#d1e5f0', '#92c5de', '#4393c3', '#2166ac'],
+  red_grey: ['#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#ffffff', '#e0e0e0', '#bababa', '#878787', '#4d4d4d'],
+  red_yellow_blue: ['#d73027', '#f46d43', '#fdae61', '#fee090', '#ffffbf', '#e0f3f8', '#abd9e9', '#74add1', '#4575b4'],
+  spectral: ['#9e0142', '#d53e4f', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#e6f598', '#abdda4', '#66c2a5', '#3288bd', '#5e4fa2'],
+  red_yellow_green: ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#d9ef8b', '#a6d96a', '#66bd63', '#1a9850', '#006837'],
 };
 
 export const getColorFromScheme = (function () {
@@ -117,20 +143,40 @@ export const getColorFromScheme = (function () {
   };
 }());
 
-export const colorScalerFactory = function (colors, data, accessor) {
+export const colorScalerFactory = function (colors, data, accessor, bucket = 40, scale = 'threshold') {
   // Returns a linear scaler our of an array of color
   if (!Array.isArray(colors)) {
     /* eslint no-param-reassign: 0 */
     colors = spectrums[colors];
   }
+  bucket = Number(bucket);
   let ext = [0, 1];
   if (data !== undefined) {
     ext = d3.extent(data, accessor);
   }
   const points = [];
-  const chunkSize = (ext[1] - ext[0]) / colors.length;
-  $.each(colors, function (i) {
-    points.push(i * chunkSize);
-  });
-  return d3.scale.linear().domain(points).range(colors);
+  const chunkSize = (ext[1] - ext[0]) / bucket;
+
+  const linearDomain = [];
+  for (let i = 0; i < colors.length; i++) {
+    linearDomain.push(i / colors.length);
+  }
+
+  const newColors = [];
+  const colorScaler = d3.scale.linear().domain(linearDomain).range(colors);
+
+  for (let i = 0; i < bucket; i++) {
+    newColors.push(colorScaler(i / bucket));
+  }
+
+  for (let i = 1; i < bucket; i++) {
+    points.push(ext[0] + (i * chunkSize));
+  }
+  if (scale === 'quantile') {
+    return d3.scale.quantile().domain(data.map(accessor)).range(newColors);
+  } else if (scale === 'quantize') {
+    return d3.scale.quantize().domain(data.map(accessor)).range(newColors);
+  } else if (scale === 'threshold') {
+    return d3.scale.threshold().domain(points).range(newColors);
+  }
 };
diff --git a/superset/assets/package-lock.json b/superset/assets/package-lock.json
new file mode 100644
index 0000000000..ea95a61d6c
--- /dev/null
+++ b/superset/assets/package-lock.json
@@ -0,0 +1,37 @@
+{
+  "name": "superset",
+  "version": "0.19.1",
+  "lockfileVersion": 1,
+  "dependencies": {
+    "big.js": {
+      "version": "3.1.3",
+      "resolved": "https://registry.npmjs.org/big.js/-/big.js-3.1.3.tgz",
+      "integrity": "sha1-TK2iGTZS6zyp7I5VyQFWacmAaXg=",
+      "dev": true
+    },
+    "emojis-list": {
+      "version": "2.1.0",
+      "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz",
+      "integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=",
+      "dev": true
+    },
+    "json5": {
+      "version": "0.5.1",
+      "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz",
+      "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=",
+      "dev": true
+    },
+    "loader-utils": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.1.0.tgz",
+      "integrity": "sha1-yYrvSIvM7aL/teLeZG1qdUQp9c0=",
+      "dev": true
+    },
+    "transform-loader": {
+      "version": "0.2.4",
+      "resolved": "https://registry.npmjs.org/transform-loader/-/transform-loader-0.2.4.tgz",
+      "integrity": "sha1-5ch4d7qW1R0/IlNoWHtG4ibRzsk=",
+      "dev": true
+    }
+  }
+}
diff --git a/superset/assets/package.json b/superset/assets/package.json
index fd78bdeaa8..dc62dfd054 100644
--- a/superset/assets/package.json
+++ b/superset/assets/package.json
@@ -125,7 +125,7 @@
     "redux-mock-store": "^1.2.3",
     "sinon": "^3.2.1",
     "style-loader": "^0.18.2",
-    "transform-loader": "^0.2.3",
+    "transform-loader": "^0.2.4",
     "uglifyjs-webpack-plugin": "^0.4.6",
     "url-loader": "^0.5.7",
     "webpack": "^3.4.1",
diff --git a/superset/assets/visualizations/big_number.css b/superset/assets/visualizations/big_number.css
index 8fd5345ee7..844e64d2f2 100644
--- a/superset/assets/visualizations/big_number.css
+++ b/superset/assets/visualizations/big_number.css
@@ -27,5 +27,4 @@
   fill: none;
   stroke: black;
   stroke-width: 1;
-}
-
+}
\ No newline at end of file
diff --git a/superset/assets/visualizations/cal_heatmap.css b/superset/assets/visualizations/cal_heatmap.css
index 0ab2087262..13a669c551 100644
--- a/superset/assets/visualizations/cal_heatmap.css
+++ b/superset/assets/visualizations/cal_heatmap.css
@@ -1,3 +1,3 @@
 .cal_heatmap .slice_container {
   padding: 10px;
-}
+}
\ No newline at end of file
diff --git a/superset/assets/visualizations/country_map.css b/superset/assets/visualizations/country_map.css
index 8a16105aaa..4fcb607853 100644
--- a/superset/assets/visualizations/country_map.css
+++ b/superset/assets/visualizations/country_map.css
@@ -34,3 +34,26 @@
 .country_map path.region {
     cursor: pointer;
 }
+
+.country_map #legend {
+    padding: 1.5em 0 0 1.5em;
+}
+
+div #legend {
+    display: block;
+}
+
+.country_map #legend text {
+    font-weight: bold;
+    -webkit-text-stroke-width: 0px;
+    -webkit-text-stroke-color: white;
+}
+
+.country_map li.key {
+    border-top-width: 15px;
+    border-top-style: solid;
+    font-size: .75em;
+    width: 10%;
+    padding-left: 0;
+    padding-right: 0;
+}
\ No newline at end of file
diff --git a/superset/assets/visualizations/country_map.js b/superset/assets/visualizations/country_map.js
index 54fba87bb4..8c56f7cd38 100644
--- a/superset/assets/visualizations/country_map.js
+++ b/superset/assets/visualizations/country_map.js
@@ -12,8 +12,16 @@ function countryMapChart(slice, payload) {
   let resultText;
   const container = slice.container;
   const data = payload.data;
+  const numberFormat = d3.format(fd.number_format);
 
-  const colorScaler = colorScalerFactory(fd.linear_color_scheme, data, v => v.metric);
+
+  const colorScaler = colorScalerFactory(
+    fd.linear_color_scheme,
+    data,
+    v => v.metric,
+    fd.bucket_number,
+    fd.scale_type,
+  );
   const colorMap = {};
   data.forEach((d) => {
     colorMap[d.country_id] = colorScaler(d.metric);
@@ -23,6 +31,17 @@ function countryMapChart(slice, payload) {
   let centered;
   path = d3.geo.path();
   d3.select(slice.selector).selectAll('*').remove();
+
+  if (fd.show_map_legend) {
+    d3.select(slice.selector)
+      .append('div')
+      .attr('id', 'legend')
+      .append('text')
+      .text(fd.metric);
+  } else {
+    d3.select(slice.selector).select('div#legend').remove();
+  }
+
   const div = d3.select(slice.selector)
     .append('svg:svg')
     .attr('width', slice.width())
@@ -91,7 +110,7 @@ function countryMapChart(slice, payload) {
 
   const updateMetrics = function (region) {
     if (region.length > 0) {
-      resultText.text(d3.format(',')(region[0].metric));
+      resultText.text((numberFormat(region[0].metric)));
     }
   };
 
@@ -131,6 +150,26 @@ function countryMapChart(slice, payload) {
     .attr('x', 20)
     .attr('y', 60);
 
+  // Adding legend to map
+  const legend = d3.select('#legend')
+   .append('ul')
+   .attr('class', 'list-inline');
+
+  const keys = legend.selectAll('li.key')
+    .data(colorScaler.range());
+
+  keys.enter().append('li')
+    .attr('class', 'key')
+    .style('border-top-color', String)
+    .text(
+      function (d) {
+        const r = colorScaler.invertExtent(d);
+        if (r[0] == null) {
+          return numberFormat(d3.min(data, v => v.metric));
+        }
+        return (numberFormat(r[0]));
+      });
+
   const url = `/static/assets/visualizations/countries/${fd.select_country.toLowerCase()}.geojson`;
   d3.json(url, function (error, mapData) {
     const features = mapData.features;


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services