diff --git a/CONTRIBUTE.md b/CONTRIBUTE.md index b921545c..8f775c76 100644 --- a/CONTRIBUTE.md +++ b/CONTRIBUTE.md @@ -33,4 +33,10 @@ First line of the git message has to be in the following format: `( * `` is a specific module within SOCRAT you're contributing to, i.e. `Core` or `Charts` or `PowerCalc` * `` is a description of the change starting with a verb in imperative form, present tense, not capitalized, without period in the end; when commiting unfinished work (e.g. with known bugs), prepend `` with `WIP`. -Additional details can be added on a second line of the message. +Additional details can be added on a second line of the message. + +## SOCR Datasets for testing + +**Iris** - famous dataset in machine learning [1]. To be able to use it locally for testing, download [CSV file](https://drive.google.com/file/d/0BzJubeARG-hsdTdRTC03RFdhRTg/view?usp=sharing) and place it under ``_build/datasets/iris.csv`` + +[1] Lichman, M. (2013). [UCI Machine Learning Repository](http://archive.ics.uci.edu/ml). Irvine, CA: University of California, School of Information and Computer Science. diff --git a/README.md b/README.md index 1f89ec5d..f60fba16 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,9 @@ A scalable and highly flexible HTML5/JS platform to build and run in-browser applications for interactive data analysis and visualization. -* Web site: http://socr.umich.edu -* Issue-tracking and project management: https://socredu.atlassian.net/browse/SOCRFW +* [Web site](http://socr.umich.edu) +* [Issue-tracking and project management](https://github.com/SOCR/SOCRAT-issues) +* [Contribution guidelines](https://github.com/SOCR/SOCRAT/blob/master/CONTRIBUTE.md) * **Note: project is under active development, unit tests currently are not passing, bugs are possible** [![Build Status](https://travis-ci.org/SOCR/SOCRAT.svg?branch=master)](https://travis-ci.org/SOCR/SOCRAT) diff --git a/app/scripts/analysis/GetData/GetDataMainCtrl.controller.coffee b/app/scripts/analysis/GetData/GetDataMainCtrl.controller.coffee index f42bb5d8..2573cc3b 100644 --- a/app/scripts/analysis/GetData/GetDataMainCtrl.controller.coffee +++ b/app/scripts/analysis/GetData/GetDataMainCtrl.controller.coffee @@ -203,7 +203,7 @@ module.exports = class GetDataMainCtrl extends BaseCtrl data = @dataAdaptor.toDataFrame dataResults @passReceivedData data else - console.log 'rejected:' + msg + console.log 'GETDATA: request failed' getJsonByUrl: (type) -> @d3.json @jsonUrl, diff --git a/app/scripts/analysis/charts/ChartsPieChart.service.coffee b/app/scripts/analysis/charts/ChartsPieChart.service.coffee index 549bef76..7b341817 100644 --- a/app/scripts/analysis/charts/ChartsPieChart.service.coffee +++ b/app/scripts/analysis/charts/ChartsPieChart.service.coffee @@ -33,7 +33,7 @@ module.exports = class ChartsPieChart extends BaseService return obj drawPie: (data,width,height,_graph, pie) -> # "pie" is a boolean - radius = Math.min(width, height) / 2 - 15 + radius = Math.min(width, height) / 2 outerRadius = radius arc = d3.svg.arc() .outerRadius(outerRadius) @@ -55,7 +55,9 @@ module.exports = class ChartsPieChart extends BaseService .sort(null) formatted_data = @makePieData data - + sum = @valueSum + clickOn = (false for [0..formatted_data.length-1]) + # PIE ARCS / SLICES arcs = _graph.selectAll(".arc") @@ -63,30 +65,95 @@ module.exports = class ChartsPieChart extends BaseService .enter() .append('g') .attr("class", "arc") + + paths = arcs.append('path') + .attr('d', arc) + .attr('fill', (d) -> color(d.data.value)) + .on('mouseover', handleMouseOver) + .on('mouseout', handleMouseOut) + .on('click', handleClick) + + # Create Event Handlers for mouse + handleMouseOver = (d, i) -> + if clickOn[i] is false + # Use d3 to select element + d3.select(this) + .attr("stroke","white") + .transition() + .attr("d", arcOver) + .attr("stroke-width",3) + + # bold the label + d3.select(this.parentNode) + .select('text') + .attr('font-weight', 'bold') + + handleMouseOut= (d, i) -> + if clickOn[i] is false + d3.select(this) + .transition() + .attr('d', arc) + .attr("stroke", "none") + + # unbold the label + d3.select(this.parentNode) + .select('text') + .attr('font-weight', 'normal') + + handleClick= (d,i) -> + if clickOn[i] is true + clickOn[i] = false + d3.select(this) + .transition() + .attr('d', arc) + .attr("stroke", 'none') + + # unbold the label + d3.select(this.parentNode) + .select('text') + .attr('font-weight', 'normal') + + else + clickOn[i] = true + d3.select(this) + .attr('stroke', 'white') + .transition() + .attr('d', arcOver) + .attr('stroke', 3) + + arcs.append('path') .attr('d', arc) .attr('fill', (d) -> color(d.data.value)) - .on('mouseenter', (d) -> - d3.select(this).attr("stroke","white") .transition().attr("d", arcOver).attr("stroke-width",3) - ).on('mouseleave', (d) -> - d3.select(this).transition().attr('d', arc).attr("stroke", "none") - ) - - # TEXT LABELS + .on('mouseover', handleMouseOver) + .on('mouseout', handleMouseOut) + .on('click', handleClick) + + # Specify where to put text label arcs.append('text') - .attr('transform', (d) -> - c = arc.centroid(d) - x = c[0] - y = c[1] - h = Math.sqrt(x*x + y*y) - desiredLabelRad = 220 - 'translate('+ (x/h * desiredLabelRad) + ',' + (y/h * desiredLabelRad) + ')') - .attr('text-anchor', 'middle') - .text (d) => d.data.key + ': ' + parseFloat(100 * d.data.value / @valueSum).toFixed(2) + '%' - .style('font-size', '16px') + .attr('class', 'text') + .attr('transform', (d) -> + c = arc.centroid(d) + x = c[0] + y = c[1] + h = Math.sqrt(x*x + y*y) + desiredLabelRad = 220 + 'translate(' + (x/h * desiredLabelRad) + ',' + (y/h * desiredLabelRad) + ')' + ).transition() + .text (d) => + d.data.key + ' (' + parseFloat(100 * d.data.value / sum).toFixed(1) + '%)' + .style('font-size', '16px') + + + + + + + + diff --git a/package.json b/package.json index a154e500..a4da38aa 100644 --- a/package.json +++ b/package.json @@ -9,48 +9,48 @@ "url": "https://github.com/SOCR/SOCRAT.git" }, "dependencies": { - "angular": "^1.5.0", - "angular-animate": "^1.5.0", + "angular": "~1.5.0", + "angular-animate": "~1.5.0", "angular-bootstrap-switch": "^0.5.1", - "angular-cookies": "^1.5.0", - "angular-messages": "^1.5.0", - "angular-resource": "^1.5.0", - "angular-route": "^1.5.0", - "angular-sanitize": "^1.5.0", - "angular-touch": "^1.5.0", - "angular-ui-bootstrap": "^1.3.0", + "angular-cookies": "~1.5.0", + "angular-messages": "~1.5.0", + "angular-resource": "~1.5.0", + "angular-route": "~1.5.0", + "angular-sanitize": "~1.5.0", + "angular-touch": "~1.5.0", + "angular-ui-bootstrap": "~1.3.0", "angular-ui-router": "~0.2.18", - "bootstrap": "^3.3.6", + "bootstrap": "~3.3.6", "bootstrap-switch": "~3.0.2", - "bootstrap-tagsinput": "^0.7.1", - "browserify-versionify": "^1.0.6", - "compassql": "^0.6.7", - "connect": "^3.5.0", + "bootstrap-tagsinput": "~0.7.1", + "browserify-versionify": "~1.0.6", + "compassql": "~0.6.7", + "connect": "~3.5.0", "d3": "~3.5.15", - "data-wrangler": "^1.0.5", + "data-wrangler": "~1.0.5", "datalib": "1.7.2", - "datatables.net": "^1.10.12", - "datatables.net-dt": "^1.10.12", - "designmodo-flat-ui": "^2.3.0", - "flatui-radiocheck": "^0.1.2", - "handsontable": "^0.26.0", - "holderjs": "^2.9.3", - "jquery": "^2.1.0", + "datatables.net": "~1.10.12", + "datatables.net-dt": "~1.10.12", + "designmodo-flat-ui": "~2.3.0", + "flatui-radiocheck": "~0.1.2", + "handsontable": "~0.26.0", + "holderjs": "~2.9.3", + "jquery": "~2.1.0", "jquery-highlight": "~3.3.0", - "jquery-ui": "^1.12.0", + "jquery-ui": "~1.12.0", "jquery-ui-layout": "git+https://github.com/benosman/layout.git", "jsfeat": "~0.0.8", "jstat": "~1.5.2", - "jstransform": "^11.0.2", + "jstransform": "~11.0.2", "ng-handsontable": "git+https://github.com/handsontable/ngHandsontable.git", - "select2": "^4.0.3", - "serve-static": "^1.11.1", - "through": "^2.3.8", - "transform-loader": "^0.2.3", + "select2": "~4.0.3", + "serve-static": "~1.11.1", + "through": "~2.3.8", + "transform-loader": "~0.2.3", "typeahead.js": "git+https://github.com/twitter/typeahead.js.git", - "vega": "^2.6.3", - "vega-embed": "^2.2.0", - "vega-lite": "^1.3.1" + "vega": "~2.6.3", + "vega-embed": "~2.2.0", + "vega-lite": "~1.3.0" }, "devDependencies": { "angular-mocks": "^1.5.0",