Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Reorganization [part 2] #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 39 commits into from
Nov 16, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
ba421a8
mv topojsons to src/assets/topojson
etpinard Nov 11, 2015
edb54d3
put all trace modules into src/traces/*/
etpinard Nov 11, 2015
03fd865
put constants files into src/constants/
etpinard Nov 11, 2015
db76f02
put events.js & queue.js in lib/ rename plotly_util --> svg_text_utils
etpinard Nov 11, 2015
ce39cf5
put plot components into src/components/
etpinard Nov 11, 2015
97cb7bb
break up graph_obj.js:
etpinard Nov 11, 2015
942e49e
put plot-type-specific lib functions in lib/
etpinard Nov 11, 2015
dd7ccc5
change path to geo assets index file
etpinard Nov 11, 2015
edae224
put plot_schema in plot_api/
etpinard Nov 11, 2015
df06911
break lib.js into smaller lib modules:
etpinard Nov 11, 2015
4181e97
split color attributes into attribute.js file
etpinard Nov 11, 2015
f842118
make attributes files require in attributes file directly:
etpinard Nov 11, 2015
01ee254
update colorbar Plotly.Plots.titles --> Plotly.Title.draw
etpinard Nov 11, 2015
2d40132
fix choropleth plot params --> constants
etpinard Nov 11, 2015
865476a
mv geo module to plots/geo :
etpinard Nov 11, 2015
968257e
put gl2d modules in src/plots/gl2d/
etpinard Nov 11, 2015
ff7c994
put gl3d module in plots/gl3d/ :
etpinard Nov 11, 2015
9edbce3
break attributes from axes.js
etpinard Nov 11, 2015
769f6dd
put graph_interact in plots/cartesian
etpinard Nov 11, 2015
914dcbf
put polar modules in plots/polar
etpinard Nov 11, 2015
c833198
re-org plotly.js
etpinard Nov 11, 2015
4f57bff
fix paths + lint
etpinard Nov 11, 2015
3349e7b
fix paths in jamsine tests
etpinard Nov 11, 2015
d3087b1
add index file exporting only API Plotly methods:
etpinard Nov 12, 2015
55e203a
mv plots/plots/* to plots/* :
etpinard Nov 12, 2015
4fd274a
mv colorscale attributes out of colorbar/ into colorscale/
etpinard Nov 12, 2015
ad49e57
be more consistent about attribute file names:
etpinard Nov 12, 2015
9d2568d
rm check for Plotly.ErrorBars (rm sub-bundles for now)
etpinard Nov 12, 2015
94a450c
rm check for Plotly.Queue:
etpinard Nov 12, 2015
f8ce24a
lint
etpinard Nov 12, 2015
f49923f
Merge branch 'master' into reorg-src
etpinard Nov 13, 2015
7150055
add postinstall hook to preprocess plot css and icons on install
etpinard Nov 15, 2015
ce393fb
make Snapshot and PlotSchema to 'beta' exposed methods
etpinard Nov 15, 2015
dd8b3d3
mv plot_config to plot_api/
etpinard Nov 15, 2015
6d0e221
add Plotly.setPlotConfig to API:
etpinard Nov 15, 2015
a2c72ed
change inner module pattern:
etpinard Nov 15, 2015
2de1313
jshintrc copied from streambed
alexcjohnson Nov 15, 2015
6c279ee
update jshintrc:
etpinard Nov 16, 2015
4491321
add jshint devDep and 'run lint' script
etpinard Nov 16, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
mv geo module to plots/geo :
- keep GeoLayout module (for now)
- merge GeoAxes into GeoLayout
  • Loading branch information
etpinard committed Nov 11, 2015
commit 865476a50d4e0c705c3dc2291720e0a8753eec38
52 changes: 28 additions & 24 deletions 52 src/geo/geo.js → src/plots/geo/geo.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@

/* global PlotlyGeoAssets:false */

var Plotly = require('../plotly'),
d3 = require('d3'),
params = require('./lib/params'),
addProjectionsToD3 = require('./lib/projections'),
createGeoScale = require('./lib/set-scale'),
createGeoZoom = require('./lib/zoom'),
createGeoZoomReset = require('./lib/zoom-reset'),
plotScatterGeo = require('./plot/scattergeo'),
plotChoropleth = require('./plot/choropleth'),
topojsonUtils = require('./lib/topojson-utils'),
topojsonFeature = require('topojson').feature;
var Plotly = require('../../plotly');
var d3 = require('d3');

var addProjectionsToD3 = require('./projections');
var createGeoScale = require('./set_scale');
var createGeoZoom = require('./zoom');
var createGeoZoomReset = require('./zoom_reset');

var plotScatterGeo = require('../../traces/scattergeo/plot');
var plotChoropleth = require('../../traces/choropleth/plot');

var constants = require('../../constants/geo_constants');
var topojsonUtils = require('../../lib/topojson_utils');
var topojsonFeature = require('topojson').feature;


function Geo(options, fullLayout) {

Expand Down Expand Up @@ -129,13 +133,13 @@ proto.makeProjection = function(geoLayout) {

if(isNew) {
this.projectionType = projType;
projection = this.projection = d3.geo[params.projNames[projType]]();
projection = this.projection = d3.geo[constants.projNames[projType]]();
}
else projection = this.projection;

projection
.translate(projLayout._translate0)
.precision(params.precision);
.precision(constants.precision);

if(!geoLayout._isAlbersUsa) {
projection
Expand All @@ -146,7 +150,7 @@ proto.makeProjection = function(geoLayout) {
if(geoLayout._clipAngle) {
this.clipAngle = geoLayout._clipAngle; // needed in proto.render
projection
.clipAngle(geoLayout._clipAngle - params.clipPad);
.clipAngle(geoLayout._clipAngle - constants.clipPad);
}
else this.clipAngle = null; // for graph edits

Expand Down Expand Up @@ -249,7 +253,7 @@ proto.drawTopo = function(selection, layerName, geoLayout) {

var topojson = this.topojson,
datum = layerName==='frame' ?
params.sphereSVG :
constants.sphereSVG :
topojsonFeature(topojson, topojson.objects[layerName]);

selection.append('g')
Expand All @@ -273,7 +277,7 @@ proto.drawGraticule = function(selection, axisName, geoLayout) {

if(axisLayout.showgrid !== true) return;

var scopeDefaults = params.scopeDefaults[geoLayout.scope],
var scopeDefaults = constants.scopeDefaults[geoLayout.scope],
lonaxisRange = scopeDefaults.lonaxisRange,
lataxisRange = scopeDefaults.lataxisRange,
step = axisName==='lonaxis' ?
Expand All @@ -290,8 +294,8 @@ proto.drawGraticule = function(selection, axisName, geoLayout) {

proto.drawLayout = function(geoLayout) {
var gBaseLayer = this.framework.select('g.baselayer'),
baseLayers = params.baseLayers,
axesNames = params.axesNames,
baseLayers = constants.baseLayers,
axesNames = constants.axesNames,
layerName;

// TODO move to more d3-idiomatic pattern (that's work on replot)
Expand All @@ -311,7 +315,7 @@ proto.drawLayout = function(geoLayout) {
};

function styleFillLayer(selection, layerName, geoLayout) {
var layerAdj = params.layerNameToAdjective[layerName];
var layerAdj = constants.layerNameToAdjective[layerName];

selection.select('.' + layerName)
.selectAll('path')
Expand All @@ -320,7 +324,7 @@ function styleFillLayer(selection, layerName, geoLayout) {
}

function styleLineLayer(selection, layerName, geoLayout) {
var layerAdj = params.layerNameToAdjective[layerName];
var layerAdj = constants.layerNameToAdjective[layerName];

selection.select('.' + layerName)
.selectAll('path')
Expand All @@ -338,8 +342,8 @@ function styleGraticule(selection, axisName, geoLayout) {
}

proto.styleLayer = function(selection, layerName, geoLayout) {
var fillLayers = params.fillLayers,
lineLayers = params.lineLayers;
var fillLayers = constants.fillLayers,
lineLayers = constants.lineLayers;

if(fillLayers.indexOf(layerName)!==-1) {
styleFillLayer(selection, layerName, geoLayout);
Expand All @@ -351,8 +355,8 @@ proto.styleLayer = function(selection, layerName, geoLayout) {

proto.styleLayout = function(geoLayout) {
var gBaseLayer = this.framework.select('g.baselayer'),
baseLayers = params.baseLayers,
axesNames = params.axesNames,
baseLayers = constants.baseLayers,
axesNames = constants.axesNames,
layerName;

for(var i = 0; i < baseLayers.length; i++) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
var Plotly = require('../../plotly'),
params = require('../lib/params');
var colorAttrs = require('../../../components/color/attributes');
var constants = require('../../../constants/geo_constants');
var geoAxesAttrs = require('./axis_attributes');


module.exports = {
domain: {
Expand Down Expand Up @@ -45,15 +47,15 @@ module.exports = {
scope: {
valType: 'enumerated',
role: 'info',
values: Object.keys(params.scopeDefaults),
values: Object.keys(constants.scopeDefaults),
dflt: 'world',
description: 'Set the scope of the map.'
},
projection: {
type: {
valType: 'enumerated',
role: 'info',
values: Object.keys(params.projNames),
values: Object.keys(constants.projNames),
description: 'Sets the projection type.'
},
rotation: {
Expand Down Expand Up @@ -112,7 +114,7 @@ module.exports = {
coastlinecolor: {
valType: 'color',
role: 'style',
dflt: Plotly.Color.defaultLine,
dflt: colorAttrs.defaultLine,
description: 'Sets the coastline color.'
},
coastlinewidth: {
Expand All @@ -131,7 +133,7 @@ module.exports = {
landcolor: {
valType: 'color',
role: 'style',
dflt: params.landColor,
dflt: constants.landColor,
description: 'Sets the land mass color.'
},
showocean: {
Expand All @@ -143,7 +145,7 @@ module.exports = {
oceancolor: {
valType: 'color',
role: 'style',
dflt: params.waterColor,
dflt: constants.waterColor,
description: 'Sets the ocean color'
},
showlakes: {
Expand All @@ -155,7 +157,7 @@ module.exports = {
lakecolor: {
valType: 'color',
role: 'style',
dflt: params.waterColor,
dflt: constants.waterColor,
description: 'Sets the color of the lakes.'
},
showrivers: {
Expand All @@ -167,7 +169,7 @@ module.exports = {
rivercolor: {
valType: 'color',
role: 'style',
dflt: params.waterColor,
dflt: constants.waterColor,
description: 'Sets color of the rivers.'
},
riverwidth: {
Expand All @@ -185,7 +187,7 @@ module.exports = {
countrycolor: {
valType: 'color',
role: 'style',
dflt: Plotly.Color.defaultLine,
dflt: colorAttrs.defaultLine,
description: 'Sets line color of the country boundaries.'
},
countrywidth: {
Expand All @@ -206,7 +208,7 @@ module.exports = {
subunitcolor: {
valType: 'color',
role: 'style',
dflt: Plotly.Color.defaultLine,
dflt: colorAttrs.defaultLine,
description: 'Sets the color of the subunits boundaries.'
},
subunitwidth: {
Expand All @@ -224,7 +226,7 @@ module.exports = {
framecolor: {
valType: 'color',
role: 'style',
dflt: Plotly.Color.defaultLine,
dflt: colorAttrs.defaultLine,
description: 'Sets the color the frame.'
},
framewidth: {
Expand All @@ -237,11 +239,9 @@ module.exports = {
bgcolor: {
valType: 'color',
role: 'style',
dflt: Plotly.Color.background,
dflt: colorAttrs.background,
description: 'Set the background color of the map'
},
_nestedModules: {
'lonaxis': 'GeoAxes',
'lataxis': 'GeoAxes'
}
lonaxis: geoAxesAttrs,
lataxis: geoAxesAttrs
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var Plotly = require('../../plotly');
var colorAttrs = require('../../../components/color/attributes');

module.exports = {
range: {
Expand Down Expand Up @@ -33,7 +33,7 @@ module.exports = {
gridcolor: {
valType: 'color',
role: 'style',
dflt: Plotly.Color.lightLine,
dflt: colorAttrs.lightLine,
description: [
'Sets the graticule\'s stroke color.'
].join(' ')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
'use strict';

var Plotly = require('../../plotly'),
params = require('../lib/params');
var Plotly = require('../../../plotly');
var constants = require('../../../constants/geo_constants');
var axisAttributes = require('./axis_attributes');

var GeoAxes = module.exports = {};

GeoAxes.layoutAttributes = require('../attributes/geoaxes');

GeoAxes.supplyLayoutDefaults = function(geoLayoutIn, geoLayoutOut) {
var axesNames = params.axesNames;

var axisIn, axisOut, axisName, rangeDflt, range, show;
module.exports = function supplyGeoAxisLayoutDefaults(geoLayoutIn, geoLayoutOut) {
var axesNames = constants.axesNames;

function coerce(attr, dflt) {
return Plotly.Lib.coerce(axisIn, axisOut,
GeoAxes.layoutAttributes, attr, dflt);
return Plotly.Lib.coerce(axisIn, axisOut, axisAttributes, attr, dflt);
}

function getRangeDflt(axisName) {
Expand All @@ -26,7 +21,7 @@ GeoAxes.supplyLayoutDefaults = function(geoLayoutIn, geoLayoutOut) {
projLayout = geoLayoutOut.projection;
projType = projLayout.type;
projRotation = projLayout.rotation;
dfltSpans = params[axisName + 'Span'];
dfltSpans = constants[axisName + 'Span'];

halfSpan = dfltSpans[projType]!==undefined ?
dfltSpans[projType] / 2 :
Expand All @@ -37,24 +32,24 @@ GeoAxes.supplyLayoutDefaults = function(geoLayoutIn, geoLayoutOut) {

return [rotateAngle - halfSpan, rotateAngle + halfSpan];
}
else return params.scopeDefaults[scope][axisName + 'Range'];
else return constants.scopeDefaults[scope][axisName + 'Range'];
}

for(var i = 0; i < axesNames.length; i++) {
axisName = axesNames[i];
axisIn = geoLayoutIn[axisName] || {};
axisOut = {};
var axisName = axesNames[i];
var axisIn = geoLayoutIn[axisName] || {};
var axisOut = {};

rangeDflt = getRangeDflt(axisName);
var rangeDflt = getRangeDflt(axisName);

range = coerce('range', rangeDflt);
var range = coerce('range', rangeDflt);

Plotly.Lib.noneOrAll(axisIn.range, axisOut.range, [0, 1]);

coerce('tick0', range[0]);
coerce('dtick', axisName==='lonaxis' ? 30 : 10);

show = coerce('showgrid');
var show = coerce('showgrid');
if(show) {
coerce('gridcolor');
coerce('gridwidth');
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.