diff --git a/StatisticalPlatform/StatisticalPlatform/client/components/Dashboard/NavBar/Clustering/DensityClusterModal.js b/StatisticalPlatform/StatisticalPlatform/client/components/Dashboard/NavBar/Clustering/DensityClusterModal.js new file mode 100644 index 0000000..acda824 --- /dev/null +++ b/StatisticalPlatform/StatisticalPlatform/client/components/Dashboard/NavBar/Clustering/DensityClusterModal.js @@ -0,0 +1,109 @@ +import React, {Component} from 'react'; +import {Button, Modal, Checkbox, FormGroup, ControlLabel, FormControl, FieldGroup} from 'react-bootstrap'; +import NumericInput from 'react-numeric-input'; + +class DensityClusterModal extends Component { + constructor(props) { + super(props); + this.state = { + showResults: false, + show: false + }; + } + + handleClose = () => { + this.setState({ show: false }); + } + + onClick = () => { + this.setState({ showResults: true }); + } + + handleClick = () => { + this.props.onClose({showDensityCluster: false}); + this.props.onClick( + this, + this.first.value, + this.second.value, + this.minpts.value, + this.eps.value + ); + } + + + render() { + + const options_list = []; + let inst = null; + const bold_style = {'fontSize': '15', 'fontWeight': 'bold'}; + + if (!this.state.showResults) { + inst = + } + else { + inst =

Description:

; + } + + this.props.variables.forEach( (variable) => { + options_list.push(); + }); + + return( +
+ + + Choose Data + + + +
+ + Variable - X + { this.first = ref; }}> + {options_list} + +
+ Variable - Y + { this.second = ref; }}> + {options_list} + +
+ Minimum Points + this.minpts = ref } /> + Epsilon + this.eps = ref } /> +
+
+ {inst} + { this.state.showResults ? : null } +
+ + + + +
+ ); + } +} + + +class DensityClusteringInstruction extends Component { + render() { + const style = {'fontFamily': 'DROID SANS MONO'}; + return( +
+

{'Select two columns and value i.e. number of clusters.'}

+ + + + + + + +
{'library(ggplot2)'}
{'ggplot(data, aes(var_x, var_y, color = Species)) + geom_point()'}
+
+ ); + } +} + +export default DensityClusterModal; diff --git a/StatisticalPlatform/StatisticalPlatform/client/components/Dashboard/NavBar/MyBar.js b/StatisticalPlatform/StatisticalPlatform/client/components/Dashboard/NavBar/MyBar.js index e8e4171..d8cc1eb 100644 --- a/StatisticalPlatform/StatisticalPlatform/client/components/Dashboard/NavBar/MyBar.js +++ b/StatisticalPlatform/StatisticalPlatform/client/components/Dashboard/NavBar/MyBar.js @@ -18,6 +18,7 @@ import ComatrixModal from './Analyze/ComatrixModal' import TimeSeriesModal from './Analyze/TimeSeriesModal'; import KMeansModal from './Clustering/KMeansModal'; import DendogramModal from './Clustering/DendogramModal'; +import DensityClusterModal from './Clustering/DensityClusterModal'; import ClassifyModal from './Classification/ClassifyModal'; import DashboardModal from './Dashboard/DashboardModal'; import FileField from './File/FileField'; @@ -183,6 +184,12 @@ class MyBar extends Component { this.props.onClick("show-table"); } + plotDensityCluster = (plotType, child, var_x, var_y, minpts, eps) => { + this.props.onClick("show-table"); + this.props.onClick("densitybasedclustering", plotType, child, var_x, var_y, minpts, eps); + this.props.onClick("show-table"); + } + closeModal = (obj) => { this.setState(obj) } @@ -414,6 +421,17 @@ class MyBar extends Component { onClick={this.plotD3Chart.bind(this, "plotDendogram")} variables={this.props.variables ? this.props.variables : ['Car','Car2', 'Car3']} /> + + this.setState({showDensityCluster: true})}>Density Based + + this.closeModal(val)} + onClick={this.plotDensityCluster.bind(this, "plotDensityBasedClustering")} + variables={this.props.variables ? this.props.variables : ['Car','Car2', 'Car3']} /> + diff --git a/StatisticalPlatform/StatisticalPlatform/client/components/Dashboard/WholeThing.js b/StatisticalPlatform/StatisticalPlatform/client/components/Dashboard/WholeThing.js index 81670ec..9a9dc2d 100644 --- a/StatisticalPlatform/StatisticalPlatform/client/components/Dashboard/WholeThing.js +++ b/StatisticalPlatform/StatisticalPlatform/client/components/Dashboard/WholeThing.js @@ -442,6 +442,16 @@ handleClick (buttonType, functionName, propertyName, plotType) { this.setState({plot_type: plot_type, var_x: var_x}); break; + case "densitybasedclustering": + plot_type = arguments[1]; + var_x = arguments[3]; + var_y = arguments[4]; + let minpts = arguments[5]; + let eps = arguments[6]; + this.setState({multi: false, plot: true}); + this.setState({plot_type: plot_type, var_x: var_x, var_y: var_y, minpts: minpts, eps: eps}); + break; + /* * Display descriptive stats table */ diff --git a/StatisticalPlatform/StatisticalPlatform/static/css/login.css b/StatisticalPlatform/StatisticalPlatform/static/css/login.css index 6bc9eaf..70289b0 100644 --- a/StatisticalPlatform/StatisticalPlatform/static/css/login.css +++ b/StatisticalPlatform/StatisticalPlatform/static/css/login.css @@ -76,3 +76,7 @@ .MainPage{ color: #f40035; } + +#plotdiv { + height: 400px; +} diff --git a/StatisticalPlatform/StatisticalPlatform/static/js/nvd3_plots.js b/StatisticalPlatform/StatisticalPlatform/static/js/nvd3_plots.js index 8d0277d..65719ac 100755 --- a/StatisticalPlatform/StatisticalPlatform/static/js/nvd3_plots.js +++ b/StatisticalPlatform/StatisticalPlatform/static/js/nvd3_plots.js @@ -124,6 +124,34 @@ function makePlot(obj, state) { }); } + if (type==="plotDensityBasedClustering") { + var var_x = state.var_x; + var var_y = state.var_y; + var minpts = state.minpts; + var eps = state.eps; + ocpu.seturl("http://localhost:5656/ocpu/apps/tejasavkhattar/testpackage/R"); + + var data = dataJSON, plotData = {}; + + plotData.var_x = var_x; + plotData.var_y = var_y; + plotData.minpts = minpts; + plotData.eps = eps; + + var req = $("#plotdiv").rplot("densitybasedclustering", { + data : data, + var_x : var_x, + var_y : var_y, + eps : eps, + MinPts : minpts + + }) +//optional: add custom callbacks + req.fail(function(){ + alert("R returned an error: " + req.responseText); + }); + } + if (type === "plotKMeans") { var var_x = state.var_x, var_y = state.var_y, kvalue = state.kvalue; diff --git a/StatisticalPlatform/webpack-stats.json b/StatisticalPlatform/webpack-stats.json index 7dcc0d9..44e97cb 100644 --- a/StatisticalPlatform/webpack-stats.json +++ b/StatisticalPlatform/webpack-stats.json @@ -1 +1 @@ -{"status":"done","publicPath":"http://localhost:3000/assets/bundles/","chunks":{"main":[{"name":"main-3accb65f3987805f6c75.js","publicPath":"http://localhost:3000/assets/bundles/main-3accb65f3987805f6c75.js","path":"/home/tejasav/Desktop/StatisticalPlatform/StatisticalPlatform/StatisticalPlatform/static/js/bundle/main-3accb65f3987805f6c75.js"}]}} \ No newline at end of file +{"status":"done","publicPath":"http://localhost:3000/assets/bundles/","chunks":{"main":[{"name":"main-03019aa429c716151a74.js","publicPath":"http://localhost:3000/assets/bundles/main-03019aa429c716151a74.js","path":"/home/tejasav/Desktop/StatisticalPlatform/StatisticalPlatform/StatisticalPlatform/static/js/bundle/main-03019aa429c716151a74.js"},{"name":"main.ab1cbde6ee011df9e83a.hot-update.js","publicPath":"http://localhost:3000/assets/bundles/main.ab1cbde6ee011df9e83a.hot-update.js","path":"/home/tejasav/Desktop/StatisticalPlatform/StatisticalPlatform/StatisticalPlatform/static/js/bundle/main.ab1cbde6ee011df9e83a.hot-update.js"}]}} \ No newline at end of file