Snippets of files used to create a data table and bubble chart.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(function (require) { | |
var _ = require('lodash'); | |
var $ = require('jquery'); | |
var k4 = require('K4D3'); | |
var app = require('modules').get('app/discover'); | |
app.directive('discoverTimechart', function ($compile) { | |
return { | |
restrict: 'E', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$scope.data = { | |
"rows": [ | |
{ | |
"columns": [ | |
{ | |
"label": "200 requests", | |
"xAxisLabel": "Date", | |
"yAxisLabel": "Average Request Size in Bytes", | |
"layers": [ | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
root /usr/ubuntu/insighfl; | |
index index.html index.htm; | |
server_name ""; | |
location / { | |
proxy_pass http://127.0.0.1:5000; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(function(require) { | |
'use strict'; | |
var _ = require('lib/lodash/dist/lodash'); | |
/* Returns the indexed position of a value in an array. */ | |
function isValInArr(val, arr) { | |
for (var i = 0; i < arr.length; i++) { | |
// if (!arr[i]) { arr.splice(i, 1); return 0; } | |
if (arr[i].x === val) { return i; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brush = d3.svg.brush() | |
.x(xScale) | |
.on('brushend', brushend); | |
if (dispatch.on('brush')) { | |
svg.append('g') | |
.attr('class', 'brush') | |
.call(brush) | |
.selectAll('rect') | |
.attr('height', height); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Example table schema | |
-- To import your schemas into your database, run: | |
-- `mysql -u username -p database < schema.sql` | |
-- where username is your MySQL username | |
-- Load data into table | |
-- LOAD DATA LOCAL INFILE 'country.csv' INTO TABLE world_index | |
-- FIELDS TERMINATED BY ',' | |
-- ENCLOSED BY '' | |
-- LINES TERMINATED BY '\n' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Pulling values recursively from Pie Chart Data | |
function getSize (obj) { | |
return obj.size; | |
} | |
function isZero (d) { | |
return d.size === 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// D3 code | |
var $el = $('.visualize-chart')[0]; | |
var data = { | |
type: 'chart', | |
series: [{}, {}, {}] | |
}; | |
var selection = d3.select($el).datum(data).call(split); | |
function split (selection) { | |
selection.each(function (data) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
country | median_age | gdp | edu_index | |
---|---|---|---|---|
Afghanistan | 18 | 18949 | 0.354 | |
Albania | 30.2 | 13000 | 0.886 | |
Algeria | 27.1 | 198735 | 0.748 | |
Andorra | 39.9 | 3577 | 0.878 | |
Antigua and Barbuda | 30 | 1118 | 0.945 | |
Argentina | 30.3 | 448165 | 0.946 | |
Australia | 37.5 | 1515468 | 0.993 | |
Austria | 42.6 | 418031 | 0.962 | |
Azerbaijan | 28.5 | 63404 | 0.881 |