Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Example visualizations #11987

Closed
wants to merge 87 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
714fbd1
converting Vis to es6 class
ppisljar Mar 31, 2017
d089706
moving response converter and listener defaults to vis_type
ppisljar Mar 31, 2017
d1e8fca
move search from visualize app into visualize component
ppisljar Apr 3, 2017
442aea1
adding <visualization> component
ppisljar Apr 11, 2017
4eedee8
introducing request and response handlers
ppisljar Apr 11, 2017
c39cfc4
adding <visualization-editor> and moving it inside <visualize>
ppisljar Apr 13, 2017
ebd94c0
introducing editorType registry
ppisljar Apr 13, 2017
31ed168
changing vis_type definition (renaming)
ppisljar Apr 14, 2017
2b97505
removing renderbot and restructuring vis_types files
ppisljar Apr 14, 2017
a97edcf
rebasing on master
ppisljar May 9, 2017
5e86a52
removing unused stuff from Vis
ppisljar May 10, 2017
0bda18b
removing unused stuff from Vis
ppisljar May 10, 2017
2e08eb4
throwing some stuff around
ppisljar May 10, 2017
763a10e
updating vislib vis types
ppisljar May 10, 2017
0b2d4e6
moving api to Vis
ppisljar May 10, 2017
29e68be
cleanup bwc
ppisljar May 11, 2017
3c80c34
updating vis with state
ppisljar May 12, 2017
bf74ab4
updating editor
ppisljar May 12, 2017
f475cdd
introducing promises on vis types
ppisljar May 15, 2017
07d2cf5
updating most vis types to the new system
ppisljar May 15, 2017
a82c9f6
fixing issue with state type
ppisljar May 15, 2017
ebcbef8
template vis type should update vis on render
ppisljar May 15, 2017
fab9bf9
fixing visualizations without search
ppisljar May 15, 2017
8523da6
doing fetch even with none search handler
ppisljar May 15, 2017
bebd0dd
call destroy when unloading visualization
ppisljar May 15, 2017
9fe05d6
typo s/filter/filters
ppisljar May 15, 2017
a6cf0b5
fixing vis type render functions
ppisljar May 15, 2017
7a99b4a
adding timelion request handler and updating timelion
ppisljar May 15, 2017
4dba567
fixing typo s/Registy/Registry
ppisljar May 15, 2017
91d6138
updating discover page to use visualization
ppisljar May 15, 2017
3585de9
rename build_chart_data to basic
ppisljar May 15, 2017
03be399
renaming TemplateVisType to AngularVisType
ppisljar May 15, 2017
873eb2a
renaming VisType to VisTypeFactory
ppisljar May 15, 2017
7726186
move tilemap to its own plugin (in progress)
thomasneirynck May 16, 2017
815fb3d
move map files together
thomasneirynck May 16, 2017
3ecf80b
add editor to map (broken now)
thomasneirynck May 16, 2017
2657f2a
further changes to map-viz
thomasneirynck May 16, 2017
39ae81e
using visController instead of render function
ppisljar May 17, 2017
202c55b
using render event only (no watches on scope)
ppisljar May 17, 2017
c9fcece
editor should listen for render event as well
ppisljar May 17, 2017
2a91574
rebasing
ppisljar May 17, 2017
12f11c7
playing with editor ... broke it a bit i think
ppisljar May 17, 2017
56eaebb
visController and editorController should be objects with render, des…
ppisljar May 17, 2017
31b0a5c
move editor
thomasneirynck May 18, 2017
f090714
introducing vis_factory
ppisljar May 18, 2017
fe1587e
renaming editorController to editor
ppisljar May 18, 2017
85f23ad
renaming visController to visualization
ppisljar May 18, 2017
7c9c69a
visualization and editor should be classes instead of objects
ppisljar May 18, 2017
bf9635b
adding react vis type (needed for tsvb)
ppisljar May 18, 2017
23c90bf
implement maps as an example of 'base visualization type'
thomasneirynck May 18, 2017
277a39f
fiddle with moving schemas
thomasneirynck May 19, 2017
f287962
pass in raw DOM element, not jquery collection
thomasneirynck May 19, 2017
990a0cd
base type should know as little as possible about editor (and nothing…
ppisljar May 19, 2017
70db2f2
fixing vis API filter
ppisljar May 19, 2017
fde63e2
fixing styles for the editor
ppisljar May 19, 2017
aa3ba2e
fixing legend
ppisljar May 19, 2017
fe89eda
fixing spy
ppisljar May 19, 2017
1b7923b
fixing series.js accessing savedVis
ppisljar May 19, 2017
fbac178
fixing some issues
ppisljar May 22, 2017
2da49f1
adding resize call to visualization
ppisljar May 22, 2017
9555972
add ResizeChecker to visualize_editor
ppisljar May 22, 2017
b4f45ac
add resize method to all vis types
ppisljar May 22, 2017
9c0a038
adding tabify response handler and setting it as default
ppisljar May 22, 2017
7668217
moving renderCounter to <visualization>
ppisljar May 22, 2017
c986103
fixing default editor
ppisljar May 22, 2017
6dd1077
safeguards on angular vis type
ppisljar May 22, 2017
27cfe41
adding missing react factory call
ppisljar May 24, 2017
074ebdd
adding CATEGORY.HIDDEN
ppisljar May 24, 2017
a3f1be4
rename savedVis to savedObj
ppisljar May 24, 2017
8d3664d
fixing state monitor
ppisljar May 24, 2017
721d39f
fixing tagcloud and heatmap
ppisljar May 24, 2017
0c7aabb
fixing default editor
ppisljar May 24, 2017
117510f
fixing react_vis_type resize method to not fire if vis is not set
ppisljar May 25, 2017
496d3e8
fixing some bugs
ppisljar May 26, 2017
0b55fb1
dont add empty options tab
ppisljar May 26, 2017
f7888c5
add isEditorMode() to Vis object
ppisljar May 26, 2017
c4c4f2b
moving vis to constructor
ppisljar May 26, 2017
db6a252
make the render-method of editors and visualizations async
thomasneirynck May 27, 2017
a2e7af5
our types should not use async, but user is free to in his implementa…
ppisljar May 31, 2017
c9dd344
cleaning up timelion request handler
ppisljar May 31, 2017
da2bb34
converting tsvb - first step
ppisljar May 31, 2017
c84d1a1
converting tsvb - first step
ppisljar May 31, 2017
04bfb9c
adding update method to time filter
ppisljar Jun 1, 2017
812ae7b
add indexPatterns to API (#12122)
nreese Jun 1, 2017
9fe295e
adding indexPattern to the vis.API
ppisljar Jun 2, 2017
76b8436
add example visualizations
thomasneirynck May 24, 2017
b4fe208
rebase after changes
thomasneirynck Jun 2, 2017
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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
"brace": "0.5.1",
"bunyan": "1.7.1",
"check-hash": "1.0.1",
"circos": "2.0.3",
"color": "1.0.3",
"commander": "2.8.1",
"css-loader": "0.17.0",
Expand Down
9 changes: 9 additions & 0 deletions src/core_plugins/circos_vis/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default function (kibana) {
return new kibana.Plugin({
uiExports: {
visTypes: [
'plugins/circos_vis/circos_vis'
]
}
});
}
4 changes: 4 additions & 0 deletions src/core_plugins/circos_vis/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "circos_vis",
"version": "kibana"
}
76 changes: 76 additions & 0 deletions src/core_plugins/circos_vis/public/circos_vis.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import './circos_vis.less';
import './vis_options';
import { CATEGORY } from 'ui/vis/vis_category';
import { VisSchemasProvider } from 'ui/vis/editors/default/schemas';
import { VisFactoryProvider } from 'ui/vis/vis_factory';
import { VisTypesRegistryProvider } from 'ui/registry/vis_types';
import { CircosVisController } from './vis_controller';
import { CircosResponseHandlerProvider } from './response_handler';

function Test1Provider(Private) {
const VisFactory = Private(VisFactoryProvider);
const Schemas = Private(VisSchemasProvider);
const responseHandler = Private(CircosResponseHandlerProvider).handler;

// return the visType object, which kibana will use to display and configure new Vis object of this type.
return VisFactory.createBaseVisualization({
name: 'circos_vis',
title: 'Circos',
icon: 'fa fa-gear',
description: 'Circos visualization',
category: CATEGORY.OTHER,
visualization: CircosVisController,
visConfig: {
defaults: {
seriesParams: [],
layout: {
gap: 0,
showLabels: true,
}
},
},
editorConfig: {
collections: {
chartTypes: ['heatmap', 'histogram', 'line', 'scatter'],
colorSchemas: ['OrRd', 'GnBu', 'BuGn', 'YlGn'],
},
optionsTemplate: '<circos-vis-options></circos-vis-options>',
schemas: new Schemas([
{
group: 'metrics',
name: 'metric',
title: 'Y-Axis',
min: 1,
aggFilter: ['!geo_centroid'],
defaults: [
{ schema: 'metric', type: 'count' }
]
},
{
group: 'buckets',
name: 'segment',
title: 'X-Axis',
min: 0,
max: 1,
aggFilter: '!geohash_grid'
},
{
group: 'buckets',
name: 'split',
title: 'Split Circle',
min: 0,
max: 1,
aggFilter: '!geohash_grid'
}
])
},
requestHandler: 'courier',
responseHandler: responseHandler,
});
}

// register the provider with the visTypes registry
VisTypesRegistryProvider.register(Test1Provider);

// export the provider so that the visType can be required with Private()
export default Test1Provider;
5 changes: 5 additions & 0 deletions src/core_plugins/circos_vis/public/circos_vis.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@import (reference) "~ui/styles/mixins.less";

.circos_vis {
/* add your styles here */
}
58 changes: 58 additions & 0 deletions src/core_plugins/circos_vis/public/response_handler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import _ from 'lodash';
import { AggResponseIndexProvider } from 'ui/agg_response/index';

const CircosResponseHandlerProvider = function (Private) {
const aggResponse = Private(AggResponseIndexProvider);

return {
name: 'circos',
handler: function (vis, response) {
return new Promise((resolve) => {

const tableGroup = aggResponse.tabify(vis, response, {
canSplit: true,
asAggConfigResults: true
});

const layouts = [];
const series = [];

_.forIn(tableGroup.tables, (table, key) => {
if (!table.rows) table = table.tables[0];
layouts.push({
id: key,
label: table.$parent.key,
len: table.rows.length
});

const cnt = [];
table.rows.forEach(row => {
for (let serieCnt = 0; serieCnt < row.length - 1; serieCnt++) {
if (!series[serieCnt]) {
series[serieCnt] = [];
}
if (!cnt[serieCnt]) {
cnt[serieCnt] = 0;
}
const value = row[serieCnt + 1].value;
series[serieCnt].push({
block_id: key,
value: value,
start: cnt[serieCnt]++,
position: (cnt[serieCnt] + (cnt[serieCnt] - 1)) / 2,
end: cnt[serieCnt]
});
}
});
});

resolve({
layout: layouts,
series: series,
});
});
}
};
};

export { CircosResponseHandlerProvider };
68 changes: 68 additions & 0 deletions src/core_plugins/circos_vis/public/vis_controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import Circos from 'circos';

class CircosVisController {
constructor(el, vis) {
this.el = el;
this._vis = vis;
}

render(visData) {

this.visData = visData;
if (this.circos) {
this.destroy();
}


const width = this.el.offsetWidth;
const height = this.el.offsetHeight;
const radius = Math.min(width, height) / 20;

this.circos = new Circos({
container: this.el,
width: this.el.offsetWidth * 0.9,
height: this.el.offsetHeight * 0.9,
});

this.circos.layout(visData.layout, {
gap: this._vis.params.layout.gap,
innerRadius: radius,
outerRadius: radius,
labels: {
display: this._vis.params.layout.showLabels,
radialOffset: this._vis.params.layout.offsetLabels
},
ticks: { display: true, labels: false }
});

visData.series.forEach((serie, i) => {
const seriesParams = this._vis.params.seriesParams[i];
this.circos[seriesParams.type](`series-${i}`, serie, {
innerRadius: seriesParams.innerRadius,
outerRadius: seriesParams.outerRadius,
color: seriesParams.colorSchema,
tooltipContent: (datum) => {
return datum.value;
}
});
});

this.circos.render();


}

resize() {
if (!this.circos) return;
this.render(this.visData);
}

destroy() {
if (this.circos) {
this.el.innerHTML = '';
this.circos = null;
}
}
}

export { CircosVisController };
151 changes: 151 additions & 0 deletions src/core_plugins/circos_vis/public/vis_options.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
<div>
<div class="kuiSideBarSection kuiSideBarSection__main">
<div class="kuiSideBarSectionTitle">
<div class="kuiSideBarSectionTitle__text">
Metrics
</div>
</div>

<div
ng-repeat="chart in vis.params.seriesParams track by $index"
class="kuiSideBarSection"
>
<div class="kuiSideBarCollapsibleTitle">
<div
ng-init="isSeriesOpen = ($index === 0)"
class="kuiSideBarCollapsibleTitle__label"
ng-click="isSeriesOpen = !isSeriesOpen"
kbn-accessible-click
>
<span
aria-hidden="true"
ng-class="{ 'fa-caret-down': isSeriesOpen, 'fa-caret-right': !isSeriesOpen }"
class="kuiIcon fa-caret-right kuiSideBarCollapsibleTitle__caret"
></span>
<span class="kuiSideBarCollapsibleTitle__text">
{{chart.label}}
</span>
</div>
</div>

<div ng-show="isSeriesOpen" class="kuiSideBarCollapsibleSection">
<!-- General -->
<div class="kuiSideBarSection">

<div class="kuiSideBarFormRow">
<label class="kuiSideBarFormRow__label" for="{{ 'seriesType' + $index }}">
Chart Type
</label>
<div class="kuiSideBarFormRow__control">
<select
id="{{ 'seriesType' + $index }}"
class="kuiSelect kuiSideBarSelect"
ng-model="chart.type"
ng-options="mode for mode in vis.type.editorConfig.collections.chartTypes"
></select>
</div>
</div>

<div class="kuiSideBarFormRow">
<label class="kuiSideBarFormRow__label" for="{{ 'innerRadius' + $index }}">
Inner Radius
</label>
<div class="kuiSideBarFormRow__control">
<input
id="{{ 'innerRadius' + $index }}"
class="kuiSideBarInput"
ng-model="chart.innerRadius"
type="number"
min="1"
max="10"
>
</div>
</div>

<div class="kuiSideBarFormRow">
<label class="kuiSideBarFormRow__label" for="{{ 'outerRadius' + $index }}">
Outer Radius
</label>
<div class="kuiSideBarFormRow__control">
<input
id="{{ 'outerRadius' + $index }}"
class="kuiSideBarInput"
ng-model="chart.outerRadius"
type="number"
min="1"
max="10"
>
</div>
</div>

<div class="kuiSideBarFormRow">
<label class="kuiSideBarFormRow__label" for="colorSchema">
Color Schema
</label>
<div class="kuiSideBarFormRow__control">
<select
id="colorSchema"
class="kuiSelect kuiSideBarSelect"
ng-model="chart.colorSchema"
ng-options="color for color in vis.type.editorConfig.collections.colorSchemas"
></select>
</div>
</div>
</div>
</div>
</div>

<div style="height: 10px"></div>
</div>
<div class="kuiSideBarSection kuiSideBarSection__main">
<div class="kuiSideBarSectionTitle">
<div class="kuiSideBarSectionTitle__text">
Style
</div>
</div>

<div class="kuiSideBarFormRow">
<label class="kuiSideBarFormRow__label" for="circleGap">
Gap
</label>
<div class="kuiSideBarFormRow__control">
<input
id="circleGap"
class="kuiSideBarInput"
ng-model="vis.params.layout.gap"
type="number"
step="0.01"
min="0"
max="1"
>
</div>
</div>

<div class="kuiSideBarFormRow">
<label class="kuiSideBarFormRow__label" for="showLabels">
Show Labels
</label>
<div class="kuiSideBarFormRow__control">
<input class="kuiCheckBox" id="showLabels" type="checkbox" ng-model="vis.params.layout.showLabels">
</div>
</div>

<div class="kuiSideBarFormRow">
<label class="kuiSideBarFormRow__label" for="offsetLabels">
Offset Labels
</label>
<div class="kuiSideBarFormRow__control">
<input
id="offsetLabels"
class="kuiSideBarInput"
ng-model="vis.params.layout.offsetLabels"
type="number"
step="5"
min="0"
max="200"
>
</div>
</div>

</div>
</div>
Loading