Skip to content

Commit

Permalink
Revert "Visualize Refactor (elastic#11786)"
Browse files Browse the repository at this point in the history
This reverts commit 3000221.
  • Loading branch information
thomasneirynck committed Jul 7, 2017
1 parent 363a065 commit 1fd712f
Show file tree
Hide file tree
Showing 170 changed files with 2,992 additions and 2,826 deletions.
165 changes: 82 additions & 83 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 { VisFactoryProvider } from 'ui/vis/vis_factory';
import { VisSchemasProvider } from 'ui/vis/editors/default/schemas';
import { CATEGORY } from 'ui/vis/vis_category';
import { VisVisTypeProvider } from 'ui/vis/vis_type';
import { VislibVisTypeVislibVisTypeProvider } from 'ui/vislib_vis_type/vislib_vis_type';
import { VisSchemasProvider } from 'ui/vis/schemas';
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 VisFactory = Private(VisFactoryProvider);
const VisType = Private(VisVisTypeProvider);
const VislibVisType = Private(VislibVisTypeVislibVisTypeProvider);
const Schemas = Private(VisSchemasProvider);

return VisFactory.createVislibVisualization({
return new VislibVisType({
name: 'area',
title: 'Area',
image,
description: 'Emphasize the quantity beneath a line chart',
category: CATEGORY.BASIC,
visConfig: {
category: VisType.CATEGORY.BASIC,
params: {
defaults: {
type: 'area',
grid: {
categoryLines: false,
style: {
Expand All @@ -29,7 +29,8 @@ export default function PointSeriesVisType(Private) {
type: 'category',
position: 'bottom',
show: true,
style: {},
style: {
},
scale: {
type: 'linear'
},
Expand All @@ -47,7 +48,8 @@ export default function PointSeriesVisType(Private) {
type: 'value',
position: 'left',
show: true,
style: {},
style: {
},
scale: {
type: 'linear',
mode: 'normal'
Expand Down Expand Up @@ -82,34 +84,31 @@ export default function PointSeriesVisType(Private) {
times: [],
addTimeMarker: false,
},
},
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',
}],
},
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,
optionTabs: [
{
name: 'advanced',
Expand All @@ -119,50 +118,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 collections.gaugeTypes"
ng-options="mode for mode in vis.type.params.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 collections.colorSchemas"
ng-options="mode for mode in vis.type.params.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 collections.gaugeColorMode"
ng-options="mode for mode in vis.type.params.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 collections.colorSchemas"
ng-options="mode for mode in vis.type.params.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 collections.scales"
ng-options="mode for mode in vis.type.params.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,9 +9,6 @@ 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.editorConfig.collections.positions"
ng-options="mode for mode in vis.type.params.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.editorConfig.collections.chartTypes"
ng-options="mode.value as mode.text for mode in vis.type.params.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.editorConfig.collections.chartModes"
ng-options="mode for mode in vis.type.params.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.editorConfig.collections.interpolationModes"
ng-options="mode.value as mode.text for mode in vis.type.params.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.vis.type.type = types.length === 1 ? types[0] : 'histogram';
$scope.savedVis.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.editorConfig.collections.positions"
ng-options="mode disable when isPositionDisabled(mode) for mode in vis.type.params.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.editorConfig.collections.axisModes"
ng-options="mode for mode in vis.type.params.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.editorConfig.collections.scaleTypes"
ng-options="type for type in vis.type.params.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.editorConfig.collections.legendPositions"
ng-options="position.value as position.text for position in vis.type.params.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.visConfig.defaults,
params: lineVisType.params.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.editorConfig.collections.legendPositions"
ng-options="position.value as position.text for position in vis.type.params.legendPositions"
></select>
</div>
</div>
Expand Down
Loading

0 comments on commit 1fd712f

Please sign in to comment.