sztanko / crosslet Goto Github PK
View Code? Open in Web Editor NEWCrossfilter + leaflet
License: Other
Crossfilter + leaflet
License: Other
SidekickJS detected the following issues in this commit:
lib/cie.js 4 issues:
lib/topojson.js 30 issues:
src/js/barChart.js 29 issues:
Hi sztanko! Thanks for making such a great library for making it easy to deploying filterable maps with a nice UI. Much appreciated!
I'm having some trouble with making the colorscale appear in the bar chart graphs on this map here (http://nijel.org/oned/one-d-map.html). As you can see, the colorscale I've passed to crosslet works for the map, but not for the bar chart for some reason.
My config object looks like the following:
// format functions
var percentFormat = d3.format(",.1");
var numberFormat = d3.format(",.2");
var dollarFormat = d3.format("$,.0f");
var config = {
map: {
leaflet: {
url: "http://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png", // backup in case stamen layer doesn't work
attribution: 'Map tiles by <a href="http://stamen.com">Stamen Design</a>, under <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. Data by <a href="http://openstreetmap.org">OpenStreetMap</a>, under <a href="http://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>.'
},
view: {
center: [42.5,-83.1],
zoom: 9
},
geo: {
url: "assets/topojson/detroit_region_fips_4326.geojson",
name_field: "FIPS",
id_field: "FIPS"
}
},
data: {
version: "1.0",
id_field: "FIPS"
},
dimensions: {
kirwanIndex: {
title: "Kirwan Institute Opportunity Index",
data: {
dataSet: "data/kirwanData.csv",
method: d3.csv,
field: "COMP",
colorscale: d3.scale.linear().domain([1, 10, 20]).range([ "#1b7837", "#f0f0f0", "#20698a" ]).interpolate(d3.cie.interpolateLab),
},
format: {
short: function(){return function(d) {return numberFormat(d3.round(d, 2))}},
long: function(){return function(d) {return numberFormat(d3.round(d, 2))}},
input: function(){return Math.round},
axis: function(){return function(d) {return numberFormat(d3.round(d, 2))}},
}
},
highSchoolCompletion: {
title: "High School Completion Rate",
data: {
dataSet: "data/kirwanData.csv",
method: d3.csv,
field: "EDU4",
colorscale: d3.scale.linear().domain([1, 10, 20]).range([ "#20698a", "#f0f0f0", "#d94f26"]).interpolate(d3.cie.interpolateLab),
},
format: {
short: function(){return function(d) {return percentFormat(d3.round(d, 1)) + "%"}},
long: function(){return function(d) {return percentFormat(d3.round(d, 1)) + "%"}},
input: function(){return Math.round},
axis: function(){return function(d) {return percentFormat(d3.round(d, 1)) + "%"}},
}
},
medianHHIncome: {
title: "Median Household Income",
data: {
dataSet: "data/kirwanData.csv",
method: d3.csv,
field: "EE2",
colorscale: d3.scale.linear().domain([1, 10, 20]).range([ "#20698a", "#f0f0f0", "#87af3f"]).interpolate(d3.cie.interpolateLab),
},
format: {
short: function(){return function(d) {return dollarFormat(d)}},
long: function(){return function(d) {return dollarFormat(d)}},
axis: function(){return function(d) {return dollarFormat(d)}},
}
},
vacantProperty: {
title: "Percent Vacant Property",
data: {
dataSet: "data/kirwanData.csv",
method: d3.csv,
field: "N1",
colorscale: d3.scale.linear().domain([1, 10, 20]).range([ "#a6c0d0", "#f0f0f0", "#f5a91d"]).interpolate(d3.cie.interpolateLab),
},
format: {
short: function(){return function(d) {return percentFormat(d3.round(d, 1)) + "%"}},
long: function(){return function(d) {return percentFormat(d3.round(d, 1)) + "%"}},
input: function(){return Math.round},
axis: function(){return function(d) {return percentFormat(d3.round(d, 1)) + "%"}},
}
},
}, // close dimensions
defaults: {
order: ["kirwanIndex", "highSchoolCompletion", "medianHHIncome", "vacantProperty"],
active: "kirwanIndex"
},
};
Is there anything obvious I'm doing wrong?
Thanks!
JD
Digits in the range inputs are covered by the bottom and right borders of the input field.
fix to css (need to be converted to less):
#line 73 of crosslet.css:
.crosslet .crosslet_panel .box .legendText select, .crosslet * .crosslet_panel .box .legendText select, .crosslet .crosslet_panel .box .legendForm select, .crosslet * .crosslet_panel .box .legendForm select, .crosslet .crosslet_panel .box .legendText input[type="text"], .crosslet * .crosslet_panel .box .legendText input[type="text"], .crosslet .crosslet_panel .box .legendForm input[type="text"], .crosslet * .crosslet_panel .box .legendForm input[type="text"] {
REMOVE:
height: 12px;
padding-left: 4px;
FIX (otherwise inputs are of different width!):
width: auto; -> width: 45px;
This looks like an amazing project. Thanks so much!
It wasn't clear to me from the documentation how to plot geocoded point data. Can you add that to the documentation?
In the interest of better fiddling with the plumbing between leaflet and D3, it would be nice to remove the backbone.js dependency from the codebase.
I am trying to work with the world example... If I remove one of the line items for a country (in the data.tsv, for example, Australia), then the map still displays some dimensions for Australia (incorrect though).
SidekickJS detected the following issues in this commit:
lib/cie.js 4 issues:
lib/topojson.js 30 issues:
src/js/barChart.js 29 issues:
There is an annoying bug in leaflet 0.4.4 (and older) when zooming with Chrome (animation is wobbly). You might consider pointing the examples to:
http://cdn.leafletjs.com/leaflet-0.4.5/leaflet.js
See Leaflet/Leaflet#1056
This was covered in the "updates" issue in a roundabout way, but probably deserves its own issue thread. Now that cloudmade has switched to an enterprise model (see leaflet issue here), crosslet could use a straightforward method for pointing to tiles from other providers.
For my purposes, I've just removed all the cloudmade-specific properties in crosslet.js and index files, then linked to some MapBox example tiles, but this might not be obvious to others.
Thanks for making a great little utility. It's been hugely useful thus far.
The D3.js dependency should be split out from the crosslet.js library, and upgraded to v3.
Where is the version number located in the code? If it is there that is. I am attempting an integration with Drupal and the version number comes in handy.
Hi all,
I think it is time for a new major version of Crosslet.
Things I would like to change:
If you think there is anything else you would like to have in the new version, please comment here.
On another note, I am not likely to have time for this till summer. Volunteers are more then welcome.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.