Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
26 changes: 24 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"version": "kibana"
},
"authors": [
"David Moreno Lumbreras <dmorenolumb@gmail.com>"
"David Moreno Lumbreras <dmorenolumb@gmail.com>"
],
"license": "Apache-2.0",
"repository": {
Expand All @@ -15,6 +15,28 @@
"dependencies": {
"plotly.js": "1.29.3",
"randomcolor": "0.5.0"

},
"scripts": {
"lint": "eslint **/*.js",
"start": "plugin-helpers start",
"test:server": "plugin-helpers test:server",
"test:browser": "plugin-helpers test:browser",
"build": "plugin-helpers build",
"postinstall": "plugin-helpers postinstall",
"gather-info": "node gather-info.js"
},
"devDependencies": {
"@elastic/eslint-config-kibana": "^0.14.0",
"@elastic/eslint-import-resolver-kibana": "^0.9.0",
"@elastic/plugin-helpers": "^7.1.3",
"babel-eslint": "^8.0.2",
"eslint": "^4.11.0",
"eslint-plugin-babel": "^4.1.1",
"eslint-plugin-import": "^2.3.0",
"eslint-plugin-jest": "^21.3.2",
"eslint-plugin-mocha": "^4.9.0",
"eslint-plugin-prefer-object-spread": "^1.2.1",
"eslint-plugin-react": "^7.0.1",
"expect.js": "^0.3.1"
}
}
29 changes: 27 additions & 2 deletions public/kbn_dotplot_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ module.controller('KbnDotplotVisController', function ($scope, $element, Private
var step = max - min
var chartDiff = chartMax - chartMin
}
console.log(resp)
//console.log(resp)
var dataParsed = resp.tables[0].rows.map(function(bucket) {

//If two buckets selected
Expand Down Expand Up @@ -155,7 +155,32 @@ module.controller('KbnDotplotVisController', function ($scope, $element, Private
data = data.concat(dataParsed[i])
}

Plotly.newPlot('dotplot-graph', data, layout, {showLink: false})
var dotplot = document.getElementById('dotplot-graph');

Plotly.newPlot('dotplot-graph', data, layout, {showLink: false});

dotplot.on('plotly_click', function(data){
var name='';
for(var i=0; i < data.points.length; i++){
name = data.points[i].data.name;
};

if (name != null && name.length > 0) {
var fieldAggName = $scope.vis.aggs.bySchemaName['field'][0].params.field.displayName;
if($scope.vis.aggs.bySchemaName['field'][1]){
fieldAggName = $scope.vis.aggs.bySchemaName['field'][1].params.field.displayName;
}
var match = {};
match[fieldAggName] = { "query": name, "type": "phrase" };
var filters = [
{
"query": { "match": match },
meta: { index: $scope.vis.indexPattern.id, negate: false, disabled: false }
}
];
$scope.vis.API.queryFilter.addFilters(filters);
}
})
}

});
Expand Down