Skip to content

Commit

Permalink
Visualize Refactor (elastic#11786)
Browse files Browse the repository at this point in the history
* converting Vis to es6 class

* <visualize>, <visualization> and <visualization-editor>

* editor, responseHandler and requestHandler registries

* updating visualize editor app

* vis, default editor, request handlers and vis types

* updating vis types

* updating kibana to work with new visualize

* migrating existing visualizations

* fixing bugs with rebase

fixing tests

fixing tsvb auto apply button

fix tsvb resizing issue

update scope.$apply for react editor components

re-render react component when vis.params are updated (elastic#12347)

fixing heatmap

remove obsolete maps_renderbot indirection

remove cruft/ remove custom resizing and hook into global event

fixing brush event

fixing resize event for vislib_vis_type

fixing legend

changing based on nathans review

* fixing tests

* fixing renderComplete issues with editor

* map updates

* fixing maps zoom

* fixing based on nathans review

* fixing render complete issue and doulbe rendering with maps

* trying to get maps in order .... wip

* removing resize method from visualizations

* changing the rendering process a bit

* fixing metric chart type auto changing

* minor simplifications in coordinate map viz

* more simplications now we only have single render

* minor fixes

* do not recreate layer when not necessary

* minor changes

* fixing maps bounding box filter

* fixing desaturation option

* fix zoom settings when toggling between WMS/basemap

* adding status to the render method (to figure out what changed)

* fixing legend open icon going out of page

* skip index selection for timelion

* timelion brush fix

* fixing circular json issue

* fix faulty rebase

* fixing updateStatus

* removing timelion requesthandler registration

* removing double slash

* fixing maps

* add debug statement

* test CI with guard statement

* fixing rebase
  • Loading branch information
ppisljar authored Jul 7, 2017
1 parent 5a20d44 commit 3000221
Show file tree
Hide file tree
Showing 170 changed files with 2,826 additions and 2,992 deletions.
165 changes: 83 additions & 82 deletions src/core_plugins/kbn_vislib_vis_types/public/area.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import { VisVisTypeProvider } from 'ui/vis/vis_type';
import { VislibVisTypeVislibVisTypeProvider } from 'ui/vislib_vis_type/vislib_vis_type';
import { VisSchemasProvider } from 'ui/vis/schemas';
import { VisFactoryProvider } from 'ui/vis/vis_factory';
import { VisSchemasProvider } from 'ui/vis/editors/default/schemas';
import { CATEGORY } from 'ui/vis/vis_category';
import pointSeriesTemplate from 'plugins/kbn_vislib_vis_types/editors/point_series.html';
import image from './images/icon-area.svg';

export default function PointSeriesVisType(Private) {
const VisType = Private(VisVisTypeProvider);
const VislibVisType = Private(VislibVisTypeVislibVisTypeProvider);
const VisFactory = Private(VisFactoryProvider);
const Schemas = Private(VisSchemasProvider);

return new VislibVisType({
return VisFactory.createVislibVisualization({
name: 'area',
title: 'Area',
image,
description: 'Emphasize the quantity beneath a line chart',
category: VisType.CATEGORY.BASIC,
params: {
category: CATEGORY.BASIC,
visConfig: {
defaults: {
type: 'area',
grid: {
categoryLines: false,
style: {
Expand All @@ -29,8 +29,7 @@ export default function PointSeriesVisType(Private) {
type: 'category',
position: 'bottom',
show: true,
style: {
},
style: {},
scale: {
type: 'linear'
},
Expand All @@ -48,8 +47,7 @@ export default function PointSeriesVisType(Private) {
type: 'value',
position: 'left',
show: true,
style: {
},
style: {},
scale: {
type: 'linear',
mode: 'normal'
Expand Down Expand Up @@ -84,31 +82,34 @@ export default function PointSeriesVisType(Private) {
times: [],
addTimeMarker: false,
},
positions: ['top', 'left', 'right', 'bottom'],
chartTypes: [{
value: 'line',
text: 'line'
}, {
value: 'area',
text: 'area'
}, {
value: 'histogram',
text: 'bar'
}],
axisModes: ['normal', 'percentage', 'wiggle', 'silhouette'],
scaleTypes: ['linear', 'log', 'square root'],
chartModes: ['normal', 'stacked'],
interpolationModes: [{
value: 'linear',
text: 'straight',
}, {
value: 'cardinal',
text: 'smoothed',
}, {
value: 'step-after',
text: 'stepped',
}],
editor: pointSeriesTemplate,
},
editorConfig: {
collections: {
positions: ['top', 'left', 'right', 'bottom'],
chartTypes: [{
value: 'line',
text: 'line'
}, {
value: 'area',
text: 'area'
}, {
value: 'histogram',
text: 'bar'
}],
axisModes: ['normal', 'percentage', 'wiggle', 'silhouette'],
scaleTypes: ['linear', 'log', 'square root'],
chartModes: ['normal', 'stacked'],
interpolationModes: [{
value: 'linear',
text: 'straight',
}, {
value: 'cardinal',
text: 'smoothed',
}, {
value: 'step-after',
text: 'stepped',
}],
},
optionTabs: [
{
name: 'advanced',
Expand All @@ -118,50 +119,50 @@ export default function PointSeriesVisType(Private) {
},
{ name: 'options', title: 'Panel Settings', editor: pointSeriesTemplate },
],
},
schemas: new Schemas([
{
group: 'metrics',
name: 'metric',
title: 'Y-Axis',
aggFilter: ['!geo_centroid'],
min: 1,
defaults: [
{ schema: 'metric', type: 'count' }
]
},
{
group: 'metrics',
name: 'radius',
title: 'Dot Size',
min: 0,
max: 1,
aggFilter: ['count', 'avg', 'sum', 'min', 'max', 'cardinality']
},
{
group: 'buckets',
name: 'segment',
title: 'X-Axis',
min: 0,
max: 1,
aggFilter: '!geohash_grid'
},
{
group: 'buckets',
name: 'group',
title: 'Split Series',
min: 0,
max: 1,
aggFilter: '!geohash_grid'
},
{
group: 'buckets',
name: 'split',
title: 'Split Chart',
min: 0,
max: 1,
aggFilter: '!geohash_grid'
}
])
schemas: new Schemas([
{
group: 'metrics',
name: 'metric',
title: 'Y-Axis',
aggFilter: ['!geo_centroid'],
min: 1,
defaults: [
{ schema: 'metric', type: 'count' }
]
},
{
group: 'metrics',
name: 'radius',
title: 'Dot Size',
min: 0,
max: 1,
aggFilter: ['count', 'avg', 'sum', 'min', 'max', 'cardinality']
},
{
group: 'buckets',
name: 'segment',
title: 'X-Axis',
min: 0,
max: 1,
aggFilter: '!geohash_grid'
},
{
group: 'buckets',
name: 'group',
title: 'Split Series',
min: 0,
max: 1,
aggFilter: '!geohash_grid'
},
{
group: 'buckets',
name: 'split',
title: 'Split Chart',
min: 0,
max: 1,
aggFilter: '!geohash_grid'
}
])
}
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
id="gaugeType"
class="kuiSelect kuiSideBarSelect"
ng-model="vis.params.gauge.gaugeType"
ng-options="mode for mode in vis.type.params.gaugeTypes"
ng-options="mode for mode in collections.gaugeTypes"
></select>
</div>
</div>
Expand Down Expand Up @@ -183,7 +183,7 @@
id="colorSchema"
class="kuiSelect kuiSideBarSelect"
ng-model="vis.params.gauge.colorSchema"
ng-options="mode for mode in vis.type.params.colorSchemas"
ng-options="mode for mode in collections.colorSchemas"
></select>
</div>
<div class="text-info text-center" ng-show="customColors" ng-click="resetColors()">reset colors</div>
Expand Down Expand Up @@ -255,7 +255,7 @@
id="gaugeColorMode"
class="kuiSelect kuiSideBarSelect"
ng-model="vis.params.gauge.gaugeColorMode"
ng-options="mode for mode in vis.type.params.gaugeColorMode"
ng-options="mode for mode in collections.gaugeColorMode"
></select>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.directive('gaugeOptions', function () {
template: gaugeOptionsTemplate,
replace: true,
link: function ($scope) {

$scope.collections = $scope.vis.type.editorConfig.collections;
$scope.showColorRange = true;

$scope.$watch('vis.params.gauge.gaugeType', type => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
id="colorSchema"
class="kuiSelect kuiSideBarSelect"
ng-model="vis.params.colorSchema"
ng-options="mode for mode in vis.type.params.colorSchemas"
ng-options="mode for mode in collections.colorSchemas"
></select>
</div>
<div
Expand Down Expand Up @@ -39,7 +39,7 @@
id="axisScale"
class="kuiSelect kuiSideBarSelect"
ng-model="vis.params.valueAxes[0].scale.type"
ng-options="mode for mode in vis.type.params.scales"
ng-options="mode for mode in collections.scales"
></select>
</div>
</div>
Expand Down Expand Up @@ -141,15 +141,15 @@
ng-click="removeRange($index)"
class="kuiButton kuiButton--danger kuiButton--small"
>
<span class="kuiIcon fa-times"><span>
<span class="kuiIcon fa-times"></span>
</button>
</td>
</tr>
</table>

<div class="hintbox" ng-show="!vis.params.colorsRange.length">
<p>
<span class="kuiIcon fa-danger text-danger"><span>
<span class="kuiIcon fa-danger text-danger"></span>
<strong>Required:</strong> You must specify at least one range.
</p>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ module.directive('heatmapOptions', function () {
template: heatmapOptionsTemplate,
replace: true,
link: function ($scope) {

$scope.collections = $scope.vis.type.editorConfig.collections;

const verticalRotation = 270;
$scope.showColorRange = false;
$scope.showLabels = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
id="categoryAxisPosition"
class="kuiSelect kuiSideBarSelect"
ng-model="vis.params.categoryAxes[0].position"
ng-options="mode for mode in vis.type.params.positions"
ng-options="mode for mode in vis.type.editorConfig.collections.positions"
></select>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
id="{{ 'seriesType' + $index }}"
class="kuiSelect kuiSideBarSelect"
ng-model="chart.type"
ng-options="mode.value as mode.text for mode in vis.type.params.chartTypes"
ng-options="mode.value as mode.text for mode in vis.type.editorConfig.collections.chartTypes"
></select>
</div>
</div>
Expand All @@ -54,7 +54,7 @@
id="{{ 'seriesMode' + $index }}"
class="kuiSelect kuiSideBarSelect"
ng-model="chart.mode"
ng-options="mode for mode in vis.type.params.chartModes"
ng-options="mode for mode in vis.type.editorConfig.collections.chartModes"
></select>
</div>
</div>
Expand Down Expand Up @@ -86,7 +86,7 @@
id="{{ 'lineMode' + $index }}"
class="kuiSelect kuiSideBarSelect"
ng-model="chart.interpolate"
ng-options="mode.value as mode.text for mode in vis.type.params.interpolationModes"
ng-options="mode.value as mode.text for mode in vis.type.editorConfig.collections.interpolationModes"
>
</select>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ module.directive('vislibSeries', function () {
return $scope.vis.params.seriesParams.map(series => series.type).join();
}, () => {
const types = _.uniq(_.map($scope.vis.params.seriesParams, 'type'));
$scope.savedVis.type = types.length === 1 ? types[0] : 'histogram';
$scope.vis.type.type = types.length === 1 ? types[0] : 'histogram';
});

$scope.$watch('vis.params.valueAxes.length', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
class="kuiSelect kuiSideBarSelect"
ng-change="updateAxisName(axis)"
ng-model="axis.position"
ng-options="mode disable when isPositionDisabled(mode) for mode in vis.type.params.positions"
ng-options="mode disable when isPositionDisabled(mode) for mode in vis.type.editorConfig.collections.positions"
></select>
</div>
</div>
Expand All @@ -98,7 +98,7 @@
id="{{ 'valueAxisMode' + $index }}"
class="kuiSelect kuiSideBarSelect"
ng-model="axis.scale.mode"
ng-options="mode for mode in vis.type.params.axisModes"
ng-options="mode for mode in vis.type.editorConfig.collections.axisModes"
></select>
</div>
</div>
Expand All @@ -112,7 +112,7 @@
id="{{ 'valueAxisScaleType' + $index }}"
class="kuiSelect kuiSideBarSelect"
ng-model="axis.scale.type"
ng-options="type for type in vis.type.params.scaleTypes"
ng-options="type for type in vis.type.editorConfig.collections.scaleTypes"
></select>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<select
class="form-control"
ng-model="vis.params.legendPosition"
ng-options="position.value as position.text for position in vis.type.params.legendPositions"
ng-options="position.value as position.text for position in vis.type.editorConfig.collections.legendPositions"
>
</select>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('point series editor', function () {
function makeConfig() {
return {
type: 'line',
params: lineVisType.params.defaults,
params: lineVisType.visConfig.defaults,
aggs: [
{ type: 'count', schema: 'metric', params: { field: 'bytes' } },
{ type: 'terms', schema: 'segment', params: { field: 'machine.os' } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
id="legendPosition"
class="kuiSelect kuiSideBarSelect"
ng-model="vis.params.legendPosition"
ng-options="position.value as position.text for position in vis.type.params.legendPositions"
ng-options="position.value as position.text for position in vis.type.editorConfig.collections.legendPositions"
></select>
</div>
</div>
Expand Down
Loading

0 comments on commit 3000221

Please sign in to comment.