mirror of https://github.com/apache/superset.git
Merge pull request #124 from mistercrunch/colors
A more cohesive color strategy
This commit is contained in:
commit
9fb708a74a
|
@ -1,3 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
rm -r _build
|
||||
make html
|
||||
cp -r _build/html/ ../../panoramix-docs/
|
||||
|
|
|
@ -3,6 +3,22 @@ var px = (function() {
|
|||
var visualizations = {};
|
||||
var dashboard = undefined;
|
||||
|
||||
var bnbColors = [
|
||||
//rausch hackb kazan babu lima beach barol
|
||||
'#ff5a5f', '#7b0051', '#007A87', '#00d1c1', '#8ce071', '#ffb400', '#b4a76c',
|
||||
'#ff8083', '#cc0086', '#00a1b3', '#00ffeb', '#bbedab', '#ffd266', '#cbc29a',
|
||||
'#ff3339', '#ff1ab1', '#005c66', '#00b3a5', '#55d12e', '#b37e00', '#988b4e',
|
||||
];
|
||||
function colorBnb() {
|
||||
// Color factory
|
||||
var seen = {};
|
||||
return function(s){
|
||||
if(seen[s] === undefined)
|
||||
seen[s] = Object.keys(seen).length;
|
||||
return bnbColors[seen[s] % bnbColors.length];
|
||||
};
|
||||
}
|
||||
|
||||
function UTC(dttm){
|
||||
return v = new Date(dttm.getUTCFullYear(), dttm.getUTCMonth(), dttm.getUTCDate(), dttm.getUTCHours(), dttm.getUTCMinutes(), dttm.getUTCSeconds());
|
||||
}
|
||||
|
@ -27,10 +43,6 @@ var px = (function() {
|
|||
return f(d);
|
||||
};
|
||||
}
|
||||
colors = [
|
||||
"#FF5A5F", "#007A87", "#7B0051", "#00D1C1", "#8CE071", "#FFB400",
|
||||
"#FFAA91", "#B4A76C", "#9CA299", "#565A5C"
|
||||
];
|
||||
|
||||
var Slice = function(data, dashboard){
|
||||
var timer;
|
||||
|
@ -474,7 +486,8 @@ var px = (function() {
|
|||
initExploreView: initExploreView,
|
||||
initDashboardView: initDashboardView,
|
||||
formatDate: formatDate,
|
||||
colors: colors,
|
||||
timeFormatFactory: timeFormatFactory,
|
||||
colorBnb: colorBnb,
|
||||
bnbColors: bnbColors,
|
||||
}
|
||||
})();
|
||||
|
|
|
@ -27,7 +27,7 @@ px.registerViz('word_cloud', function(slice) {
|
|||
scale = d3.scale.linear()
|
||||
.range(range)
|
||||
.domain(d3.extent(data, function(d) { return d.size; }));
|
||||
var fill = d3.scale.category20();
|
||||
var fill = px.colorBnb();
|
||||
var layout = d3.layout.cloud()
|
||||
.size(size)
|
||||
.words(data)
|
||||
|
|
|
@ -107,26 +107,13 @@ class JSONEncodedDict(TypeDecorator):
|
|||
|
||||
class ColorFactory(object):
|
||||
BNB_COLORS = [
|
||||
"#007A87",
|
||||
"#00D1C1",
|
||||
"#565A5C",
|
||||
"#7B0051",
|
||||
"#898C8C",
|
||||
"#8CE071",
|
||||
"#4EDED2",
|
||||
"#4FA3AB",
|
||||
"#9CA299",
|
||||
"#A14D83",
|
||||
"#B4A76C",
|
||||
"#C9BF97",
|
||||
"#FF5A5F",
|
||||
"#FFAA91",
|
||||
"#FFB400",
|
||||
"#FFC4B3",
|
||||
"#FFCA4F",
|
||||
#rausch hackb kazan babu lima beach barol
|
||||
'#ff5a5f', '#7b0051', '#007A87', '#00d1c1', '#8ce071', '#ffb400', '#b4a76c',
|
||||
'#ff8083', '#cc0086', '#00a1b3', '#00ffeb', '#bbedab', '#ffd266', '#cbc29a',
|
||||
'#ff3339', '#ff1ab1', '#005c66', '#00b3a5', '#55d12e', '#b37e00', '#988b4e',
|
||||
]
|
||||
|
||||
def __init__(self, hash_based=True):
|
||||
def __init__(self, hash_based=False):
|
||||
self.d = {}
|
||||
self.hash_based = hash_based
|
||||
|
||||
|
|
|
@ -845,6 +845,7 @@ class DistributionBarViz(DistributionPieViz):
|
|||
df = self.get_df()
|
||||
series = df.to_dict('series')
|
||||
chart_data = []
|
||||
cf = utils.ColorFactory()
|
||||
for name, ys in series.items():
|
||||
if df[name].dtype.kind not in "biufc":
|
||||
continue
|
||||
|
@ -855,7 +856,6 @@ class DistributionBarViz(DistributionPieViz):
|
|||
series_title = ", ".join(name)
|
||||
else:
|
||||
series_title = ", ".join(name[1:])
|
||||
cf = utils.ColorFactory()
|
||||
d = {
|
||||
"key": series_title,
|
||||
"color": cf.get(series_title),
|
||||
|
|
Loading…
Reference in New Issue