Skip to content

Commit

Permalink
solve conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
yxjames committed Jun 25, 2016
2 parents 068e818 + d5b8414 commit f38fd03
Show file tree
Hide file tree
Showing 24 changed files with 911 additions and 107 deletions.
Binary file added caravel/assets/images/viz_thumbnails/mapbox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion caravel/assets/javascripts/modules/caravel.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ var sourceMap = {
world_map: 'world_map.js',
treemap: 'treemap.js',
cal_heatmap: 'cal_heatmap.js',
horizon: 'horizon.js'
horizon: 'horizon.js',
mapbox: 'mapbox.jsx'
};

var color = function () {
Expand Down
1 change: 0 additions & 1 deletion caravel/assets/javascripts/welcome.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,4 @@ $(document).ready(function () {
});
});
modelViewTable('#dash_table', 'DashboardModelViewAsync', 'changed_on', 'desc');
modelViewTable('#slice_table', 'SliceAsync', 'changed_on', 'desc');
});
14 changes: 12 additions & 2 deletions caravel/assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
},
"homepage": "https://github.com/airbnb/caravel#readme",
"dependencies": {
"autobind-decorator": "^1.3.3",
"babel-loader": "^6.2.1",
"babel-polyfill": "^6.3.14",
"babel-preset-es2015": "^6.3.13",
Expand All @@ -43,6 +44,7 @@
"bootstrap-datepicker": "^1.6.0",
"bootstrap-toggle": "^2.2.1",
"brace": "^0.7.0",
"brfs": "^1.4.3",
"cal-heatmap": "3.5.4",
"css-loader": "^0.23.1",
"d3": "^3.5.14",
Expand All @@ -58,20 +60,28 @@
"imports-loader": "^0.6.5",
"jquery": "^2.2.1",
"jquery-ui": "^1.10.5",
"json-loader": "^0.5.4",
"less": "^2.6.1",
"less-loader": "^2.2.2",
"mapbox-gl": "^0.20.0",
"mustache": "^2.2.1",
"nvd3": "1.8.2",
"nvd3": "1.8.3",
"react": "^0.14.7",
"react-bootstrap": "^0.28.3",
"react-dom": "^0.14.7",
"react-grid-layout": "^0.12.3",
"react-map-gl": "^1.0.0-beta-10",
"react-resizable": "^1.3.3",
"select2": "3.5",
"select2-bootstrap-css": "^1.4.6",
"style-loader": "^0.13.0",
"supercluster": "Pending PR at https://github.com/mapbox/supercluster/pull/12",
"supercluster": "https://github.com/georgeke/supercluster/tarball/ac3492737e7ce98e07af679623aad452373bbc40",
"topojson": "^1.6.22",
"webpack": "^1.12.12"
"transform-loader": "^0.2.3",
"viewport-mercator-project": "^2.1.0",
"webpack": "^1.12.12",
"webworkify-webpack": "1.0.6"
},
"devDependencies": {
"eslint": "^2.2.0",
Expand Down
27 changes: 27 additions & 0 deletions caravel/assets/utils/common.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const d3 = window.d3 || require('d3');

export const EARTH_CIRCUMFERENCE_KM = 40075.16;
export const LUMINANCE_RED_WEIGHT = 0.2126;
export const LUMINANCE_GREEN_WEIGHT = 0.7152;
export const LUMINANCE_BLUE_WEIGHT = 0.0722;
export const MILES_PER_KM = 1.60934;
export const DEFAULT_LONGITUDE = -122.405293;
export const DEFAULT_LATITUDE = 37.772123;
export const DEFAULT_ZOOM = 11;

export function kmToPixels(kilometers, latitude, zoomLevel) {
// Algorithm from: http://wiki.openstreetmap.org/wiki/Zoom_levels
const latitudeRad = latitude * (Math.PI / 180);
// Seems like the zoomLevel is off by one
const kmPerPixel = EARTH_CIRCUMFERENCE_KM * Math.cos(latitudeRad) / Math.pow(2, zoomLevel + 9);
return d3.round(kilometers / kmPerPixel, 2);
}

export function isNumeric(num) {
return !isNaN(parseFloat(num)) && isFinite(num);
}

export function rgbLuminance(r, g, b) {
// Formula: https://en.wikipedia.org/wiki/Relative_luminance
return LUMINANCE_RED_WEIGHT*r + LUMINANCE_GREEN_WEIGHT*g + LUMINANCE_BLUE_WEIGHT*b;
}
16 changes: 16 additions & 0 deletions caravel/assets/visualizations/mapbox.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
div.widget .slice_container {
cursor: grab;
cursor: -moz-grab;
cursor: -webkit-grab;
overflow: hidden;
}

div.widget .slice_container:active {
cursor: grabbing;
cursor: -moz-grabbing;
cursor: -webkit-grabbing;
}

.slice_container div {
padding-top: 0px;
}
Loading

0 comments on commit f38fd03

Please sign in to comment.