mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
De-angularize vis tooltips (#54954)
* Remove angular dependencey from vis/tooltip * Move tooltip logic into vislib * Remove and fix all ngMock refs in vislib tests * Add numeral to renovate config * Add vis_type_vislib to codeowners * Move vis_legend into vislib and fix errors * vis_type_vislib/public imports to be only top-level
This commit is contained in:
parent
b0af1bf95c
commit
ce2930ec51
124 changed files with 1402 additions and 1694 deletions
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
|
@ -15,6 +15,7 @@
|
|||
/src/legacy/core_plugins/kibana/public/home/ @elastic/kibana-app
|
||||
/src/legacy/core_plugins/kibana/public/dev_tools/ @elastic/kibana-app
|
||||
/src/legacy/core_plugins/metrics/ @elastic/kibana-app
|
||||
/src/legacy/core_plugins/vis_type_vislib/ @elastic/kibana-app
|
||||
/src/plugins/home/ @elastic/kibana-app
|
||||
/src/plugins/kibana_legacy/ @elastic/kibana-app
|
||||
/src/plugins/timelion/ @elastic/kibana-app
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
"interpreter": "src/legacy/core_plugins/interpreter",
|
||||
"kbn": "src/legacy/core_plugins/kibana",
|
||||
"kbnDocViews": "src/legacy/core_plugins/kbn_doc_views",
|
||||
"kbnVislibVisTypes": "src/legacy/core_plugins/vis_type_vislib",
|
||||
"management": ["src/legacy/core_plugins/management", "src/plugins/management"],
|
||||
"kibana_react": "src/legacy/core_plugins/kibana_react",
|
||||
"kibana-react": "src/plugins/kibana_react",
|
||||
|
@ -41,6 +40,7 @@
|
|||
"visTypeTagCloud": "src/legacy/core_plugins/vis_type_tagcloud",
|
||||
"visTypeTimeseries": "src/legacy/core_plugins/vis_type_timeseries",
|
||||
"visTypeVega": "src/legacy/core_plugins/vis_type_vega",
|
||||
"visTypeVislib": "src/legacy/core_plugins/vis_type_vislib",
|
||||
"visualizations": [
|
||||
"src/plugins/visualizations",
|
||||
"src/legacy/core_plugins/visualizations"
|
||||
|
@ -50,4 +50,4 @@
|
|||
"src/legacy/ui/ui_render/ui_render_mixin.js"
|
||||
],
|
||||
"translations": []
|
||||
}
|
||||
}
|
||||
|
|
|
@ -347,6 +347,7 @@
|
|||
"@types/moment-timezone": "^0.5.12",
|
||||
"@types/mustache": "^0.8.31",
|
||||
"@types/node": "^10.12.27",
|
||||
"@types/numeral": "^0.0.26",
|
||||
"@types/opn": "^5.1.0",
|
||||
"@types/pegjs": "^0.10.1",
|
||||
"@types/pngjs": "^3.3.2",
|
||||
|
|
|
@ -657,6 +657,14 @@
|
|||
'@types/nodemailer',
|
||||
],
|
||||
},
|
||||
{
|
||||
groupSlug: 'numeral',
|
||||
groupName: 'numeral related packages',
|
||||
packageNames: [
|
||||
'numeral',
|
||||
'@types/numeral',
|
||||
],
|
||||
},
|
||||
{
|
||||
groupSlug: 'object-hash',
|
||||
groupName: 'object-hash related packages',
|
||||
|
|
|
@ -24,11 +24,7 @@ import { FormattedMessage } from '@kbn/i18n/react';
|
|||
|
||||
import { FileLayerField, VectorLayer, ServiceSettings } from 'ui/vis/map/service_settings';
|
||||
import { VisOptionsProps } from 'ui/vis/editors/default';
|
||||
import {
|
||||
NumberInputOption,
|
||||
SelectOption,
|
||||
SwitchOption,
|
||||
} from '../../../vis_type_vislib/public/components';
|
||||
import { NumberInputOption, SelectOption, SwitchOption } from '../../../vis_type_vislib/public';
|
||||
import { WmsOptions } from '../../../tile_map/public/components/wms_options';
|
||||
import { RegionMapVisParams } from '../types';
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ import {
|
|||
RangeOption,
|
||||
SelectOption,
|
||||
SwitchOption,
|
||||
} from '../../../vis_type_vislib/public/components';
|
||||
} from '../../../vis_type_vislib/public';
|
||||
import { WmsOptions } from './wms_options';
|
||||
import { TileMapVisParams } from '../types';
|
||||
import { MapTypes } from '../map_types';
|
||||
|
|
|
@ -21,7 +21,7 @@ import React from 'react';
|
|||
import { EuiLink, EuiSpacer, EuiText, EuiScreenReaderOnly } from '@elastic/eui';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
|
||||
import { TextInputOption } from '../../../vis_type_vislib/public/components';
|
||||
import { TextInputOption } from '../../../vis_type_vislib/public';
|
||||
import { WMSOptions } from '../types';
|
||||
|
||||
interface WmsInternalOptions {
|
||||
|
|
|
@ -25,7 +25,7 @@ import { FormattedMessage } from '@kbn/i18n/react';
|
|||
import { TmsLayer } from 'ui/vis/map/service_settings';
|
||||
import { Vis } from 'ui/vis';
|
||||
import { RegionMapVisParams } from '../../../region_map/public/types';
|
||||
import { SelectOption, SwitchOption } from '../../../vis_type_vislib/public/components';
|
||||
import { SelectOption, SwitchOption } from '../../../vis_type_vislib/public';
|
||||
import { WmsInternalOptions } from './wms_internal_options';
|
||||
import { WMSOptions, TileMapVisParams } from '../types';
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import { EuiPanel } from '@elastic/eui';
|
|||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
import { VisOptionsProps } from 'ui/vis/editors/default';
|
||||
import { RangeOption, SwitchOption } from '../../vis_type_vislib/public/components';
|
||||
import { RangeOption, SwitchOption } from '../../vis_type_vislib/public';
|
||||
import { MarkdownVisParams } from './types';
|
||||
|
||||
function SettingsOptions({ stateParams, setValue }: VisOptionsProps<MarkdownVisParams>) {
|
||||
|
|
|
@ -31,13 +31,13 @@ import { FormattedMessage } from '@kbn/i18n/react';
|
|||
|
||||
import { VisOptionsProps } from '../legacy_imports';
|
||||
import {
|
||||
ColorModes,
|
||||
ColorRanges,
|
||||
ColorSchemaOptions,
|
||||
SwitchOption,
|
||||
RangeOption,
|
||||
SetColorSchemaOptionsValue,
|
||||
} from '../../../vis_type_vislib/public/components';
|
||||
import { ColorModes } from '../../../vis_type_vislib/public/utils/collections';
|
||||
} from '../../../vis_type_vislib/public';
|
||||
import { MetricVisParam, VisParams } from '../types';
|
||||
import { SetColorRangeValue } from '../../../vis_type_vislib/public/components/common/color_ranges';
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ import {
|
|||
Render,
|
||||
Style,
|
||||
} from '../../../../plugins/expressions/public';
|
||||
import { ColorModes } from '../../vis_type_vislib/public/utils/collections';
|
||||
import { ColorModes } from '../../vis_type_vislib/public';
|
||||
import { visType, DimensionsVisParam, VisParams } from './types';
|
||||
|
||||
export type Context = KibanaDatatable;
|
||||
|
|
|
@ -21,8 +21,8 @@ import { i18n } from '@kbn/i18n';
|
|||
|
||||
import { MetricVisComponent } from './components/metric_vis_component';
|
||||
import { MetricVisOptions } from './components/metric_vis_options';
|
||||
import { ColorModes } from '../../vis_type_vislib/public';
|
||||
import { Schemas, AggGroupNames, colorSchemas, ColorSchemas } from './legacy_imports';
|
||||
import { ColorModes } from '../../vis_type_vislib/public/utils/collections';
|
||||
|
||||
export const metricVisTypeDefinition = {
|
||||
name: 'metric',
|
||||
|
|
|
@ -20,8 +20,7 @@
|
|||
import { ColorSchemas } from './legacy_imports';
|
||||
import { Range } from '../../../../plugins/expressions/public';
|
||||
import { SchemaConfig } from '../../visualizations/public';
|
||||
import { ColorModes } from '../../vis_type_vislib/public/utils/collections';
|
||||
import { Labels, Style } from '../../vis_type_vislib/public/types';
|
||||
import { ColorModes, Labels, Style } from '../../vis_type_vislib/public';
|
||||
|
||||
export const visType = 'metric';
|
||||
|
||||
|
|
|
@ -24,11 +24,7 @@ import { i18n } from '@kbn/i18n';
|
|||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
|
||||
import { tabifyGetColumns, VisOptionsProps } from '../legacy_imports';
|
||||
import {
|
||||
NumberInputOption,
|
||||
SwitchOption,
|
||||
SelectOption,
|
||||
} from '../../../vis_type_vislib/public/components/common';
|
||||
import { NumberInputOption, SwitchOption, SelectOption } from '../../../vis_type_vislib/public';
|
||||
import { TableVisParams } from '../types';
|
||||
import { totalAggregations, isAggConfigNumeric } from './utils';
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import { i18n } from '@kbn/i18n';
|
|||
|
||||
import { ValidatedDualRange } from 'ui/validated_range';
|
||||
import { VisOptionsProps } from 'ui/vis/editors/default';
|
||||
import { SelectOption, SwitchOption } from '../../../vis_type_vislib/public/components';
|
||||
import { SelectOption, SwitchOption } from '../../../vis_type_vislib/public';
|
||||
import { TagCloudVisParams } from '../types';
|
||||
|
||||
function TagCloudOptions({ stateParams, setValue, vis }: VisOptionsProps<TagCloudVisParams>) {
|
||||
|
|
|
@ -42,9 +42,9 @@ import { KbnVislibVisTypesDependencies } from './plugin';
|
|||
|
||||
export const createAreaVisTypeDefinition = (deps: KbnVislibVisTypesDependencies) => ({
|
||||
name: 'area',
|
||||
title: i18n.translate('kbnVislibVisTypes.area.areaTitle', { defaultMessage: 'Area' }),
|
||||
title: i18n.translate('visTypeVislib.area.areaTitle', { defaultMessage: 'Area' }),
|
||||
icon: 'visArea',
|
||||
description: i18n.translate('kbnVislibVisTypes.area.areaDescription', {
|
||||
description: i18n.translate('visTypeVislib.area.areaDescription', {
|
||||
defaultMessage: 'Emphasize the quantity beneath a line chart',
|
||||
}),
|
||||
visualization: createVislibVisController(deps),
|
||||
|
@ -136,7 +136,7 @@ export const createAreaVisTypeDefinition = (deps: KbnVislibVisTypesDependencies)
|
|||
{
|
||||
group: AggGroupNames.Metrics,
|
||||
name: 'metric',
|
||||
title: i18n.translate('kbnVislibVisTypes.area.metricsTitle', {
|
||||
title: i18n.translate('visTypeVislib.area.metricsTitle', {
|
||||
defaultMessage: 'Y-axis',
|
||||
}),
|
||||
aggFilter: ['!geo_centroid', '!geo_bounds'],
|
||||
|
@ -146,7 +146,7 @@ export const createAreaVisTypeDefinition = (deps: KbnVislibVisTypesDependencies)
|
|||
{
|
||||
group: AggGroupNames.Metrics,
|
||||
name: 'radius',
|
||||
title: i18n.translate('kbnVislibVisTypes.area.radiusTitle', {
|
||||
title: i18n.translate('visTypeVislib.area.radiusTitle', {
|
||||
defaultMessage: 'Dot size',
|
||||
}),
|
||||
min: 0,
|
||||
|
@ -156,7 +156,7 @@ export const createAreaVisTypeDefinition = (deps: KbnVislibVisTypesDependencies)
|
|||
{
|
||||
group: AggGroupNames.Buckets,
|
||||
name: 'segment',
|
||||
title: i18n.translate('kbnVislibVisTypes.area.segmentTitle', {
|
||||
title: i18n.translate('visTypeVislib.area.segmentTitle', {
|
||||
defaultMessage: 'X-axis',
|
||||
}),
|
||||
min: 0,
|
||||
|
@ -166,7 +166,7 @@ export const createAreaVisTypeDefinition = (deps: KbnVislibVisTypesDependencies)
|
|||
{
|
||||
group: AggGroupNames.Buckets,
|
||||
name: 'group',
|
||||
title: i18n.translate('kbnVislibVisTypes.area.groupTitle', {
|
||||
title: i18n.translate('visTypeVislib.area.groupTitle', {
|
||||
defaultMessage: 'Split series',
|
||||
}),
|
||||
min: 0,
|
||||
|
@ -176,7 +176,7 @@ export const createAreaVisTypeDefinition = (deps: KbnVislibVisTypesDependencies)
|
|||
{
|
||||
group: AggGroupNames.Buckets,
|
||||
name: 'split',
|
||||
title: i18n.translate('kbnVislibVisTypes.area.splitTitle', {
|
||||
title: i18n.translate('visTypeVislib.area.splitTitle', {
|
||||
defaultMessage: 'Split chart',
|
||||
}),
|
||||
min: 0,
|
||||
|
|
|
@ -37,7 +37,7 @@ function BasicOptions<VisParams extends BasicOptionsParams>({
|
|||
return (
|
||||
<>
|
||||
<SelectOption
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.vislibBasicOptions.legendPositionLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.vislibBasicOptions.legendPositionLabel', {
|
||||
defaultMessage: 'Legend position',
|
||||
})}
|
||||
options={vis.type.editorConfig.collections.legendPositions}
|
||||
|
@ -46,7 +46,7 @@ function BasicOptions<VisParams extends BasicOptionsParams>({
|
|||
setValue={setValue}
|
||||
/>
|
||||
<SwitchOption
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.vislibBasicOptions.showTooltipLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.vislibBasicOptions.showTooltipLabel', {
|
||||
defaultMessage: 'Show tooltip',
|
||||
})}
|
||||
paramName="addTooltip"
|
||||
|
|
|
@ -71,7 +71,7 @@ function ColorRanges({
|
|||
return (
|
||||
<RangesParamEditor
|
||||
data-test-subj={dataTestSubj}
|
||||
error={i18n.translate('kbnVislibVisTypes.controls.colorRanges.errorText', {
|
||||
error={i18n.translate('visTypeVislib.controls.colorRanges.errorText', {
|
||||
defaultMessage: 'Each range should be greater than previous.',
|
||||
})}
|
||||
hidePlaceholders={true}
|
||||
|
|
|
@ -66,7 +66,7 @@ function ColorSchemaOptions({
|
|||
}}
|
||||
>
|
||||
<FormattedMessage
|
||||
id="kbnVislibVisTypes.controls.colorSchema.resetColorsButtonLabel"
|
||||
id="visTypeVislib.controls.colorSchema.resetColorsButtonLabel"
|
||||
defaultMessage="Reset colors"
|
||||
/>
|
||||
</EuiLink>
|
||||
|
@ -79,11 +79,11 @@ function ColorSchemaOptions({
|
|||
disabled={disabled}
|
||||
helpText={
|
||||
showHelpText &&
|
||||
i18n.translate('kbnVislibVisTypes.controls.colorSchema.howToChangeColorsDescription', {
|
||||
i18n.translate('visTypeVislib.controls.colorSchema.howToChangeColorsDescription', {
|
||||
defaultMessage: 'Individual colors can be changed in the legend.',
|
||||
})
|
||||
}
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.colorSchema.colorSchemaLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.colorSchema.colorSchemaLabel', {
|
||||
defaultMessage: 'Color schema',
|
||||
})}
|
||||
labelAppend={isCustomColors && resetColorsButton}
|
||||
|
@ -95,7 +95,7 @@ function ColorSchemaOptions({
|
|||
|
||||
<SwitchOption
|
||||
disabled={disabled}
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.colorSchema.reverseColorSchemaLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.colorSchema.reverseColorSchemaLabel', {
|
||||
defaultMessage: 'Reverse schema',
|
||||
})}
|
||||
paramName="invertColors"
|
||||
|
|
|
@ -49,7 +49,7 @@ function RangeOption<ParamName extends string>({
|
|||
const [stateValue, setStateValue] = useState(value);
|
||||
const [isValidState, setIsValidState] = useState(true);
|
||||
|
||||
const error = i18n.translate('kbnVislibVisTypes.controls.rangeErrorMessage', {
|
||||
const error = i18n.translate('visTypeVislib.controls.rangeErrorMessage', {
|
||||
defaultMessage: 'Values must be on or between {min} and {max}',
|
||||
values: { min, max },
|
||||
});
|
||||
|
|
|
@ -33,7 +33,7 @@ function TruncateLabelsOption({ disabled, value = null, setValue }: TruncateLabe
|
|||
|
||||
return (
|
||||
<EuiFormRow
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.truncateLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.truncateLabel', {
|
||||
defaultMessage: 'Truncate',
|
||||
})}
|
||||
fullWidth
|
||||
|
|
|
@ -31,7 +31,7 @@ function LabelsPanel({ stateParams, setValue, setGaugeValue }: GaugeOptionsInter
|
|||
<EuiTitle size="xs">
|
||||
<h3>
|
||||
<FormattedMessage
|
||||
id="kbnVislibVisTypes.controls.gaugeOptions.labelsTitle"
|
||||
id="visTypeVislib.controls.gaugeOptions.labelsTitle"
|
||||
defaultMessage="Labels"
|
||||
/>
|
||||
</h3>
|
||||
|
@ -39,7 +39,7 @@ function LabelsPanel({ stateParams, setValue, setGaugeValue }: GaugeOptionsInter
|
|||
<EuiSpacer size="s" />
|
||||
|
||||
<SwitchOption
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.gaugeOptions.showLabelsLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.gaugeOptions.showLabelsLabel', {
|
||||
defaultMessage: 'Show labels',
|
||||
})}
|
||||
paramName="show"
|
||||
|
@ -52,7 +52,7 @@ function LabelsPanel({ stateParams, setValue, setGaugeValue }: GaugeOptionsInter
|
|||
|
||||
<TextInputOption
|
||||
disabled={!stateParams.gauge.labels.show}
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.gaugeOptions.subTextLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.gaugeOptions.subTextLabel', {
|
||||
defaultMessage: 'Sub label',
|
||||
})}
|
||||
paramName="subText"
|
||||
|
@ -64,10 +64,10 @@ function LabelsPanel({ stateParams, setValue, setGaugeValue }: GaugeOptionsInter
|
|||
|
||||
<SwitchOption
|
||||
disabled={!stateParams.gauge.labels.show}
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.gaugeOptions.displayWarningsLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.gaugeOptions.displayWarningsLabel', {
|
||||
defaultMessage: 'Display warnings',
|
||||
})}
|
||||
tooltip={i18n.translate('kbnVislibVisTypes.controls.gaugeOptions.switchWarningsTooltip', {
|
||||
tooltip={i18n.translate('visTypeVislib.controls.gaugeOptions.switchWarningsTooltip', {
|
||||
defaultMessage:
|
||||
'Turns on/off warnings. When turned on, a warning will be shown if not all labels could be displayed.',
|
||||
})}
|
||||
|
|
|
@ -59,7 +59,7 @@ function RangesPanel({
|
|||
<EuiTitle size="xs">
|
||||
<h3>
|
||||
<FormattedMessage
|
||||
id="kbnVislibVisTypes.controls.gaugeOptions.rangesTitle"
|
||||
id="visTypeVislib.controls.gaugeOptions.rangesTitle"
|
||||
defaultMessage="Ranges"
|
||||
/>
|
||||
</h3>
|
||||
|
@ -76,10 +76,10 @@ function RangesPanel({
|
|||
|
||||
<SwitchOption
|
||||
disabled={stateParams.gauge.colorsRange.length < 2}
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.gaugeOptions.autoExtendRangeLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.gaugeOptions.autoExtendRangeLabel', {
|
||||
defaultMessage: 'Auto extend range',
|
||||
})}
|
||||
tooltip={i18n.translate('kbnVislibVisTypes.controls.gaugeOptions.extendRangeTooltip', {
|
||||
tooltip={i18n.translate('visTypeVislib.controls.gaugeOptions.extendRangeTooltip', {
|
||||
defaultMessage: 'Extends range to the maximum value in your data.',
|
||||
})}
|
||||
paramName="extendRange"
|
||||
|
@ -89,7 +89,7 @@ function RangesPanel({
|
|||
|
||||
<SwitchOption
|
||||
data-test-subj="gaugePercentageMode"
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.gaugeOptions.percentageModeLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.gaugeOptions.percentageModeLabel', {
|
||||
defaultMessage: 'Percentage mode',
|
||||
})}
|
||||
paramName="percentageMode"
|
||||
|
@ -107,7 +107,7 @@ function RangesPanel({
|
|||
/>
|
||||
|
||||
<SwitchOption
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.gaugeOptions.showOutline', {
|
||||
label={i18n.translate('visTypeVislib.controls.gaugeOptions.showOutline', {
|
||||
defaultMessage: 'Show outline',
|
||||
})}
|
||||
paramName="outline"
|
||||
|
@ -116,7 +116,7 @@ function RangesPanel({
|
|||
/>
|
||||
|
||||
<SwitchOption
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.gaugeOptions.showLegendLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.gaugeOptions.showLegendLabel', {
|
||||
defaultMessage: 'Show legend',
|
||||
})}
|
||||
paramName="addLegend"
|
||||
|
@ -125,7 +125,7 @@ function RangesPanel({
|
|||
/>
|
||||
|
||||
<SwitchOption
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.gaugeOptions.showScaleLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.gaugeOptions.showScaleLabel', {
|
||||
defaultMessage: 'Show scale',
|
||||
})}
|
||||
paramName="show"
|
||||
|
|
|
@ -36,7 +36,7 @@ function StylePanel({ aggs, setGaugeValue, stateParams, vis }: GaugeOptionsInter
|
|||
<EuiTitle size="xs">
|
||||
<h3>
|
||||
<FormattedMessage
|
||||
id="kbnVislibVisTypes.controls.gaugeOptions.styleTitle"
|
||||
id="visTypeVislib.controls.gaugeOptions.styleTitle"
|
||||
defaultMessage="Style"
|
||||
/>
|
||||
</h3>
|
||||
|
@ -44,7 +44,7 @@ function StylePanel({ aggs, setGaugeValue, stateParams, vis }: GaugeOptionsInter
|
|||
<EuiSpacer size="s" />
|
||||
|
||||
<SelectOption
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.gaugeOptions.gaugeTypeLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.gaugeOptions.gaugeTypeLabel', {
|
||||
defaultMessage: 'Gauge type',
|
||||
})}
|
||||
options={vis.type.editorConfig.collections.gaugeTypes}
|
||||
|
@ -55,7 +55,7 @@ function StylePanel({ aggs, setGaugeValue, stateParams, vis }: GaugeOptionsInter
|
|||
|
||||
<SelectOption
|
||||
disabled={diasableAlignment}
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.gaugeOptions.alignmentLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.gaugeOptions.alignmentLabel', {
|
||||
defaultMessage: 'Alignment',
|
||||
})}
|
||||
options={vis.type.editorConfig.collections.alignments}
|
||||
|
|
|
@ -68,7 +68,7 @@ function HeatmapOptions(props: VisOptionsProps<HeatmapVisParams>) {
|
|||
<EuiTitle size="xs">
|
||||
<h3>
|
||||
<FormattedMessage
|
||||
id="kbnVislibVisTypes.editors.heatmap.basicSettingsTitle"
|
||||
id="visTypeVislib.editors.heatmap.basicSettingsTitle"
|
||||
defaultMessage="Basic settings"
|
||||
/>
|
||||
</h3>
|
||||
|
@ -78,13 +78,13 @@ function HeatmapOptions(props: VisOptionsProps<HeatmapVisParams>) {
|
|||
<BasicOptions {...props} />
|
||||
|
||||
<SwitchOption
|
||||
label={i18n.translate('kbnVislibVisTypes.editors.heatmap.highlightLabel', {
|
||||
label={i18n.translate('visTypeVislib.editors.heatmap.highlightLabel', {
|
||||
defaultMessage: 'Highlight range',
|
||||
})}
|
||||
paramName="enableHover"
|
||||
value={stateParams.enableHover}
|
||||
setValue={setValue}
|
||||
tooltip={i18n.translate('kbnVislibVisTypes.editors.heatmap.highlightLabelTooltip', {
|
||||
tooltip={i18n.translate('visTypeVislib.editors.heatmap.highlightLabelTooltip', {
|
||||
defaultMessage:
|
||||
'Highlight hovered range in the chart and corresponding label in the legend.',
|
||||
})}
|
||||
|
@ -97,7 +97,7 @@ function HeatmapOptions(props: VisOptionsProps<HeatmapVisParams>) {
|
|||
<EuiTitle size="xs">
|
||||
<h3>
|
||||
<FormattedMessage
|
||||
id="kbnVislibVisTypes.editors.heatmap.heatmapSettingsTitle"
|
||||
id="visTypeVislib.editors.heatmap.heatmapSettingsTitle"
|
||||
defaultMessage="Heatmap settings"
|
||||
/>
|
||||
</h3>
|
||||
|
@ -114,7 +114,7 @@ function HeatmapOptions(props: VisOptionsProps<HeatmapVisParams>) {
|
|||
<EuiSpacer size="s" />
|
||||
|
||||
<SelectOption
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.heatmapOptions.colorScaleLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.heatmapOptions.colorScaleLabel', {
|
||||
defaultMessage: 'Color scale',
|
||||
})}
|
||||
options={vis.type.editorConfig.collections.scales}
|
||||
|
@ -124,10 +124,9 @@ function HeatmapOptions(props: VisOptionsProps<HeatmapVisParams>) {
|
|||
/>
|
||||
|
||||
<SwitchOption
|
||||
label={i18n.translate(
|
||||
'kbnVislibVisTypes.controls.heatmapOptions.scaleToDataBoundsLabel',
|
||||
{ defaultMessage: 'Scale to data bounds' }
|
||||
)}
|
||||
label={i18n.translate('visTypeVislib.controls.heatmapOptions.scaleToDataBoundsLabel', {
|
||||
defaultMessage: 'Scale to data bounds',
|
||||
})}
|
||||
paramName="defaultYExtents"
|
||||
value={valueAxis.scale.defaultYExtents}
|
||||
setValue={setValueAxisScale}
|
||||
|
@ -135,7 +134,7 @@ function HeatmapOptions(props: VisOptionsProps<HeatmapVisParams>) {
|
|||
|
||||
<SwitchOption
|
||||
disabled={stateParams.setColorRange}
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.heatmapOptions.percentageModeLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.heatmapOptions.percentageModeLabel', {
|
||||
defaultMessage: 'Percentage mode',
|
||||
})}
|
||||
paramName="percentageMode"
|
||||
|
@ -148,7 +147,7 @@ function HeatmapOptions(props: VisOptionsProps<HeatmapVisParams>) {
|
|||
data-test-subj="heatmapColorsNumber"
|
||||
disabled={stateParams.setColorRange}
|
||||
isInvalid={isColorsNumberInvalid}
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.heatmapOptions.colorsNumberLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.heatmapOptions.colorsNumberLabel', {
|
||||
defaultMessage: 'Number of colors',
|
||||
})}
|
||||
max={10}
|
||||
|
@ -160,7 +159,7 @@ function HeatmapOptions(props: VisOptionsProps<HeatmapVisParams>) {
|
|||
|
||||
<SwitchOption
|
||||
data-test-subj="heatmapUseCustomRanges"
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.heatmapOptions.useCustomRangesLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.heatmapOptions.useCustomRangesLabel', {
|
||||
defaultMessage: 'Use custom ranges',
|
||||
})}
|
||||
paramName="setColorRange"
|
||||
|
|
|
@ -65,7 +65,7 @@ function LabelsPanel({ valueAxis, setValue }: LabelsPanelProps) {
|
|||
<EuiTitle size="xs">
|
||||
<h3>
|
||||
<FormattedMessage
|
||||
id="kbnVislibVisTypes.controls.heatmapOptions.labelsTitle"
|
||||
id="visTypeVislib.controls.heatmapOptions.labelsTitle"
|
||||
defaultMessage="Labels"
|
||||
/>
|
||||
</h3>
|
||||
|
@ -73,7 +73,7 @@ function LabelsPanel({ valueAxis, setValue }: LabelsPanelProps) {
|
|||
<EuiSpacer size="s" />
|
||||
|
||||
<SwitchOption
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.heatmapOptions.showLabelsTitle', {
|
||||
label={i18n.translate('visTypeVislib.controls.heatmapOptions.showLabelsTitle', {
|
||||
defaultMessage: 'Show labels',
|
||||
})}
|
||||
paramName="show"
|
||||
|
@ -83,7 +83,7 @@ function LabelsPanel({ valueAxis, setValue }: LabelsPanelProps) {
|
|||
|
||||
<SwitchOption
|
||||
disabled={!valueAxis.labels.show}
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.heatmapOptions.rotateLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.heatmapOptions.rotateLabel', {
|
||||
defaultMessage: 'Rotate',
|
||||
})}
|
||||
paramName="rotate"
|
||||
|
@ -94,7 +94,7 @@ function LabelsPanel({ valueAxis, setValue }: LabelsPanelProps) {
|
|||
<SwitchOption
|
||||
disabled={!valueAxis.labels.show}
|
||||
label={i18n.translate(
|
||||
'kbnVislibVisTypes.controls.heatmapOptions.overwriteAutomaticColorLabel',
|
||||
'visTypeVislib.controls.heatmapOptions.overwriteAutomaticColorLabel',
|
||||
{
|
||||
defaultMessage: 'Overwrite automatic color',
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ function LabelsPanel({ valueAxis, setValue }: LabelsPanelProps) {
|
|||
<EuiFormRow
|
||||
display="rowCompressed"
|
||||
fullWidth
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.heatmapOptions.colorLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.heatmapOptions.colorLabel', {
|
||||
defaultMessage: 'Color',
|
||||
})}
|
||||
>
|
||||
|
|
|
@ -10,7 +10,7 @@ exports[`CategoryAxisPanel component should init with the default set of props 1
|
|||
<h3>
|
||||
<FormattedMessage
|
||||
defaultMessage="X-axis"
|
||||
id="kbnVislibVisTypes.controls.pointSeries.categoryAxis.xAxisTitle"
|
||||
id="visTypeVislib.controls.pointSeries.categoryAxis.xAxisTitle"
|
||||
values={Object {}}
|
||||
/>
|
||||
</h3>
|
||||
|
|
|
@ -11,7 +11,7 @@ exports[`LabelOptions component should init with the default set of props 1`] =
|
|||
<h3>
|
||||
<FormattedMessage
|
||||
defaultMessage="Labels"
|
||||
id="kbnVislibVisTypes.controls.pointSeries.categoryAxis.labelsTitle"
|
||||
id="visTypeVislib.controls.pointSeries.categoryAxis.labelsTitle"
|
||||
values={Object {}}
|
||||
/>
|
||||
</h3>
|
||||
|
|
|
@ -18,7 +18,7 @@ exports[`ValueAxesPanel component should init with the default set of props 1`]
|
|||
<h3>
|
||||
<FormattedMessage
|
||||
defaultMessage="Y-axes"
|
||||
id="kbnVislibVisTypes.controls.pointSeries.valueAxes.yAxisTitle"
|
||||
id="visTypeVislib.controls.pointSeries.valueAxes.yAxisTitle"
|
||||
values={Object {}}
|
||||
/>
|
||||
</h3>
|
||||
|
|
|
@ -62,7 +62,7 @@ function CategoryAxisPanel(props: CategoryAxisPanelProps) {
|
|||
<EuiTitle size="xs">
|
||||
<h3>
|
||||
<FormattedMessage
|
||||
id="kbnVislibVisTypes.controls.pointSeries.categoryAxis.xAxisTitle"
|
||||
id="visTypeVislib.controls.pointSeries.categoryAxis.xAxisTitle"
|
||||
defaultMessage="X-axis"
|
||||
/>
|
||||
</h3>
|
||||
|
@ -70,7 +70,7 @@ function CategoryAxisPanel(props: CategoryAxisPanelProps) {
|
|||
<EuiSpacer size="s" />
|
||||
|
||||
<SelectOption
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.pointSeries.categoryAxis.positionLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.pointSeries.categoryAxis.positionLabel', {
|
||||
defaultMessage: 'Position',
|
||||
})}
|
||||
options={vis.type.editorConfig.collections.positions}
|
||||
|
@ -80,7 +80,7 @@ function CategoryAxisPanel(props: CategoryAxisPanelProps) {
|
|||
/>
|
||||
|
||||
<SwitchOption
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.pointSeries.categoryAxis.showLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.pointSeries.categoryAxis.showLabel', {
|
||||
defaultMessage: 'Show axis lines and labels',
|
||||
})}
|
||||
paramName="show"
|
||||
|
|
|
@ -67,7 +67,7 @@ function ChartOptions({
|
|||
value: id,
|
||||
})),
|
||||
{
|
||||
text: i18n.translate('kbnVislibVisTypes.controls.pointSeries.series.newAxisLabel', {
|
||||
text: i18n.translate('visTypeVislib.controls.pointSeries.series.newAxisLabel', {
|
||||
defaultMessage: 'New axis…',
|
||||
}),
|
||||
value: 'new',
|
||||
|
@ -80,7 +80,7 @@ function ChartOptions({
|
|||
<>
|
||||
<SelectOption
|
||||
id={`seriesValueAxis${index}`}
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.pointSeries.series.valueAxisLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.pointSeries.series.valueAxisLabel', {
|
||||
defaultMessage: 'Value axis',
|
||||
})}
|
||||
options={valueAxesOptions}
|
||||
|
@ -95,7 +95,7 @@ function ChartOptions({
|
|||
<EuiFlexItem>
|
||||
<SelectOption
|
||||
id={`seriesType${index}`}
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.pointSeries.series.chartTypeLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.pointSeries.series.chartTypeLabel', {
|
||||
defaultMessage: 'Chart type',
|
||||
})}
|
||||
options={vis.type.editorConfig.collections.chartTypes}
|
||||
|
@ -107,7 +107,7 @@ function ChartOptions({
|
|||
<EuiFlexItem>
|
||||
<SelectOption
|
||||
id={`seriesMode${index}`}
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.pointSeries.series.modeLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.pointSeries.series.modeLabel', {
|
||||
defaultMessage: 'Mode',
|
||||
})}
|
||||
options={vis.type.editorConfig.collections.chartModes}
|
||||
|
@ -123,7 +123,7 @@ function ChartOptions({
|
|||
<EuiSpacer size="m" />
|
||||
|
||||
<SelectOption
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.pointSeries.series.lineModeLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.pointSeries.series.lineModeLabel', {
|
||||
defaultMessage: 'Line mode',
|
||||
})}
|
||||
options={vis.type.editorConfig.collections.interpolationModes}
|
||||
|
|
|
@ -39,7 +39,7 @@ function CustomExtentsOptions({
|
|||
setValueAxisScale,
|
||||
}: CustomExtentsOptionsProps) {
|
||||
const invalidBoundsMarginMessage = i18n.translate(
|
||||
'kbnVislibVisTypes.controls.pointSeries.valueAxes.scaleToDataBounds.minNeededBoundsMargin',
|
||||
'visTypeVislib.controls.pointSeries.valueAxes.scaleToDataBounds.minNeededBoundsMargin',
|
||||
{ defaultMessage: 'Bounds margin must be greater than or equal to 0.' }
|
||||
);
|
||||
|
||||
|
@ -85,7 +85,7 @@ function CustomExtentsOptions({
|
|||
<>
|
||||
<SwitchOption
|
||||
label={i18n.translate(
|
||||
'kbnVislibVisTypes.controls.pointSeries.valueAxes.scaleToDataBoundsLabel',
|
||||
'visTypeVislib.controls.pointSeries.valueAxes.scaleToDataBoundsLabel',
|
||||
{
|
||||
defaultMessage: 'Scale to data bounds',
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ function CustomExtentsOptions({
|
|||
error={!isBoundsMarginValid && invalidBoundsMarginMessage}
|
||||
isInvalid={!isBoundsMarginValid}
|
||||
label={i18n.translate(
|
||||
'kbnVislibVisTypes.controls.pointSeries.valueAxes.scaleToDataBounds.boundsMargin',
|
||||
'visTypeVislib.controls.pointSeries.valueAxes.scaleToDataBounds.boundsMargin',
|
||||
{
|
||||
defaultMessage: 'Bounds margin',
|
||||
}
|
||||
|
@ -117,12 +117,9 @@ function CustomExtentsOptions({
|
|||
|
||||
<SwitchOption
|
||||
data-test-subj="yAxisSetYExtents"
|
||||
label={i18n.translate(
|
||||
'kbnVislibVisTypes.controls.pointSeries.valueAxes.setAxisExtentsLabel',
|
||||
{
|
||||
defaultMessage: 'Set axis extents',
|
||||
}
|
||||
)}
|
||||
label={i18n.translate('visTypeVislib.controls.pointSeries.valueAxes.setAxisExtentsLabel', {
|
||||
defaultMessage: 'Set axis extents',
|
||||
})}
|
||||
paramName="setYExtents"
|
||||
value={axis.scale.setYExtents}
|
||||
setValue={onSetYExtentsChange}
|
||||
|
|
|
@ -65,7 +65,7 @@ function LabelOptions({ stateParams, setValue, axis, axesName, index }: LabelOpt
|
|||
<EuiTitle size="xxs">
|
||||
<h3>
|
||||
<FormattedMessage
|
||||
id="kbnVislibVisTypes.controls.pointSeries.categoryAxis.labelsTitle"
|
||||
id="visTypeVislib.controls.pointSeries.categoryAxis.labelsTitle"
|
||||
defaultMessage="Labels"
|
||||
/>
|
||||
</h3>
|
||||
|
@ -73,12 +73,9 @@ function LabelOptions({ stateParams, setValue, axis, axesName, index }: LabelOpt
|
|||
<EuiSpacer size="s" />
|
||||
|
||||
<SwitchOption
|
||||
label={i18n.translate(
|
||||
'kbnVislibVisTypes.controls.pointSeries.categoryAxis.showLabelsLabel',
|
||||
{
|
||||
defaultMessage: 'Show labels',
|
||||
}
|
||||
)}
|
||||
label={i18n.translate('visTypeVislib.controls.pointSeries.categoryAxis.showLabelsLabel', {
|
||||
defaultMessage: 'Show labels',
|
||||
})}
|
||||
paramName="show"
|
||||
value={axis.labels.show}
|
||||
setValue={setAxisLabel}
|
||||
|
@ -89,12 +86,9 @@ function LabelOptions({ stateParams, setValue, axis, axesName, index }: LabelOpt
|
|||
axis.id
|
||||
}`}
|
||||
disabled={!axis.labels.show}
|
||||
label={i18n.translate(
|
||||
'kbnVislibVisTypes.controls.pointSeries.categoryAxis.filterLabelsLabel',
|
||||
{
|
||||
defaultMessage: 'Filter labels',
|
||||
}
|
||||
)}
|
||||
label={i18n.translate('visTypeVislib.controls.pointSeries.categoryAxis.filterLabelsLabel', {
|
||||
defaultMessage: 'Filter labels',
|
||||
})}
|
||||
paramName="filter"
|
||||
value={axis.labels.filter}
|
||||
setValue={setAxisLabel}
|
||||
|
@ -106,12 +100,9 @@ function LabelOptions({ stateParams, setValue, axis, axesName, index }: LabelOpt
|
|||
<EuiFlexItem>
|
||||
<SelectOption
|
||||
disabled={!axis.labels.show}
|
||||
label={i18n.translate(
|
||||
'kbnVislibVisTypes.controls.pointSeries.categoryAxis.alignLabel',
|
||||
{
|
||||
defaultMessage: 'Align',
|
||||
}
|
||||
)}
|
||||
label={i18n.translate('visTypeVislib.controls.pointSeries.categoryAxis.alignLabel', {
|
||||
defaultMessage: 'Align',
|
||||
})}
|
||||
options={rotateOptions}
|
||||
paramName="rotate"
|
||||
value={axis.labels.rotate}
|
||||
|
|
|
@ -46,7 +46,7 @@ function LineOptions({ chart, vis, setChart }: LineOptionsParams) {
|
|||
<EuiSpacer size="m" />
|
||||
|
||||
<SwitchOption
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.pointSeries.series.showLineLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.pointSeries.series.showLineLabel', {
|
||||
defaultMessage: 'Show line',
|
||||
})}
|
||||
paramName="drawLinesBetweenPoints"
|
||||
|
@ -60,7 +60,7 @@ function LineOptions({ chart, vis, setChart }: LineOptionsParams) {
|
|||
<EuiFlexItem>
|
||||
<SelectOption
|
||||
disabled={!chart.drawLinesBetweenPoints}
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.pointSeries.series.lineModeLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.pointSeries.series.lineModeLabel', {
|
||||
defaultMessage: 'Line mode',
|
||||
})}
|
||||
options={vis.type.editorConfig.collections.interpolationModes}
|
||||
|
@ -72,7 +72,7 @@ function LineOptions({ chart, vis, setChart }: LineOptionsParams) {
|
|||
<EuiFlexItem>
|
||||
<NumberInputOption
|
||||
disabled={!chart.drawLinesBetweenPoints}
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.pointSeries.series.lineWidthLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.pointSeries.series.lineWidthLabel', {
|
||||
defaultMessage: 'Line width',
|
||||
})}
|
||||
paramName="lineWidth"
|
||||
|
@ -87,7 +87,7 @@ function LineOptions({ chart, vis, setChart }: LineOptionsParams) {
|
|||
<EuiSpacer size="m" />
|
||||
|
||||
<SwitchOption
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.pointSeries.series.showDotsLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.pointSeries.series.showDotsLabel', {
|
||||
defaultMessage: 'Show dots',
|
||||
})}
|
||||
paramName="showCircles"
|
||||
|
|
|
@ -41,7 +41,7 @@ function SeriesPanel(props: SeriesPanelProps) {
|
|||
<EuiTitle size="xs">
|
||||
<h3>
|
||||
<FormattedMessage
|
||||
id="kbnVislibVisTypes.controls.pointSeries.series.metricsTitle"
|
||||
id="visTypeVislib.controls.pointSeries.series.metricsTitle"
|
||||
defaultMessage="Metrics"
|
||||
/>
|
||||
</h3>
|
||||
|
@ -57,7 +57,7 @@ function SeriesPanel(props: SeriesPanelProps) {
|
|||
buttonContent={chart.data.label}
|
||||
buttonContentClassName="visEditorSidebar__aggGroupAccordionButtonContent eui-textTruncate"
|
||||
aria-label={i18n.translate(
|
||||
'kbnVislibVisTypes.controls.pointSeries.seriesAccordionAriaLabel',
|
||||
'visTypeVislib.controls.pointSeries.seriesAccordionAriaLabel',
|
||||
{
|
||||
defaultMessage: 'Toggle {agg} options',
|
||||
values: { agg: chart.data.label },
|
||||
|
|
|
@ -60,7 +60,7 @@ function ValueAxesPanel(props: ValueAxesPanelProps) {
|
|||
|
||||
const removeButtonTooltip = useMemo(
|
||||
() =>
|
||||
i18n.translate('kbnVislibVisTypes.controls.pointSeries.valueAxes.removeButtonTooltip', {
|
||||
i18n.translate('visTypeVislib.controls.pointSeries.valueAxes.removeButtonTooltip', {
|
||||
defaultMessage: 'Remove Y-axis',
|
||||
}),
|
||||
[]
|
||||
|
@ -83,7 +83,7 @@ function ValueAxesPanel(props: ValueAxesPanelProps) {
|
|||
|
||||
const addButtonTooltip = useMemo(
|
||||
() =>
|
||||
i18n.translate('kbnVislibVisTypes.controls.pointSeries.valueAxes.addButtonTooltip', {
|
||||
i18n.translate('visTypeVislib.controls.pointSeries.valueAxes.addButtonTooltip', {
|
||||
defaultMessage: 'Add Y-axis',
|
||||
}),
|
||||
[]
|
||||
|
@ -111,7 +111,7 @@ function ValueAxesPanel(props: ValueAxesPanelProps) {
|
|||
<EuiTitle size="xs">
|
||||
<h3>
|
||||
<FormattedMessage
|
||||
id="kbnVislibVisTypes.controls.pointSeries.valueAxes.yAxisTitle"
|
||||
id="visTypeVislib.controls.pointSeries.valueAxes.yAxisTitle"
|
||||
defaultMessage="Y-axes"
|
||||
/>
|
||||
</h3>
|
||||
|
@ -142,7 +142,7 @@ function ValueAxesPanel(props: ValueAxesPanelProps) {
|
|||
buttonClassName="eui-textTruncate"
|
||||
buttonContentClassName="visEditorSidebar__aggGroupAccordionButtonContent eui-textTruncate"
|
||||
aria-label={i18n.translate(
|
||||
'kbnVislibVisTypes.controls.pointSeries.valueAxes.toggleOptionsAriaLabel',
|
||||
'visTypeVislib.controls.pointSeries.valueAxes.toggleOptionsAriaLabel',
|
||||
{
|
||||
defaultMessage: 'Toggle {axisName} options',
|
||||
values: { axisName: axis.name },
|
||||
|
|
|
@ -119,7 +119,7 @@ function ValueAxisOptions(props: ValueAxisOptionsParams) {
|
|||
return (
|
||||
<>
|
||||
<SelectOption
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.pointSeries.valueAxes.positionLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.pointSeries.valueAxes.positionLabel', {
|
||||
defaultMessage: 'Position',
|
||||
})}
|
||||
options={positions}
|
||||
|
@ -130,7 +130,7 @@ function ValueAxisOptions(props: ValueAxisOptionsParams) {
|
|||
|
||||
<SelectOption
|
||||
id={`valueAxisMode${index}`}
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.pointSeries.valueAxes.modeLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.pointSeries.valueAxes.modeLabel', {
|
||||
defaultMessage: 'Mode',
|
||||
})}
|
||||
options={vis.type.editorConfig.collections.axisModes}
|
||||
|
@ -141,7 +141,7 @@ function ValueAxisOptions(props: ValueAxisOptionsParams) {
|
|||
|
||||
<SelectOption
|
||||
id={`scaleSelectYAxis-${axis.id}`}
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.pointSeries.valueAxes.scaleTypeLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.pointSeries.valueAxes.scaleTypeLabel', {
|
||||
defaultMessage: 'Scale type',
|
||||
})}
|
||||
options={vis.type.editorConfig.collections.scaleTypes}
|
||||
|
@ -153,7 +153,7 @@ function ValueAxisOptions(props: ValueAxisOptionsParams) {
|
|||
<EuiHorizontalRule margin="m" />
|
||||
|
||||
<SwitchOption
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.pointSeries.valueAxes.showLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.pointSeries.valueAxes.showLabel', {
|
||||
defaultMessage: 'Show axis lines and labels',
|
||||
})}
|
||||
paramName="show"
|
||||
|
@ -166,7 +166,7 @@ function ValueAxisOptions(props: ValueAxisOptionsParams) {
|
|||
<EuiSpacer size="m" />
|
||||
<TextInputOption
|
||||
data-test-subj={`valueAxisTitle${index}`}
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.pointSeries.valueAxes.titleLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.pointSeries.valueAxes.titleLabel', {
|
||||
defaultMessage: 'Title',
|
||||
})}
|
||||
paramName="text"
|
||||
|
@ -188,13 +188,13 @@ function ValueAxisOptions(props: ValueAxisOptionsParams) {
|
|||
initialIsOpen={false}
|
||||
buttonContentClassName="euiText euiText--small"
|
||||
buttonContent={i18n.translate(
|
||||
'kbnVislibVisTypes.controls.pointSeries.valueAxes.customExtentsLabel',
|
||||
'visTypeVislib.controls.pointSeries.valueAxes.customExtentsLabel',
|
||||
{
|
||||
defaultMessage: 'Custom extents',
|
||||
}
|
||||
)}
|
||||
aria-label={i18n.translate(
|
||||
'kbnVislibVisTypes.controls.pointSeries.valueAxes.toggleCustomExtendsAriaLabel',
|
||||
'visTypeVislib.controls.pointSeries.valueAxes.toggleCustomExtendsAriaLabel',
|
||||
{
|
||||
defaultMessage: 'Toggle custom extents',
|
||||
}
|
||||
|
|
|
@ -26,16 +26,12 @@ import { ScaleTypes } from '../../../utils/collections';
|
|||
import { NumberInputOption } from '../../common';
|
||||
import { SetScale } from './value_axis_options';
|
||||
|
||||
const rangeError = i18n.translate(
|
||||
'kbnVislibVisTypes.controls.pointSeries.valueAxes.minErrorMessage',
|
||||
{ defaultMessage: 'Min should be less than Max.' }
|
||||
);
|
||||
const minError = i18n.translate(
|
||||
'kbnVislibVisTypes.controls.pointSeries.valueAxes.minNeededScaleText',
|
||||
{
|
||||
defaultMessage: 'Min must exceed 0 when a log scale is selected.',
|
||||
}
|
||||
);
|
||||
const rangeError = i18n.translate('visTypeVislib.controls.pointSeries.valueAxes.minErrorMessage', {
|
||||
defaultMessage: 'Min should be less than Max.',
|
||||
});
|
||||
const minError = i18n.translate('visTypeVislib.controls.pointSeries.valueAxes.minNeededScaleText', {
|
||||
defaultMessage: 'Min must exceed 0 when a log scale is selected.',
|
||||
});
|
||||
|
||||
function areExtentsValid(min: number | null = null, max: number | null = null): boolean {
|
||||
if (min === null || max === null) {
|
||||
|
@ -90,7 +86,7 @@ function YExtents({ scale, setScale, setMultipleValidity }: YExtentsProps) {
|
|||
<NumberInputOption
|
||||
data-test-subj="yAxisYExtentsMin"
|
||||
isInvalid={!!errors.length}
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.pointSeries.valueAxes.minLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.pointSeries.valueAxes.minLabel', {
|
||||
defaultMessage: 'Min',
|
||||
})}
|
||||
step={0.1}
|
||||
|
@ -102,7 +98,7 @@ function YExtents({ scale, setScale, setMultipleValidity }: YExtentsProps) {
|
|||
<EuiFlexItem>
|
||||
<NumberInputOption
|
||||
data-test-subj="yAxisYExtentsMax"
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.pointSeries.valueAxes.maxLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.pointSeries.valueAxes.maxLabel', {
|
||||
defaultMessage: 'Max',
|
||||
})}
|
||||
step={0.1}
|
||||
|
|
|
@ -39,14 +39,14 @@ function PieOptions(props: VisOptionsProps<PieVisParams>) {
|
|||
<EuiTitle size="xs">
|
||||
<h3>
|
||||
<FormattedMessage
|
||||
id="kbnVislibVisTypes.editors.pie.pieSettingsTitle"
|
||||
id="visTypeVislib.editors.pie.pieSettingsTitle"
|
||||
defaultMessage="Pie settings"
|
||||
/>
|
||||
</h3>
|
||||
</EuiTitle>
|
||||
<EuiSpacer size="s" />
|
||||
<SwitchOption
|
||||
label={i18n.translate('kbnVislibVisTypes.editors.pie.donutLabel', {
|
||||
label={i18n.translate('visTypeVislib.editors.pie.donutLabel', {
|
||||
defaultMessage: 'Donut',
|
||||
})}
|
||||
paramName="isDonut"
|
||||
|
@ -62,14 +62,14 @@ function PieOptions(props: VisOptionsProps<PieVisParams>) {
|
|||
<EuiTitle size="xs">
|
||||
<h3>
|
||||
<FormattedMessage
|
||||
id="kbnVislibVisTypes.editors.pie.labelsSettingsTitle"
|
||||
id="visTypeVislib.editors.pie.labelsSettingsTitle"
|
||||
defaultMessage="Labels settings"
|
||||
/>
|
||||
</h3>
|
||||
</EuiTitle>
|
||||
<EuiSpacer size="s" />
|
||||
<SwitchOption
|
||||
label={i18n.translate('kbnVislibVisTypes.editors.pie.showLabelsLabel', {
|
||||
label={i18n.translate('visTypeVislib.editors.pie.showLabelsLabel', {
|
||||
defaultMessage: 'Show labels',
|
||||
})}
|
||||
paramName="show"
|
||||
|
@ -77,7 +77,7 @@ function PieOptions(props: VisOptionsProps<PieVisParams>) {
|
|||
setValue={setLabels}
|
||||
/>
|
||||
<SwitchOption
|
||||
label={i18n.translate('kbnVislibVisTypes.editors.pie.showTopLevelOnlyLabel', {
|
||||
label={i18n.translate('visTypeVislib.editors.pie.showTopLevelOnlyLabel', {
|
||||
defaultMessage: 'Show top level only',
|
||||
})}
|
||||
paramName="last_level"
|
||||
|
@ -85,7 +85,7 @@ function PieOptions(props: VisOptionsProps<PieVisParams>) {
|
|||
setValue={setLabels}
|
||||
/>
|
||||
<SwitchOption
|
||||
label={i18n.translate('kbnVislibVisTypes.editors.pie.showValuesLabel', {
|
||||
label={i18n.translate('visTypeVislib.editors.pie.showValuesLabel', {
|
||||
defaultMessage: 'Show values',
|
||||
})}
|
||||
paramName="values"
|
||||
|
|
|
@ -42,7 +42,7 @@ function GridPanel({ stateParams, setValue, hasHistogramAgg }: VisOptionsProps<B
|
|||
value: id,
|
||||
})),
|
||||
{
|
||||
text: i18n.translate('kbnVislibVisTypes.controls.pointSeries.gridAxis.dontShowLabel', {
|
||||
text: i18n.translate('visTypeVislib.controls.pointSeries.gridAxis.dontShowLabel', {
|
||||
defaultMessage: "Don't show",
|
||||
}),
|
||||
value: '',
|
||||
|
@ -62,7 +62,7 @@ function GridPanel({ stateParams, setValue, hasHistogramAgg }: VisOptionsProps<B
|
|||
<EuiTitle size="xs">
|
||||
<h3>
|
||||
<FormattedMessage
|
||||
id="kbnVislibVisTypes.controls.pointSeries.gridAxis.gridText"
|
||||
id="visTypeVislib.controls.pointSeries.gridAxis.gridText"
|
||||
defaultMessage="Grid"
|
||||
/>
|
||||
</h3>
|
||||
|
@ -72,14 +72,14 @@ function GridPanel({ stateParams, setValue, hasHistogramAgg }: VisOptionsProps<B
|
|||
|
||||
<SwitchOption
|
||||
disabled={hasHistogramAgg}
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.pointSeries.gridAxis.xAxisLinesLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.pointSeries.gridAxis.xAxisLinesLabel', {
|
||||
defaultMessage: 'Show X-axis lines',
|
||||
})}
|
||||
paramName="categoryLines"
|
||||
tooltip={
|
||||
hasHistogramAgg
|
||||
? i18n.translate(
|
||||
'kbnVislibVisTypes.controls.pointSeries.gridAxis.yAxisLinesDisabledTooltip',
|
||||
'visTypeVislib.controls.pointSeries.gridAxis.yAxisLinesDisabledTooltip',
|
||||
{
|
||||
defaultMessage: "X-axis lines can't show for histograms.",
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ function GridPanel({ stateParams, setValue, hasHistogramAgg }: VisOptionsProps<B
|
|||
|
||||
<SelectOption
|
||||
id="gridAxis"
|
||||
label={i18n.translate('kbnVislibVisTypes.controls.pointSeries.gridAxis.yAxisLinesLabel', {
|
||||
label={i18n.translate('visTypeVislib.controls.pointSeries.gridAxis.yAxisLinesLabel', {
|
||||
defaultMessage: 'Y-axis lines',
|
||||
})}
|
||||
options={options}
|
||||
|
|
|
@ -35,7 +35,7 @@ function PointSeriesOptions(props: ValidationVisOptionsProps<BasicVislibParams>)
|
|||
<EuiTitle size="xs">
|
||||
<h3>
|
||||
<FormattedMessage
|
||||
id="kbnVislibVisTypes.editors.pointSeries.settingsTitle"
|
||||
id="visTypeVislib.editors.pointSeries.settingsTitle"
|
||||
defaultMessage="Settings"
|
||||
/>
|
||||
</h3>
|
||||
|
@ -46,7 +46,7 @@ function PointSeriesOptions(props: ValidationVisOptionsProps<BasicVislibParams>)
|
|||
|
||||
{vis.hasSchemaAgg('segment', 'date_histogram') ? (
|
||||
<SwitchOption
|
||||
label={i18n.translate('kbnVislibVisTypes.editors.pointSeries.currentTimeMarkerLabel', {
|
||||
label={i18n.translate('visTypeVislib.editors.pointSeries.currentTimeMarkerLabel', {
|
||||
defaultMessage: 'Current time marker',
|
||||
})}
|
||||
paramName="addTimeMarker"
|
||||
|
@ -55,7 +55,7 @@ function PointSeriesOptions(props: ValidationVisOptionsProps<BasicVislibParams>)
|
|||
/>
|
||||
) : (
|
||||
<SwitchOption
|
||||
label={i18n.translate('kbnVislibVisTypes.editors.pointSeries.orderBucketsBySumLabel', {
|
||||
label={i18n.translate('visTypeVislib.editors.pointSeries.orderBucketsBySumLabel', {
|
||||
defaultMessage: 'Order buckets by sum',
|
||||
})}
|
||||
paramName="orderBucketsBySum"
|
||||
|
@ -66,7 +66,7 @@ function PointSeriesOptions(props: ValidationVisOptionsProps<BasicVislibParams>)
|
|||
|
||||
{vis.type.type === 'histogram' && (
|
||||
<SwitchOption
|
||||
label={i18n.translate('kbnVislibVisTypes.editors.pointSeries.showLabels', {
|
||||
label={i18n.translate('visTypeVislib.editors.pointSeries.showLabels', {
|
||||
defaultMessage: 'Show values on chart',
|
||||
})}
|
||||
paramName="show"
|
||||
|
|
|
@ -55,7 +55,7 @@ function ThresholdPanel({
|
|||
<EuiTitle size="xs">
|
||||
<h3>
|
||||
<FormattedMessage
|
||||
id="kbnVislibVisTypes.editors.pointSeries.thresholdLineSettingsTitle"
|
||||
id="visTypeVislib.editors.pointSeries.thresholdLineSettingsTitle"
|
||||
defaultMessage="Threshold line"
|
||||
/>
|
||||
</h3>
|
||||
|
@ -63,7 +63,7 @@ function ThresholdPanel({
|
|||
<EuiSpacer size="m" />
|
||||
|
||||
<SwitchOption
|
||||
label={i18n.translate('kbnVislibVisTypes.editors.pointSeries.thresholdLine.showLabel', {
|
||||
label={i18n.translate('visTypeVislib.editors.pointSeries.thresholdLine.showLabel', {
|
||||
defaultMessage: 'Show threshold line',
|
||||
})}
|
||||
paramName="show"
|
||||
|
@ -74,12 +74,9 @@ function ThresholdPanel({
|
|||
{stateParams.thresholdLine.show && (
|
||||
<>
|
||||
<NumberInputOption
|
||||
label={i18n.translate(
|
||||
'kbnVislibVisTypes.editors.pointSeries.thresholdLine.valueLabel',
|
||||
{
|
||||
defaultMessage: 'Threshold value',
|
||||
}
|
||||
)}
|
||||
label={i18n.translate('visTypeVislib.editors.pointSeries.thresholdLine.valueLabel', {
|
||||
defaultMessage: 'Threshold value',
|
||||
})}
|
||||
paramName="value"
|
||||
value={stateParams.thresholdLine.value}
|
||||
setValue={setThresholdLine}
|
||||
|
@ -87,12 +84,9 @@ function ThresholdPanel({
|
|||
/>
|
||||
|
||||
<NumberInputOption
|
||||
label={i18n.translate(
|
||||
'kbnVislibVisTypes.editors.pointSeries.thresholdLine.widthLabel',
|
||||
{
|
||||
defaultMessage: 'Line width',
|
||||
}
|
||||
)}
|
||||
label={i18n.translate('visTypeVislib.editors.pointSeries.thresholdLine.widthLabel', {
|
||||
defaultMessage: 'Line width',
|
||||
})}
|
||||
paramName="width"
|
||||
min={1}
|
||||
step={1}
|
||||
|
@ -102,12 +96,9 @@ function ThresholdPanel({
|
|||
/>
|
||||
|
||||
<SelectOption
|
||||
label={i18n.translate(
|
||||
'kbnVislibVisTypes.editors.pointSeries.thresholdLine.styleLabel',
|
||||
{
|
||||
defaultMessage: 'Line style',
|
||||
}
|
||||
)}
|
||||
label={i18n.translate('visTypeVislib.editors.pointSeries.thresholdLine.styleLabel', {
|
||||
defaultMessage: 'Line style',
|
||||
})}
|
||||
options={vis.type.editorConfig.collections.thresholdLineStyles}
|
||||
paramName="style"
|
||||
value={stateParams.thresholdLine.style}
|
||||
|
@ -115,12 +106,9 @@ function ThresholdPanel({
|
|||
/>
|
||||
|
||||
<EuiFormRow
|
||||
label={i18n.translate(
|
||||
'kbnVislibVisTypes.editors.pointSeries.thresholdLine.colorLabel',
|
||||
{
|
||||
defaultMessage: 'Line color',
|
||||
}
|
||||
)}
|
||||
label={i18n.translate('visTypeVislib.editors.pointSeries.thresholdLine.colorLabel', {
|
||||
defaultMessage: 'Line color',
|
||||
})}
|
||||
fullWidth
|
||||
compressed
|
||||
>
|
||||
|
|
|
@ -56,9 +56,9 @@ export interface GaugeVisParams {
|
|||
|
||||
export const createGaugeVisTypeDefinition = (deps: KbnVislibVisTypesDependencies) => ({
|
||||
name: 'gauge',
|
||||
title: i18n.translate('kbnVislibVisTypes.gauge.gaugeTitle', { defaultMessage: 'Gauge' }),
|
||||
title: i18n.translate('visTypeVislib.gauge.gaugeTitle', { defaultMessage: 'Gauge' }),
|
||||
icon: 'visGauge',
|
||||
description: i18n.translate('kbnVislibVisTypes.gauge.gaugeDescription', {
|
||||
description: i18n.translate('visTypeVislib.gauge.gaugeDescription', {
|
||||
defaultMessage:
|
||||
"Gauges indicate the status of a metric. Use it to show how a metric's value relates to reference threshold values.",
|
||||
}),
|
||||
|
@ -116,7 +116,7 @@ export const createGaugeVisTypeDefinition = (deps: KbnVislibVisTypesDependencies
|
|||
{
|
||||
group: AggGroupNames.Metrics,
|
||||
name: 'metric',
|
||||
title: i18n.translate('kbnVislibVisTypes.gauge.metricTitle', { defaultMessage: 'Metric' }),
|
||||
title: i18n.translate('visTypeVislib.gauge.metricTitle', { defaultMessage: 'Metric' }),
|
||||
min: 1,
|
||||
aggFilter: [
|
||||
'!std_dev',
|
||||
|
@ -134,7 +134,7 @@ export const createGaugeVisTypeDefinition = (deps: KbnVislibVisTypesDependencies
|
|||
{
|
||||
group: AggGroupNames.Buckets,
|
||||
name: 'group',
|
||||
title: i18n.translate('kbnVislibVisTypes.gauge.groupTitle', {
|
||||
title: i18n.translate('visTypeVislib.gauge.groupTitle', {
|
||||
defaultMessage: 'Split group',
|
||||
}),
|
||||
min: 0,
|
||||
|
|
|
@ -27,9 +27,9 @@ import { KbnVislibVisTypesDependencies } from './plugin';
|
|||
|
||||
export const createGoalVisTypeDefinition = (deps: KbnVislibVisTypesDependencies) => ({
|
||||
name: 'goal',
|
||||
title: i18n.translate('kbnVislibVisTypes.goal.goalTitle', { defaultMessage: 'Goal' }),
|
||||
title: i18n.translate('visTypeVislib.goal.goalTitle', { defaultMessage: 'Goal' }),
|
||||
icon: 'visGoal',
|
||||
description: i18n.translate('kbnVislibVisTypes.goal.goalDescription', {
|
||||
description: i18n.translate('visTypeVislib.goal.goalDescription', {
|
||||
defaultMessage: 'A goal chart indicates how close you are to your final goal.',
|
||||
}),
|
||||
visualization: createVislibVisController(deps),
|
||||
|
@ -80,7 +80,7 @@ export const createGoalVisTypeDefinition = (deps: KbnVislibVisTypesDependencies)
|
|||
{
|
||||
group: AggGroupNames.Metrics,
|
||||
name: 'metric',
|
||||
title: i18n.translate('kbnVislibVisTypes.goal.metricTitle', { defaultMessage: 'Metric' }),
|
||||
title: i18n.translate('visTypeVislib.goal.metricTitle', { defaultMessage: 'Metric' }),
|
||||
min: 1,
|
||||
aggFilter: [
|
||||
'!std_dev',
|
||||
|
@ -98,7 +98,7 @@ export const createGoalVisTypeDefinition = (deps: KbnVislibVisTypesDependencies)
|
|||
{
|
||||
group: AggGroupNames.Buckets,
|
||||
name: 'group',
|
||||
title: i18n.translate('kbnVislibVisTypes.goal.groupTitle', {
|
||||
title: i18n.translate('visTypeVislib.goal.groupTitle', {
|
||||
defaultMessage: 'Split group',
|
||||
}),
|
||||
min: 0,
|
||||
|
|
|
@ -41,9 +41,9 @@ export interface HeatmapVisParams extends CommonVislibParams, ColorSchemaVislibP
|
|||
|
||||
export const createHeatmapVisTypeDefinition = (deps: KbnVislibVisTypesDependencies) => ({
|
||||
name: 'heatmap',
|
||||
title: i18n.translate('kbnVislibVisTypes.heatmap.heatmapTitle', { defaultMessage: 'Heat Map' }),
|
||||
title: i18n.translate('visTypeVislib.heatmap.heatmapTitle', { defaultMessage: 'Heat Map' }),
|
||||
icon: 'visHeatmap',
|
||||
description: i18n.translate('kbnVislibVisTypes.heatmap.heatmapDescription', {
|
||||
description: i18n.translate('visTypeVislib.heatmap.heatmapDescription', {
|
||||
defaultMessage: 'Shade cells within a matrix',
|
||||
}),
|
||||
visualization: createVislibVisController(deps),
|
||||
|
@ -90,7 +90,7 @@ export const createHeatmapVisTypeDefinition = (deps: KbnVislibVisTypesDependenci
|
|||
{
|
||||
group: AggGroupNames.Metrics,
|
||||
name: 'metric',
|
||||
title: i18n.translate('kbnVislibVisTypes.heatmap.metricTitle', { defaultMessage: 'Value' }),
|
||||
title: i18n.translate('visTypeVislib.heatmap.metricTitle', { defaultMessage: 'Value' }),
|
||||
min: 1,
|
||||
max: 1,
|
||||
aggFilter: [
|
||||
|
@ -109,7 +109,7 @@ export const createHeatmapVisTypeDefinition = (deps: KbnVislibVisTypesDependenci
|
|||
{
|
||||
group: AggGroupNames.Buckets,
|
||||
name: 'segment',
|
||||
title: i18n.translate('kbnVislibVisTypes.heatmap.segmentTitle', {
|
||||
title: i18n.translate('visTypeVislib.heatmap.segmentTitle', {
|
||||
defaultMessage: 'X-axis',
|
||||
}),
|
||||
min: 0,
|
||||
|
@ -119,7 +119,7 @@ export const createHeatmapVisTypeDefinition = (deps: KbnVislibVisTypesDependenci
|
|||
{
|
||||
group: AggGroupNames.Buckets,
|
||||
name: 'group',
|
||||
title: i18n.translate('kbnVislibVisTypes.heatmap.groupTitle', { defaultMessage: 'Y-axis' }),
|
||||
title: i18n.translate('visTypeVislib.heatmap.groupTitle', { defaultMessage: 'Y-axis' }),
|
||||
min: 0,
|
||||
max: 1,
|
||||
aggFilter: ['!geohash_grid', '!geotile_grid', '!filter'],
|
||||
|
@ -127,7 +127,7 @@ export const createHeatmapVisTypeDefinition = (deps: KbnVislibVisTypesDependenci
|
|||
{
|
||||
group: AggGroupNames.Buckets,
|
||||
name: 'split',
|
||||
title: i18n.translate('kbnVislibVisTypes.heatmap.splitTitle', {
|
||||
title: i18n.translate('visTypeVislib.heatmap.splitTitle', {
|
||||
defaultMessage: 'Split chart',
|
||||
}),
|
||||
min: 0,
|
||||
|
|
|
@ -42,11 +42,11 @@ import { KbnVislibVisTypesDependencies } from './plugin';
|
|||
|
||||
export const createHistogramVisTypeDefinition = (deps: KbnVislibVisTypesDependencies) => ({
|
||||
name: 'histogram',
|
||||
title: i18n.translate('kbnVislibVisTypes.histogram.histogramTitle', {
|
||||
title: i18n.translate('visTypeVislib.histogram.histogramTitle', {
|
||||
defaultMessage: 'Vertical Bar',
|
||||
}),
|
||||
icon: 'visBarVertical',
|
||||
description: i18n.translate('kbnVislibVisTypes.histogram.histogramDescription', {
|
||||
description: i18n.translate('visTypeVislib.histogram.histogramDescription', {
|
||||
defaultMessage: 'Assign a continuous variable to each axis',
|
||||
}),
|
||||
visualization: createVislibVisController(deps),
|
||||
|
@ -139,7 +139,7 @@ export const createHistogramVisTypeDefinition = (deps: KbnVislibVisTypesDependen
|
|||
{
|
||||
group: AggGroupNames.Metrics,
|
||||
name: 'metric',
|
||||
title: i18n.translate('kbnVislibVisTypes.histogram.metricTitle', {
|
||||
title: i18n.translate('visTypeVislib.histogram.metricTitle', {
|
||||
defaultMessage: 'Y-axis',
|
||||
}),
|
||||
min: 1,
|
||||
|
@ -149,7 +149,7 @@ export const createHistogramVisTypeDefinition = (deps: KbnVislibVisTypesDependen
|
|||
{
|
||||
group: AggGroupNames.Metrics,
|
||||
name: 'radius',
|
||||
title: i18n.translate('kbnVislibVisTypes.histogram.radiusTitle', {
|
||||
title: i18n.translate('visTypeVislib.histogram.radiusTitle', {
|
||||
defaultMessage: 'Dot size',
|
||||
}),
|
||||
min: 0,
|
||||
|
@ -159,7 +159,7 @@ export const createHistogramVisTypeDefinition = (deps: KbnVislibVisTypesDependen
|
|||
{
|
||||
group: AggGroupNames.Buckets,
|
||||
name: 'segment',
|
||||
title: i18n.translate('kbnVislibVisTypes.histogram.segmentTitle', {
|
||||
title: i18n.translate('visTypeVislib.histogram.segmentTitle', {
|
||||
defaultMessage: 'X-axis',
|
||||
}),
|
||||
min: 0,
|
||||
|
@ -169,7 +169,7 @@ export const createHistogramVisTypeDefinition = (deps: KbnVislibVisTypesDependen
|
|||
{
|
||||
group: AggGroupNames.Buckets,
|
||||
name: 'group',
|
||||
title: i18n.translate('kbnVislibVisTypes.histogram.groupTitle', {
|
||||
title: i18n.translate('visTypeVislib.histogram.groupTitle', {
|
||||
defaultMessage: 'Split series',
|
||||
}),
|
||||
min: 0,
|
||||
|
@ -179,7 +179,7 @@ export const createHistogramVisTypeDefinition = (deps: KbnVislibVisTypesDependen
|
|||
{
|
||||
group: AggGroupNames.Buckets,
|
||||
name: 'split',
|
||||
title: i18n.translate('kbnVislibVisTypes.histogram.splitTitle', {
|
||||
title: i18n.translate('visTypeVislib.histogram.splitTitle', {
|
||||
defaultMessage: 'Split chart',
|
||||
}),
|
||||
min: 0,
|
||||
|
|
|
@ -42,11 +42,11 @@ import { KbnVislibVisTypesDependencies } from './plugin';
|
|||
|
||||
export const createHorizontalBarVisTypeDefinition = (deps: KbnVislibVisTypesDependencies) => ({
|
||||
name: 'horizontal_bar',
|
||||
title: i18n.translate('kbnVislibVisTypes.horizontalBar.horizontalBarTitle', {
|
||||
title: i18n.translate('visTypeVislib.horizontalBar.horizontalBarTitle', {
|
||||
defaultMessage: 'Horizontal Bar',
|
||||
}),
|
||||
icon: 'visBarHorizontal',
|
||||
description: i18n.translate('kbnVislibVisTypes.horizontalBar.horizontalBarDescription', {
|
||||
description: i18n.translate('visTypeVislib.horizontalBar.horizontalBarDescription', {
|
||||
defaultMessage: 'Assign a continuous variable to each axis',
|
||||
}),
|
||||
visualization: createVislibVisController(deps),
|
||||
|
@ -138,7 +138,7 @@ export const createHorizontalBarVisTypeDefinition = (deps: KbnVislibVisTypesDepe
|
|||
{
|
||||
group: AggGroupNames.Metrics,
|
||||
name: 'metric',
|
||||
title: i18n.translate('kbnVislibVisTypes.horizontalBar.metricTitle', {
|
||||
title: i18n.translate('visTypeVislib.horizontalBar.metricTitle', {
|
||||
defaultMessage: 'Y-axis',
|
||||
}),
|
||||
min: 1,
|
||||
|
@ -148,7 +148,7 @@ export const createHorizontalBarVisTypeDefinition = (deps: KbnVislibVisTypesDepe
|
|||
{
|
||||
group: AggGroupNames.Metrics,
|
||||
name: 'radius',
|
||||
title: i18n.translate('kbnVislibVisTypes.horizontalBar.radiusTitle', {
|
||||
title: i18n.translate('visTypeVislib.horizontalBar.radiusTitle', {
|
||||
defaultMessage: 'Dot size',
|
||||
}),
|
||||
min: 0,
|
||||
|
@ -158,7 +158,7 @@ export const createHorizontalBarVisTypeDefinition = (deps: KbnVislibVisTypesDepe
|
|||
{
|
||||
group: AggGroupNames.Buckets,
|
||||
name: 'segment',
|
||||
title: i18n.translate('kbnVislibVisTypes.horizontalBar.segmentTitle', {
|
||||
title: i18n.translate('visTypeVislib.horizontalBar.segmentTitle', {
|
||||
defaultMessage: 'X-axis',
|
||||
}),
|
||||
min: 0,
|
||||
|
@ -168,7 +168,7 @@ export const createHorizontalBarVisTypeDefinition = (deps: KbnVislibVisTypesDepe
|
|||
{
|
||||
group: AggGroupNames.Buckets,
|
||||
name: 'group',
|
||||
title: i18n.translate('kbnVislibVisTypes.horizontalBar.groupTitle', {
|
||||
title: i18n.translate('visTypeVislib.horizontalBar.groupTitle', {
|
||||
defaultMessage: 'Split series',
|
||||
}),
|
||||
min: 0,
|
||||
|
@ -178,7 +178,7 @@ export const createHorizontalBarVisTypeDefinition = (deps: KbnVislibVisTypesDepe
|
|||
{
|
||||
group: AggGroupNames.Buckets,
|
||||
name: 'split',
|
||||
title: i18n.translate('kbnVislibVisTypes.horizontalBar.splitTitle', {
|
||||
title: i18n.translate('visTypeVislib.horizontalBar.splitTitle', {
|
||||
defaultMessage: 'Split chart',
|
||||
}),
|
||||
min: 0,
|
||||
|
|
|
@ -24,4 +24,18 @@ export function plugin(initializerContext: PluginInitializerContext) {
|
|||
return new Plugin(initializerContext);
|
||||
}
|
||||
|
||||
export {
|
||||
BasicOptions,
|
||||
RangeOption,
|
||||
ColorRanges,
|
||||
SelectOption,
|
||||
SetColorSchemaOptionsValue,
|
||||
ColorSchemaOptions,
|
||||
NumberInputOption,
|
||||
SwitchOption,
|
||||
TextInputOption,
|
||||
} from './components';
|
||||
|
||||
export { ColorModes } from './utils/collections';
|
||||
|
||||
export * from './types';
|
||||
|
|
|
@ -21,16 +21,6 @@ import { npSetup, npStart } from 'ui/new_platform';
|
|||
import { PluginInitializerContext } from 'kibana/public';
|
||||
|
||||
/* eslint-disable prettier/prettier */
|
||||
import {
|
||||
initializeHierarchicalTooltipFormatter,
|
||||
getHierarchicalTooltipFormatter,
|
||||
// @ts-ignore
|
||||
} from 'ui/vis/components/tooltip/_hierarchical_tooltip_formatter';
|
||||
import {
|
||||
initializePointSeriesTooltipFormatter,
|
||||
getPointSeriesTooltipFormatter,
|
||||
// @ts-ignore
|
||||
} from 'ui/vis/components/tooltip/_pointseries_tooltip_formatter';
|
||||
import {
|
||||
vislibSeriesResponseHandlerProvider,
|
||||
vislibSlicesResponseHandlerProvider,
|
||||
|
@ -53,10 +43,6 @@ const setupPlugins: Readonly<KbnVislibVisTypesPluginSetupDependencies> = {
|
|||
expressions: npSetup.plugins.expressions,
|
||||
visualizations: visualizationsSetup,
|
||||
__LEGACY: {
|
||||
initializeHierarchicalTooltipFormatter,
|
||||
getHierarchicalTooltipFormatter,
|
||||
initializePointSeriesTooltipFormatter,
|
||||
getPointSeriesTooltipFormatter,
|
||||
vislibSeriesResponseHandlerProvider,
|
||||
vislibSlicesResponseHandlerProvider,
|
||||
vislibColor,
|
||||
|
|
|
@ -23,13 +23,10 @@ export { RangeValues, RangesParamEditor } from 'ui/vis/editors/default/controls/
|
|||
export { ColorSchema, ColorSchemas, colorSchemas, getHeatmapColors } from 'ui/color_maps';
|
||||
export { AggConfig, Vis, VisParams } from 'ui/vis';
|
||||
export { AggType } from 'ui/agg_types';
|
||||
export { CUSTOM_LEGEND_VIS_TYPES, VisLegend } from 'ui/vis/vis_types/vislib_vis_legend';
|
||||
// @ts-ignore
|
||||
export { Tooltip } from 'ui/vis/components/tooltip';
|
||||
// @ts-ignore
|
||||
export { SimpleEmitter } from 'ui/utils/simple_emitter';
|
||||
// @ts-ignore
|
||||
export { Binder } from 'ui/binder';
|
||||
export { getFormat } from 'ui/visualize/loader/pipeline_helpers/utilities';
|
||||
export { getFormat, getTableAggs } from 'ui/visualize/loader/pipeline_helpers/utilities';
|
||||
// @ts-ignore
|
||||
export { tabifyAggResponse } from 'ui/agg_response/tabify';
|
||||
|
|
|
@ -42,9 +42,9 @@ import { KbnVislibVisTypesDependencies } from './plugin';
|
|||
|
||||
export const createLineVisTypeDefinition = (deps: KbnVislibVisTypesDependencies) => ({
|
||||
name: 'line',
|
||||
title: i18n.translate('kbnVislibVisTypes.line.lineTitle', { defaultMessage: 'Line' }),
|
||||
title: i18n.translate('visTypeVislib.line.lineTitle', { defaultMessage: 'Line' }),
|
||||
icon: 'visLine',
|
||||
description: i18n.translate('kbnVislibVisTypes.line.lineDescription', {
|
||||
description: i18n.translate('visTypeVislib.line.lineDescription', {
|
||||
defaultMessage: 'Emphasize trends',
|
||||
}),
|
||||
visualization: createVislibVisController(deps),
|
||||
|
@ -136,7 +136,7 @@ export const createLineVisTypeDefinition = (deps: KbnVislibVisTypesDependencies)
|
|||
{
|
||||
group: AggGroupNames.Metrics,
|
||||
name: 'metric',
|
||||
title: i18n.translate('kbnVislibVisTypes.line.metricTitle', { defaultMessage: 'Y-axis' }),
|
||||
title: i18n.translate('visTypeVislib.line.metricTitle', { defaultMessage: 'Y-axis' }),
|
||||
min: 1,
|
||||
aggFilter: ['!geo_centroid', '!geo_bounds'],
|
||||
defaults: [{ schema: 'metric', type: 'count' }],
|
||||
|
@ -144,7 +144,7 @@ export const createLineVisTypeDefinition = (deps: KbnVislibVisTypesDependencies)
|
|||
{
|
||||
group: AggGroupNames.Metrics,
|
||||
name: 'radius',
|
||||
title: i18n.translate('kbnVislibVisTypes.line.radiusTitle', { defaultMessage: 'Dot size' }),
|
||||
title: i18n.translate('visTypeVislib.line.radiusTitle', { defaultMessage: 'Dot size' }),
|
||||
min: 0,
|
||||
max: 1,
|
||||
aggFilter: ['count', 'avg', 'sum', 'min', 'max', 'cardinality', 'top_hits'],
|
||||
|
@ -152,7 +152,7 @@ export const createLineVisTypeDefinition = (deps: KbnVislibVisTypesDependencies)
|
|||
{
|
||||
group: AggGroupNames.Buckets,
|
||||
name: 'segment',
|
||||
title: i18n.translate('kbnVislibVisTypes.line.segmentTitle', { defaultMessage: 'X-axis' }),
|
||||
title: i18n.translate('visTypeVislib.line.segmentTitle', { defaultMessage: 'X-axis' }),
|
||||
min: 0,
|
||||
max: 1,
|
||||
aggFilter: ['!geohash_grid', '!geotile_grid', '!filter'],
|
||||
|
@ -160,7 +160,7 @@ export const createLineVisTypeDefinition = (deps: KbnVislibVisTypesDependencies)
|
|||
{
|
||||
group: AggGroupNames.Buckets,
|
||||
name: 'group',
|
||||
title: i18n.translate('kbnVislibVisTypes.line.groupTitle', {
|
||||
title: i18n.translate('visTypeVislib.line.groupTitle', {
|
||||
defaultMessage: 'Split series',
|
||||
}),
|
||||
min: 0,
|
||||
|
@ -170,7 +170,7 @@ export const createLineVisTypeDefinition = (deps: KbnVislibVisTypesDependencies)
|
|||
{
|
||||
group: AggGroupNames.Buckets,
|
||||
name: 'split',
|
||||
title: i18n.translate('kbnVislibVisTypes.line.splitTitle', {
|
||||
title: i18n.translate('visTypeVislib.line.splitTitle', {
|
||||
defaultMessage: 'Split chart',
|
||||
}),
|
||||
min: 0,
|
||||
|
|
|
@ -40,9 +40,9 @@ export interface PieVisParams extends CommonVislibParams {
|
|||
|
||||
export const createPieVisTypeDefinition = (deps: KbnVislibVisTypesDependencies) => ({
|
||||
name: 'pie',
|
||||
title: i18n.translate('kbnVislibVisTypes.pie.pieTitle', { defaultMessage: 'Pie' }),
|
||||
title: i18n.translate('visTypeVislib.pie.pieTitle', { defaultMessage: 'Pie' }),
|
||||
icon: 'visPie',
|
||||
description: i18n.translate('kbnVislibVisTypes.pie.pieDescription', {
|
||||
description: i18n.translate('visTypeVislib.pie.pieDescription', {
|
||||
defaultMessage: 'Compare parts of a whole',
|
||||
}),
|
||||
visualization: createVislibVisController(deps),
|
||||
|
@ -70,7 +70,7 @@ export const createPieVisTypeDefinition = (deps: KbnVislibVisTypesDependencies)
|
|||
{
|
||||
group: AggGroupNames.Metrics,
|
||||
name: 'metric',
|
||||
title: i18n.translate('kbnVislibVisTypes.pie.metricTitle', {
|
||||
title: i18n.translate('visTypeVislib.pie.metricTitle', {
|
||||
defaultMessage: 'Slice size',
|
||||
}),
|
||||
min: 1,
|
||||
|
@ -81,7 +81,7 @@ export const createPieVisTypeDefinition = (deps: KbnVislibVisTypesDependencies)
|
|||
{
|
||||
group: AggGroupNames.Buckets,
|
||||
name: 'segment',
|
||||
title: i18n.translate('kbnVislibVisTypes.pie.segmentTitle', {
|
||||
title: i18n.translate('visTypeVislib.pie.segmentTitle', {
|
||||
defaultMessage: 'Split slices',
|
||||
}),
|
||||
min: 0,
|
||||
|
@ -91,7 +91,7 @@ export const createPieVisTypeDefinition = (deps: KbnVislibVisTypesDependencies)
|
|||
{
|
||||
group: AggGroupNames.Buckets,
|
||||
name: 'split',
|
||||
title: i18n.translate('kbnVislibVisTypes.pie.splitTitle', {
|
||||
title: i18n.translate('visTypeVislib.pie.splitTitle', {
|
||||
defaultMessage: 'Split chart',
|
||||
}),
|
||||
mustBeFirst: true,
|
||||
|
|
|
@ -53,7 +53,7 @@ export const createPieVisFn = (deps: KbnVislibVisTypesDependencies) => (): Expre
|
|||
context: {
|
||||
types: ['kibana_datatable'],
|
||||
},
|
||||
help: i18n.translate('kbnVislibVisTypes.functions.pie.help', {
|
||||
help: i18n.translate('visTypeVislib.functions.pie.help', {
|
||||
defaultMessage: 'Pie visualization',
|
||||
}),
|
||||
args: {
|
||||
|
|
|
@ -46,10 +46,6 @@ type ResponseHandlerProvider = () => {
|
|||
type KbnVislibVisTypesCoreSetup = CoreSetup<KbnVislibVisTypesPluginStartDependencies>;
|
||||
|
||||
export interface LegacyDependencies {
|
||||
initializeHierarchicalTooltipFormatter: () => Promise<void>;
|
||||
getHierarchicalTooltipFormatter: () => Promise<void>;
|
||||
initializePointSeriesTooltipFormatter: () => void;
|
||||
getPointSeriesTooltipFormatter: () => void;
|
||||
vislibSeriesResponseHandlerProvider: ResponseHandlerProvider;
|
||||
vislibSlicesResponseHandlerProvider: ResponseHandlerProvider;
|
||||
vislibColor: (colors: Array<string | number>, mappings: any) => (value: any) => any;
|
||||
|
|
|
@ -31,25 +31,25 @@ export type Positions = $Values<typeof Positions>;
|
|||
|
||||
const getPositions = () => [
|
||||
{
|
||||
text: i18n.translate('kbnVislibVisTypes.legendPositions.topText', {
|
||||
text: i18n.translate('visTypeVislib.legendPositions.topText', {
|
||||
defaultMessage: 'Top',
|
||||
}),
|
||||
value: Positions.TOP,
|
||||
},
|
||||
{
|
||||
text: i18n.translate('kbnVislibVisTypes.legendPositions.leftText', {
|
||||
text: i18n.translate('visTypeVislib.legendPositions.leftText', {
|
||||
defaultMessage: 'Left',
|
||||
}),
|
||||
value: Positions.LEFT,
|
||||
},
|
||||
{
|
||||
text: i18n.translate('kbnVislibVisTypes.legendPositions.rightText', {
|
||||
text: i18n.translate('visTypeVislib.legendPositions.rightText', {
|
||||
defaultMessage: 'Right',
|
||||
}),
|
||||
value: Positions.RIGHT,
|
||||
},
|
||||
{
|
||||
text: i18n.translate('kbnVislibVisTypes.legendPositions.bottomText', {
|
||||
text: i18n.translate('visTypeVislib.legendPositions.bottomText', {
|
||||
defaultMessage: 'Bottom',
|
||||
}),
|
||||
value: Positions.BOTTOM,
|
||||
|
@ -65,19 +65,19 @@ export type ChartTypes = $Values<typeof ChartTypes>;
|
|||
|
||||
const getChartTypes = () => [
|
||||
{
|
||||
text: i18n.translate('kbnVislibVisTypes.chartTypes.lineText', {
|
||||
text: i18n.translate('visTypeVislib.chartTypes.lineText', {
|
||||
defaultMessage: 'Line',
|
||||
}),
|
||||
value: ChartTypes.LINE,
|
||||
},
|
||||
{
|
||||
text: i18n.translate('kbnVislibVisTypes.chartTypes.areaText', {
|
||||
text: i18n.translate('visTypeVislib.chartTypes.areaText', {
|
||||
defaultMessage: 'Area',
|
||||
}),
|
||||
value: ChartTypes.AREA,
|
||||
},
|
||||
{
|
||||
text: i18n.translate('kbnVislibVisTypes.chartTypes.barText', {
|
||||
text: i18n.translate('visTypeVislib.chartTypes.barText', {
|
||||
defaultMessage: 'Bar',
|
||||
}),
|
||||
value: ChartTypes.HISTOGRAM,
|
||||
|
@ -92,13 +92,13 @@ export type ChartModes = $Values<typeof ChartModes>;
|
|||
|
||||
const getChartModes = () => [
|
||||
{
|
||||
text: i18n.translate('kbnVislibVisTypes.chartModes.normalText', {
|
||||
text: i18n.translate('visTypeVislib.chartModes.normalText', {
|
||||
defaultMessage: 'Normal',
|
||||
}),
|
||||
value: ChartModes.NORMAL,
|
||||
},
|
||||
{
|
||||
text: i18n.translate('kbnVislibVisTypes.chartModes.stackedText', {
|
||||
text: i18n.translate('visTypeVislib.chartModes.stackedText', {
|
||||
defaultMessage: 'Stacked',
|
||||
}),
|
||||
value: ChartModes.STACKED,
|
||||
|
@ -114,19 +114,19 @@ export type InterpolationModes = $Values<typeof InterpolationModes>;
|
|||
|
||||
const getInterpolationModes = () => [
|
||||
{
|
||||
text: i18n.translate('kbnVislibVisTypes.interpolationModes.straightText', {
|
||||
text: i18n.translate('visTypeVislib.interpolationModes.straightText', {
|
||||
defaultMessage: 'Straight',
|
||||
}),
|
||||
value: InterpolationModes.LINEAR,
|
||||
},
|
||||
{
|
||||
text: i18n.translate('kbnVislibVisTypes.interpolationModes.smoothedText', {
|
||||
text: i18n.translate('visTypeVislib.interpolationModes.smoothedText', {
|
||||
defaultMessage: 'Smoothed',
|
||||
}),
|
||||
value: InterpolationModes.CARDINAL,
|
||||
},
|
||||
{
|
||||
text: i18n.translate('kbnVislibVisTypes.interpolationModes.steppedText', {
|
||||
text: i18n.translate('visTypeVislib.interpolationModes.steppedText', {
|
||||
defaultMessage: 'Stepped',
|
||||
}),
|
||||
value: InterpolationModes.STEP_AFTER,
|
||||
|
@ -148,19 +148,19 @@ export type ScaleTypes = $Values<typeof ScaleTypes>;
|
|||
|
||||
const getScaleTypes = () => [
|
||||
{
|
||||
text: i18n.translate('kbnVislibVisTypes.scaleTypes.linearText', {
|
||||
text: i18n.translate('visTypeVislib.scaleTypes.linearText', {
|
||||
defaultMessage: 'Linear',
|
||||
}),
|
||||
value: ScaleTypes.LINEAR,
|
||||
},
|
||||
{
|
||||
text: i18n.translate('kbnVislibVisTypes.scaleTypes.logText', {
|
||||
text: i18n.translate('visTypeVislib.scaleTypes.logText', {
|
||||
defaultMessage: 'Log',
|
||||
}),
|
||||
value: ScaleTypes.LOG,
|
||||
},
|
||||
{
|
||||
text: i18n.translate('kbnVislibVisTypes.scaleTypes.squareRootText', {
|
||||
text: i18n.translate('visTypeVislib.scaleTypes.squareRootText', {
|
||||
defaultMessage: 'Square root',
|
||||
}),
|
||||
value: ScaleTypes.SQUARE_ROOT,
|
||||
|
@ -177,25 +177,25 @@ export type AxisModes = $Values<typeof AxisModes>;
|
|||
|
||||
const getAxisModes = () => [
|
||||
{
|
||||
text: i18n.translate('kbnVislibVisTypes.axisModes.normalText', {
|
||||
text: i18n.translate('visTypeVislib.axisModes.normalText', {
|
||||
defaultMessage: 'Normal',
|
||||
}),
|
||||
value: AxisModes.NORMAL,
|
||||
},
|
||||
{
|
||||
text: i18n.translate('kbnVislibVisTypes.axisModes.percentageText', {
|
||||
text: i18n.translate('visTypeVislib.axisModes.percentageText', {
|
||||
defaultMessage: 'Percentage',
|
||||
}),
|
||||
value: AxisModes.PERCENTAGE,
|
||||
},
|
||||
{
|
||||
text: i18n.translate('kbnVislibVisTypes.axisModes.wiggleText', {
|
||||
text: i18n.translate('visTypeVislib.axisModes.wiggleText', {
|
||||
defaultMessage: 'Wiggle',
|
||||
}),
|
||||
value: AxisModes.WIGGLE,
|
||||
},
|
||||
{
|
||||
text: i18n.translate('kbnVislibVisTypes.axisModes.silhouetteText', {
|
||||
text: i18n.translate('visTypeVislib.axisModes.silhouetteText', {
|
||||
defaultMessage: 'Silhouette',
|
||||
}),
|
||||
value: AxisModes.SILHOUETTE,
|
||||
|
@ -219,19 +219,19 @@ export type ThresholdLineStyles = $Values<typeof ThresholdLineStyles>;
|
|||
const getThresholdLineStyles = () => [
|
||||
{
|
||||
value: ThresholdLineStyles.FULL,
|
||||
text: i18n.translate('kbnVislibVisTypes.thresholdLine.style.fullText', {
|
||||
text: i18n.translate('visTypeVislib.thresholdLine.style.fullText', {
|
||||
defaultMessage: 'Full',
|
||||
}),
|
||||
},
|
||||
{
|
||||
value: ThresholdLineStyles.DASHED,
|
||||
text: i18n.translate('kbnVislibVisTypes.thresholdLine.style.dashedText', {
|
||||
text: i18n.translate('visTypeVislib.thresholdLine.style.dashedText', {
|
||||
defaultMessage: 'Dashed',
|
||||
}),
|
||||
},
|
||||
{
|
||||
value: ThresholdLineStyles.DOT_DASHED,
|
||||
text: i18n.translate('kbnVislibVisTypes.thresholdLine.style.dotdashedText', {
|
||||
text: i18n.translate('visTypeVislib.thresholdLine.style.dotdashedText', {
|
||||
defaultMessage: 'Dot-dashed',
|
||||
}),
|
||||
},
|
||||
|
@ -239,19 +239,19 @@ const getThresholdLineStyles = () => [
|
|||
|
||||
const getRotateOptions = () => [
|
||||
{
|
||||
text: i18n.translate('kbnVislibVisTypes.categoryAxis.rotate.horizontalText', {
|
||||
text: i18n.translate('visTypeVislib.categoryAxis.rotate.horizontalText', {
|
||||
defaultMessage: 'Horizontal',
|
||||
}),
|
||||
value: Rotates.HORIZONTAL,
|
||||
},
|
||||
{
|
||||
text: i18n.translate('kbnVislibVisTypes.categoryAxis.rotate.verticalText', {
|
||||
text: i18n.translate('visTypeVislib.categoryAxis.rotate.verticalText', {
|
||||
defaultMessage: 'Vertical',
|
||||
}),
|
||||
value: Rotates.VERTICAL,
|
||||
},
|
||||
{
|
||||
text: i18n.translate('kbnVislibVisTypes.categoryAxis.rotate.angledText', {
|
||||
text: i18n.translate('visTypeVislib.categoryAxis.rotate.angledText', {
|
||||
defaultMessage: 'Angled',
|
||||
}),
|
||||
value: Rotates.ANGLED,
|
||||
|
@ -273,13 +273,13 @@ export type ColorModes = $Values<typeof ColorModes>;
|
|||
|
||||
const getGaugeTypes = () => [
|
||||
{
|
||||
text: i18n.translate('kbnVislibVisTypes.gauge.gaugeTypes.arcText', {
|
||||
text: i18n.translate('visTypeVislib.gauge.gaugeTypes.arcText', {
|
||||
defaultMessage: 'Arc',
|
||||
}),
|
||||
value: GaugeTypes.ARC,
|
||||
},
|
||||
{
|
||||
text: i18n.translate('kbnVislibVisTypes.gauge.gaugeTypes.circleText', {
|
||||
text: i18n.translate('visTypeVislib.gauge.gaugeTypes.circleText', {
|
||||
defaultMessage: 'Circle',
|
||||
}),
|
||||
value: GaugeTypes.CIRCLE,
|
||||
|
@ -295,19 +295,19 @@ export type Alignments = $Values<typeof Alignments>;
|
|||
|
||||
const getAlignments = () => [
|
||||
{
|
||||
text: i18n.translate('kbnVislibVisTypes.gauge.alignmentAutomaticTitle', {
|
||||
text: i18n.translate('visTypeVislib.gauge.alignmentAutomaticTitle', {
|
||||
defaultMessage: 'Automatic',
|
||||
}),
|
||||
value: Alignments.AUTOMATIC,
|
||||
},
|
||||
{
|
||||
text: i18n.translate('kbnVislibVisTypes.gauge.alignmentHorizontalTitle', {
|
||||
text: i18n.translate('visTypeVislib.gauge.alignmentHorizontalTitle', {
|
||||
defaultMessage: 'Horizontal',
|
||||
}),
|
||||
value: Alignments.HORIZONTAL,
|
||||
},
|
||||
{
|
||||
text: i18n.translate('kbnVislibVisTypes.gauge.alignmentVerticalTitle', {
|
||||
text: i18n.translate('visTypeVislib.gauge.alignmentVerticalTitle', {
|
||||
defaultMessage: 'Vertical',
|
||||
}),
|
||||
value: Alignments.VERTICAL,
|
||||
|
|
|
@ -29,7 +29,7 @@ function getAreaOptionTabs() {
|
|||
return [
|
||||
{
|
||||
name: 'advanced',
|
||||
title: i18n.translate('kbnVislibVisTypes.area.tabs.metricsAxesTitle', {
|
||||
title: i18n.translate('visTypeVislib.area.tabs.metricsAxesTitle', {
|
||||
defaultMessage: 'Metrics & axes',
|
||||
}),
|
||||
editor: (props: VisOptionsProps<BasicVislibParams>) => (
|
||||
|
@ -38,7 +38,7 @@ function getAreaOptionTabs() {
|
|||
},
|
||||
{
|
||||
name: 'options',
|
||||
title: i18n.translate('kbnVislibVisTypes.area.tabs.panelSettingsTitle', {
|
||||
title: i18n.translate('visTypeVislib.area.tabs.panelSettingsTitle', {
|
||||
defaultMessage: 'Panel settings',
|
||||
}),
|
||||
editor: (props: VisOptionsProps<BasicVislibParams>) => (
|
||||
|
@ -48,7 +48,7 @@ function getAreaOptionTabs() {
|
|||
];
|
||||
}
|
||||
|
||||
const countLabel = i18n.translate('kbnVislibVisTypes.area.countText', {
|
||||
const countLabel = i18n.translate('visTypeVislib.area.countText', {
|
||||
defaultMessage: 'Count',
|
||||
});
|
||||
|
||||
|
|
|
@ -20,12 +20,13 @@
|
|||
import $ from 'jquery';
|
||||
import React, { RefObject } from 'react';
|
||||
|
||||
import { CUSTOM_LEGEND_VIS_TYPES, VisLegend, Vis, VisParams } from './legacy_imports';
|
||||
import { Vis, VisParams } from './legacy_imports';
|
||||
// @ts-ignore
|
||||
import { Vis as Vislib } from './vislib/vis';
|
||||
import { Positions } from './utils/collections';
|
||||
import { KbnVislibVisTypesDependencies } from './plugin';
|
||||
import { mountReactNode } from '../../../../core/public/utils';
|
||||
import { VisLegend, CUSTOM_LEGEND_VIS_TYPES } from './vislib/components/legend';
|
||||
|
||||
const legendClassName = {
|
||||
top: 'visLib--legend-top',
|
||||
|
@ -76,9 +77,6 @@ export const createVislibVisController = (deps: KbnVislibVisTypesDependencies) =
|
|||
return resolve();
|
||||
}
|
||||
|
||||
await deps.initializeHierarchicalTooltipFormatter();
|
||||
await deps.initializePointSeriesTooltipFormatter();
|
||||
|
||||
this.vislibVis = new Vislib(this.chartEl, visParams, deps);
|
||||
this.vislibVis.on('brush', this.vis.API.events.brush);
|
||||
this.vislibVis.on('click', this.vis.API.events.filter);
|
||||
|
|
|
@ -52,7 +52,7 @@ export const createKbnVislibVisTypesFn = (
|
|||
context: {
|
||||
types: ['kibana_datatable'],
|
||||
},
|
||||
help: i18n.translate('kbnVislibVisTypes.functions.vislib.help', {
|
||||
help: i18n.translate('visTypeVislib.functions.vislib.help', {
|
||||
defaultMessage: 'Vislib visualization',
|
||||
}),
|
||||
args: {
|
||||
|
|
|
@ -20,18 +20,11 @@
|
|||
import _ from 'lodash';
|
||||
import $ from 'jquery';
|
||||
import expect from '@kbn/expect';
|
||||
import ngMock from 'ng_mock';
|
||||
import { PointSeriesTooltipFormatterProvider } from '../_pointseries_tooltip_formatter';
|
||||
|
||||
import { pointSeriesTooltipFormatter } from '../../components/tooltip';
|
||||
|
||||
describe('tooltipFormatter', function() {
|
||||
let tooltipFormatter;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(
|
||||
ngMock.inject(function(Private) {
|
||||
tooltipFormatter = Private(PointSeriesTooltipFormatterProvider)();
|
||||
})
|
||||
);
|
||||
const tooltipFormatter = pointSeriesTooltipFormatter();
|
||||
|
||||
function cell($row, i) {
|
||||
return $row
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import ngMock from 'ng_mock';
|
||||
|
||||
import { getHeatmapColors } from '../../../legacy_imports';
|
||||
|
||||
|
@ -27,8 +26,6 @@ describe('Vislib Heatmap Color Module Test Suite', function() {
|
|||
const nullValue = null;
|
||||
let notAValue;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
|
||||
it('should throw an error if schema is invalid', function() {
|
||||
expect(function() {
|
||||
getHeatmapColors(4, 'invalid schema');
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import _ from 'lodash';
|
||||
import expect from '@kbn/expect';
|
||||
import ngMock from 'ng_mock';
|
||||
|
||||
import { labels } from '../../components/labels/labels';
|
||||
import { dataArray } from '../../components/labels/data_array';
|
||||
import { uniqLabels } from '../../components/labels/uniq_labels';
|
||||
|
@ -161,21 +161,18 @@ const columnsData = {
|
|||
describe('Vislib Labels Module Test Suite', function() {
|
||||
let uniqSeriesLabels;
|
||||
describe('Labels (main)', function() {
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(
|
||||
ngMock.inject(function() {
|
||||
seriesLabels = labels(seriesData);
|
||||
rowsLabels = labels(rowsData);
|
||||
seriesArr = Array.isArray(seriesLabels);
|
||||
rowsArr = Array.isArray(rowsLabels);
|
||||
uniqSeriesLabels = _.chain(rowsData.rows)
|
||||
.pluck('series')
|
||||
.flattenDeep()
|
||||
.pluck('label')
|
||||
.uniq()
|
||||
.value();
|
||||
})
|
||||
);
|
||||
beforeEach(() => {
|
||||
seriesLabels = labels(seriesData);
|
||||
rowsLabels = labels(rowsData);
|
||||
seriesArr = Array.isArray(seriesLabels);
|
||||
rowsArr = Array.isArray(rowsLabels);
|
||||
uniqSeriesLabels = _.chain(rowsData.rows)
|
||||
.pluck('series')
|
||||
.flattenDeep()
|
||||
.pluck('label')
|
||||
.uniq()
|
||||
.value();
|
||||
});
|
||||
|
||||
it('should be a function', function() {
|
||||
expect(typeof labels).to.be('function');
|
||||
|
@ -224,15 +221,12 @@ describe('Vislib Labels Module Test Suite', function() {
|
|||
let testSeries;
|
||||
let testRows;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(
|
||||
ngMock.inject(function() {
|
||||
seriesLabels = dataArray(seriesData);
|
||||
rowsLabels = dataArray(rowsData);
|
||||
testSeries = Array.isArray(seriesLabels);
|
||||
testRows = Array.isArray(rowsLabels);
|
||||
})
|
||||
);
|
||||
beforeEach(() => {
|
||||
seriesLabels = dataArray(seriesData);
|
||||
rowsLabels = dataArray(rowsData);
|
||||
testSeries = Array.isArray(seriesLabels);
|
||||
testRows = Array.isArray(rowsLabels);
|
||||
});
|
||||
|
||||
it('should throw an error if the input is not an object', function() {
|
||||
expect(function() {
|
||||
|
@ -333,15 +327,12 @@ describe('Vislib Labels Module Test Suite', function() {
|
|||
let uniq;
|
||||
let testArr;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(
|
||||
ngMock.inject(function() {
|
||||
uniq = uniqLabels(arrObj, function(d) {
|
||||
return d;
|
||||
});
|
||||
testArr = Array.isArray(uniq);
|
||||
})
|
||||
);
|
||||
beforeEach(() => {
|
||||
uniq = uniqLabels(arrObj, function(d) {
|
||||
return d;
|
||||
});
|
||||
testArr = Array.isArray(uniq);
|
||||
});
|
||||
|
||||
it('should throw an error if input is not an array', function() {
|
||||
expect(function() {
|
||||
|
@ -407,15 +398,12 @@ describe('Vislib Labels Module Test Suite', function() {
|
|||
let columnsArr;
|
||||
let rowsArr;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(
|
||||
ngMock.inject(function() {
|
||||
columnsLabels = getSeries(columnsData);
|
||||
rowsLabels = getSeries(rowsData);
|
||||
columnsArr = Array.isArray(columnsLabels);
|
||||
rowsArr = Array.isArray(rowsLabels);
|
||||
})
|
||||
);
|
||||
beforeEach(() => {
|
||||
columnsLabels = getSeries(columnsData);
|
||||
rowsLabels = getSeries(rowsData);
|
||||
columnsArr = Array.isArray(columnsLabels);
|
||||
rowsArr = Array.isArray(rowsLabels);
|
||||
});
|
||||
|
||||
it('should throw an error if input is not an object', function() {
|
||||
expect(function() {
|
||||
|
|
|
@ -21,7 +21,8 @@ import expect from '@kbn/expect';
|
|||
import $ from 'jquery';
|
||||
import _ from 'lodash';
|
||||
import sinon from 'sinon';
|
||||
import { positionTooltip } from '../position_tooltip';
|
||||
|
||||
import { positionTooltip } from '../../components/tooltip/position_tooltip';
|
||||
|
||||
describe('Tooltip Positioning', function() {
|
||||
const sandbox = sinon.createSandbox();
|
|
@ -19,18 +19,15 @@
|
|||
|
||||
import _ from 'lodash';
|
||||
import expect from '@kbn/expect';
|
||||
import ngMock from 'ng_mock';
|
||||
|
||||
import VislibProvider from '..';
|
||||
|
||||
describe('Vislib Index Test Suite', function() {
|
||||
let vislib;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(
|
||||
ngMock.inject(function(Private) {
|
||||
vislib = Private(VislibProvider);
|
||||
})
|
||||
);
|
||||
beforeEach(() => {
|
||||
vislib = new VislibProvider();
|
||||
});
|
||||
|
||||
it('should return an object', function() {
|
||||
expect(_.isObject(vislib)).to.be(true);
|
||||
|
|
|
@ -19,17 +19,15 @@
|
|||
|
||||
import d3 from 'd3';
|
||||
import _ from 'lodash';
|
||||
import ngMock from 'ng_mock';
|
||||
import 'ui/persisted_state';
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import $ from 'jquery';
|
||||
|
||||
import { Axis } from '../../../lib/axis';
|
||||
import { VisConfig } from '../../../lib/vis_config';
|
||||
import { getMockUiState } from '../fixtures/_vis_fixture';
|
||||
|
||||
describe('Vislib Axis Class Test Suite', function() {
|
||||
let persistedState;
|
||||
let mockUiState;
|
||||
let yAxis;
|
||||
let el;
|
||||
let fixture;
|
||||
|
@ -102,38 +100,34 @@ describe('Vislib Axis Class Test Suite', function() {
|
|||
yAxisLabel: 'Count',
|
||||
};
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(
|
||||
ngMock.inject(function($injector) {
|
||||
persistedState = new ($injector.get('PersistedState'))();
|
||||
beforeEach(() => {
|
||||
mockUiState = getMockUiState();
|
||||
el = d3
|
||||
.select('body')
|
||||
.append('div')
|
||||
.attr('class', 'visAxis--x')
|
||||
.style('height', '40px');
|
||||
|
||||
el = d3
|
||||
.select('body')
|
||||
.append('div')
|
||||
.attr('class', 'visAxis--x')
|
||||
.style('height', '40px');
|
||||
fixture = el.append('div').attr('class', 'x-axis-div');
|
||||
|
||||
fixture = el.append('div').attr('class', 'x-axis-div');
|
||||
const visConfig = new VisConfig(
|
||||
{
|
||||
type: 'histogram',
|
||||
},
|
||||
data,
|
||||
mockUiState,
|
||||
$('.x-axis-div')[0],
|
||||
() => undefined
|
||||
);
|
||||
yAxis = new Axis(visConfig, {
|
||||
type: 'value',
|
||||
id: 'ValueAxis-1',
|
||||
});
|
||||
|
||||
const visConfig = new VisConfig(
|
||||
{
|
||||
type: 'histogram',
|
||||
},
|
||||
data,
|
||||
persistedState,
|
||||
$('.x-axis-div')[0],
|
||||
() => undefined
|
||||
);
|
||||
yAxis = new Axis(visConfig, {
|
||||
type: 'value',
|
||||
id: 'ValueAxis-1',
|
||||
});
|
||||
|
||||
seriesData = data.series.map(series => {
|
||||
return series.values;
|
||||
});
|
||||
})
|
||||
);
|
||||
seriesData = data.series.map(series => {
|
||||
return series.values;
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
fixture.remove();
|
||||
|
|
|
@ -20,18 +20,15 @@
|
|||
import d3 from 'd3';
|
||||
import _ from 'lodash';
|
||||
import $ from 'jquery';
|
||||
import ngMock from 'ng_mock';
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import 'ui/persisted_state';
|
||||
|
||||
import { AxisTitle } from '../../lib/axis/axis_title';
|
||||
import { AxisConfig } from '../../lib/axis/axis_config';
|
||||
import { VisConfig } from '../../lib/vis_config';
|
||||
import { Data } from '../../lib/data';
|
||||
import { getMockUiState } from './fixtures/_vis_fixture';
|
||||
|
||||
describe('Vislib AxisTitle Class Test Suite', function() {
|
||||
let PersistedState;
|
||||
let el;
|
||||
let dataObj;
|
||||
let xTitle;
|
||||
|
@ -96,56 +93,53 @@ describe('Vislib AxisTitle Class Test Suite', function() {
|
|||
yAxisLabel: 'Count',
|
||||
};
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(
|
||||
ngMock.inject(function($injector) {
|
||||
PersistedState = $injector.get('PersistedState');
|
||||
beforeEach(() => {
|
||||
el = d3
|
||||
.select('body')
|
||||
.append('div')
|
||||
.attr('class', 'visWrapper');
|
||||
|
||||
el = d3
|
||||
.select('body')
|
||||
.append('div')
|
||||
.attr('class', 'visWrapper');
|
||||
el.append('div')
|
||||
.attr('class', 'visAxis__column--bottom')
|
||||
.append('div')
|
||||
.attr('class', 'axis-title y-axis-title')
|
||||
.style('height', '20px')
|
||||
.style('width', '20px');
|
||||
|
||||
el.append('div')
|
||||
.attr('class', 'visAxis__column--bottom')
|
||||
.append('div')
|
||||
.attr('class', 'axis-title y-axis-title')
|
||||
.style('height', '20px')
|
||||
.style('width', '20px');
|
||||
el.append('div')
|
||||
.attr('class', 'visAxis__column--left')
|
||||
.append('div')
|
||||
.attr('class', 'axis-title x-axis-title')
|
||||
.style('height', '20px')
|
||||
.style('width', '20px');
|
||||
|
||||
el.append('div')
|
||||
.attr('class', 'visAxis__column--left')
|
||||
.append('div')
|
||||
.attr('class', 'axis-title x-axis-title')
|
||||
.style('height', '20px')
|
||||
.style('width', '20px');
|
||||
|
||||
dataObj = new Data(data, new PersistedState(), () => undefined);
|
||||
visConfig = new VisConfig(
|
||||
{
|
||||
type: 'histogram',
|
||||
},
|
||||
data,
|
||||
new PersistedState(),
|
||||
el.node(),
|
||||
() => undefined
|
||||
);
|
||||
const xAxisConfig = new AxisConfig(visConfig, {
|
||||
position: 'bottom',
|
||||
title: {
|
||||
text: dataObj.get('xAxisLabel'),
|
||||
},
|
||||
});
|
||||
const yAxisConfig = new AxisConfig(visConfig, {
|
||||
position: 'left',
|
||||
title: {
|
||||
text: dataObj.get('yAxisLabel'),
|
||||
},
|
||||
});
|
||||
xTitle = new AxisTitle(xAxisConfig);
|
||||
yTitle = new AxisTitle(yAxisConfig);
|
||||
})
|
||||
);
|
||||
const uiState = getMockUiState();
|
||||
uiState.set('vis.colors', []);
|
||||
dataObj = new Data(data, getMockUiState(), () => undefined);
|
||||
visConfig = new VisConfig(
|
||||
{
|
||||
type: 'histogram',
|
||||
},
|
||||
data,
|
||||
getMockUiState(),
|
||||
el.node(),
|
||||
() => undefined
|
||||
);
|
||||
const xAxisConfig = new AxisConfig(visConfig, {
|
||||
position: 'bottom',
|
||||
title: {
|
||||
text: dataObj.get('xAxisLabel'),
|
||||
},
|
||||
});
|
||||
const yAxisConfig = new AxisConfig(visConfig, {
|
||||
position: 'left',
|
||||
title: {
|
||||
text: dataObj.get('yAxisLabel'),
|
||||
},
|
||||
});
|
||||
xTitle = new AxisTitle(xAxisConfig);
|
||||
yTitle = new AxisTitle(yAxisConfig);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
el.remove();
|
||||
|
|
|
@ -19,14 +19,14 @@
|
|||
|
||||
import d3 from 'd3';
|
||||
import _ from 'lodash';
|
||||
import ngMock from 'ng_mock';
|
||||
import expect from '@kbn/expect';
|
||||
|
||||
import { ChartTitle } from '../../lib/chart_title';
|
||||
import { VisConfig } from '../../lib/vis_config';
|
||||
import { getMockUiState } from './fixtures/_vis_fixture';
|
||||
|
||||
describe('Vislib ChartTitle Class Test Suite', function() {
|
||||
let persistedState;
|
||||
let mockUiState;
|
||||
let chartTitle;
|
||||
let el;
|
||||
const data = {
|
||||
|
@ -88,36 +88,32 @@ describe('Vislib ChartTitle Class Test Suite', function() {
|
|||
yAxisLabel: 'Count',
|
||||
};
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(
|
||||
ngMock.inject(function($injector) {
|
||||
persistedState = new ($injector.get('PersistedState'))();
|
||||
beforeEach(() => {
|
||||
mockUiState = getMockUiState();
|
||||
el = d3
|
||||
.select('body')
|
||||
.append('div')
|
||||
.attr('class', 'visWrapper')
|
||||
.datum(data);
|
||||
|
||||
el = d3
|
||||
.select('body')
|
||||
.append('div')
|
||||
.attr('class', 'visWrapper')
|
||||
.datum(data);
|
||||
el.append('div')
|
||||
.attr('class', 'chart-title')
|
||||
.style('height', '20px');
|
||||
|
||||
el.append('div')
|
||||
.attr('class', 'chart-title')
|
||||
.style('height', '20px');
|
||||
|
||||
const visConfig = new VisConfig(
|
||||
{
|
||||
type: 'histogram',
|
||||
title: {
|
||||
text: 'rows',
|
||||
},
|
||||
const visConfig = new VisConfig(
|
||||
{
|
||||
type: 'histogram',
|
||||
title: {
|
||||
text: 'rows',
|
||||
},
|
||||
data,
|
||||
persistedState,
|
||||
el.node(),
|
||||
() => undefined
|
||||
);
|
||||
chartTitle = new ChartTitle(visConfig);
|
||||
})
|
||||
);
|
||||
},
|
||||
data,
|
||||
mockUiState,
|
||||
el.node(),
|
||||
() => undefined
|
||||
);
|
||||
chartTitle = new ChartTitle(visConfig);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
el.remove();
|
||||
|
|
|
@ -18,11 +18,10 @@
|
|||
*/
|
||||
|
||||
import _ from 'lodash';
|
||||
import ngMock from 'ng_mock';
|
||||
import expect from '@kbn/expect';
|
||||
import 'ui/persisted_state';
|
||||
|
||||
import { Data } from '../../lib/data';
|
||||
import { getMockUiState } from './fixtures/_vis_fixture';
|
||||
|
||||
const seriesData = {
|
||||
label: '',
|
||||
|
@ -153,14 +152,11 @@ const colsData = {
|
|||
};
|
||||
|
||||
describe('Vislib Data Class Test Suite', function() {
|
||||
let persistedState;
|
||||
let mockUiState;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(
|
||||
ngMock.inject(function($injector) {
|
||||
persistedState = new ($injector.get('PersistedState'))();
|
||||
})
|
||||
);
|
||||
beforeEach(() => {
|
||||
mockUiState = getMockUiState();
|
||||
});
|
||||
|
||||
describe('Data Class (main)', function() {
|
||||
it('should be a function', function() {
|
||||
|
@ -168,7 +164,7 @@ describe('Vislib Data Class Test Suite', function() {
|
|||
});
|
||||
|
||||
it('should return an object', function() {
|
||||
const rowIn = new Data(rowsData, persistedState, () => undefined);
|
||||
const rowIn = new Data(rowsData, mockUiState, () => undefined);
|
||||
expect(_.isObject(rowIn)).to.be(true);
|
||||
});
|
||||
});
|
||||
|
@ -182,7 +178,7 @@ describe('Vislib Data Class Test Suite', function() {
|
|||
};
|
||||
|
||||
beforeEach(function() {
|
||||
data = new Data(pieData, persistedState, () => undefined);
|
||||
data = new Data(pieData, mockUiState, () => undefined);
|
||||
});
|
||||
|
||||
it('should remove zero values', function() {
|
||||
|
@ -196,7 +192,7 @@ describe('Vislib Data Class Test Suite', function() {
|
|||
let serOut;
|
||||
|
||||
beforeEach(function() {
|
||||
serIn = new Data(seriesData, persistedState, () => undefined);
|
||||
serIn = new Data(seriesData, mockUiState, () => undefined);
|
||||
serOut = serIn.flatten();
|
||||
});
|
||||
|
||||
|
@ -210,7 +206,7 @@ describe('Vislib Data Class Test Suite', function() {
|
|||
|
||||
function testLength(inputData) {
|
||||
return function() {
|
||||
const data = new Data(inputData, persistedState, () => undefined);
|
||||
const data = new Data(inputData, mockUiState, () => undefined);
|
||||
const len = _.reduce(
|
||||
data.chartData(),
|
||||
function(sum, chart) {
|
||||
|
@ -266,7 +262,7 @@ describe('Vislib Data Class Test Suite', function() {
|
|||
};
|
||||
|
||||
beforeEach(function() {
|
||||
data = new Data(geohashGridData, persistedState, () => undefined);
|
||||
data = new Data(geohashGridData, mockUiState, () => undefined);
|
||||
});
|
||||
|
||||
describe('getVisData', function() {
|
||||
|
@ -287,7 +283,7 @@ describe('Vislib Data Class Test Suite', function() {
|
|||
|
||||
describe('null value check', function() {
|
||||
it('should return false', function() {
|
||||
const data = new Data(rowsData, persistedState, () => undefined);
|
||||
const data = new Data(rowsData, mockUiState, () => undefined);
|
||||
expect(data.hasNullValues()).to.be(false);
|
||||
});
|
||||
|
||||
|
@ -307,7 +303,7 @@ describe('Vislib Data Class Test Suite', function() {
|
|||
],
|
||||
});
|
||||
|
||||
const data = new Data(nullRowData, persistedState, () => undefined);
|
||||
const data = new Data(nullRowData, mockUiState, () => undefined);
|
||||
expect(data.hasNullValues()).to.be(true);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -19,14 +19,12 @@
|
|||
|
||||
import _ from 'lodash';
|
||||
import d3 from 'd3';
|
||||
import ngMock from 'ng_mock';
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import 'ui/persisted_state';
|
||||
|
||||
// Data
|
||||
import data from './fixtures/mock_data/date_histogram/_series';
|
||||
import getFixturesVislibVisFixtureProvider from './fixtures/_vis_fixture';
|
||||
|
||||
import { getVis, getMockUiState } from './fixtures/_vis_fixture';
|
||||
import { SimpleEmitter } from '../../../legacy_imports';
|
||||
|
||||
describe('Vislib Dispatch Class Test Suite', function() {
|
||||
|
@ -44,17 +42,13 @@ describe('Vislib Dispatch Class Test Suite', function() {
|
|||
|
||||
describe('', function() {
|
||||
let vis;
|
||||
let persistedState;
|
||||
let mockUiState;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(
|
||||
ngMock.inject(function(Private, $injector) {
|
||||
const getVis = getFixturesVislibVisFixtureProvider(Private);
|
||||
vis = getVis();
|
||||
persistedState = new ($injector.get('PersistedState'))();
|
||||
vis.render(data, persistedState);
|
||||
})
|
||||
);
|
||||
beforeEach(() => {
|
||||
vis = getVis();
|
||||
mockUiState = getMockUiState();
|
||||
vis.render(data, mockUiState);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
destroyVis(vis);
|
||||
|
@ -71,18 +65,14 @@ describe('Vislib Dispatch Class Test Suite', function() {
|
|||
|
||||
describe('Stock event handlers', function() {
|
||||
let vis;
|
||||
let persistedState;
|
||||
let mockUiState;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(
|
||||
ngMock.inject(function(Private, $injector) {
|
||||
const getVis = getFixturesVislibVisFixtureProvider(Private);
|
||||
persistedState = new ($injector.get('PersistedState'))();
|
||||
vis = getVis();
|
||||
vis.on('brush', _.noop);
|
||||
vis.render(data, persistedState);
|
||||
})
|
||||
);
|
||||
beforeEach(() => {
|
||||
mockUiState = getMockUiState();
|
||||
vis = getVis();
|
||||
vis.on('brush', _.noop);
|
||||
vis.render(data, mockUiState);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
destroyVis(vis);
|
||||
|
@ -187,42 +177,30 @@ describe('Vislib Dispatch Class Test Suite', function() {
|
|||
|
||||
describe('Custom event handlers', function() {
|
||||
it('should attach whatever gets passed on vis.on() to chart.events', function(done) {
|
||||
let vis;
|
||||
let persistedState;
|
||||
ngMock.module('kibana');
|
||||
ngMock.inject(function(Private, $injector) {
|
||||
const getVis = getFixturesVislibVisFixtureProvider(Private);
|
||||
vis = getVis();
|
||||
persistedState = new ($injector.get('PersistedState'))();
|
||||
vis.on('someEvent', _.noop);
|
||||
vis.render(data, persistedState);
|
||||
const vis = getVis();
|
||||
const mockUiState = getMockUiState();
|
||||
vis.on('someEvent', _.noop);
|
||||
vis.render(data, mockUiState);
|
||||
|
||||
vis.handler.charts.forEach(function(chart) {
|
||||
expect(chart.events.listenerCount('someEvent')).to.be(1);
|
||||
});
|
||||
|
||||
destroyVis(vis);
|
||||
done();
|
||||
vis.handler.charts.forEach(function(chart) {
|
||||
expect(chart.events.listenerCount('someEvent')).to.be(1);
|
||||
});
|
||||
|
||||
destroyVis(vis);
|
||||
done();
|
||||
});
|
||||
|
||||
it('can be added after rendering', function() {
|
||||
let vis;
|
||||
let persistedState;
|
||||
ngMock.module('kibana');
|
||||
ngMock.inject(function(Private, $injector) {
|
||||
const getVis = getFixturesVislibVisFixtureProvider(Private);
|
||||
vis = getVis();
|
||||
persistedState = new ($injector.get('PersistedState'))();
|
||||
vis.render(data, persistedState);
|
||||
vis.on('someEvent', _.noop);
|
||||
const vis = getVis();
|
||||
const mockUiState = getMockUiState();
|
||||
vis.render(data, mockUiState);
|
||||
vis.on('someEvent', _.noop);
|
||||
|
||||
vis.handler.charts.forEach(function(chart) {
|
||||
expect(chart.events.listenerCount('someEvent')).to.be(1);
|
||||
});
|
||||
|
||||
destroyVis(vis);
|
||||
vis.handler.charts.forEach(function(chart) {
|
||||
expect(chart.events.listenerCount('someEvent')).to.be(1);
|
||||
});
|
||||
|
||||
destroyVis(vis);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -18,18 +18,15 @@
|
|||
*/
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import ngMock from 'ng_mock';
|
||||
|
||||
import { ErrorHandler } from '../../lib/_error_handler';
|
||||
|
||||
describe('Vislib ErrorHandler Test Suite', function() {
|
||||
let errorHandler;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(
|
||||
ngMock.inject(function() {
|
||||
errorHandler = new ErrorHandler();
|
||||
})
|
||||
);
|
||||
beforeEach(() => {
|
||||
errorHandler = new ErrorHandler();
|
||||
});
|
||||
|
||||
describe('validateWidthandHeight Method', function() {
|
||||
it('should throw an error when width and/or height is 0', function() {
|
||||
|
|
|
@ -22,15 +22,6 @@ import $ from 'jquery';
|
|||
|
||||
import { Vis } from '../../../vis';
|
||||
|
||||
// TODO: remove legacy imports when/of converting tests to jest
|
||||
import {
|
||||
setHierarchicalTooltipFormatter,
|
||||
getHierarchicalTooltipFormatter,
|
||||
} from 'ui/vis/components/tooltip/_hierarchical_tooltip_formatter';
|
||||
import {
|
||||
setPointSeriesTooltipFormatter,
|
||||
getPointSeriesTooltipFormatter,
|
||||
} from 'ui/vis/components/tooltip/_pointseries_tooltip_formatter';
|
||||
import {
|
||||
vislibSeriesResponseHandlerProvider,
|
||||
vislibSlicesResponseHandlerProvider,
|
||||
|
@ -73,29 +64,33 @@ const getDeps = () => {
|
|||
return {
|
||||
uiSettings,
|
||||
vislibColor,
|
||||
getHierarchicalTooltipFormatter,
|
||||
getPointSeriesTooltipFormatter,
|
||||
vislibSeriesResponseHandlerProvider,
|
||||
vislibSlicesResponseHandlerProvider,
|
||||
};
|
||||
};
|
||||
|
||||
export default function getVislibFixtures(Private) {
|
||||
setHierarchicalTooltipFormatter(Private);
|
||||
setPointSeriesTooltipFormatter(Private);
|
||||
export const getMockUiState = () => {
|
||||
const map = new Map();
|
||||
|
||||
return function(visLibParams, element) {
|
||||
return new Vis(
|
||||
element || $visCanvas.new(),
|
||||
_.defaults({}, visLibParams || {}, {
|
||||
addTooltip: true,
|
||||
addLegend: true,
|
||||
defaultYExtents: false,
|
||||
setYExtents: false,
|
||||
yAxis: {},
|
||||
type: 'histogram',
|
||||
}),
|
||||
getDeps()
|
||||
);
|
||||
};
|
||||
return (() => ({
|
||||
get: (...args) => map.get(...args),
|
||||
set: (...args) => map.set(...args),
|
||||
setSilent: (...args) => map.set(...args),
|
||||
on: () => undefined,
|
||||
}))();
|
||||
};
|
||||
|
||||
export function getVis(visLibParams, element) {
|
||||
return new Vis(
|
||||
element || $visCanvas.new(),
|
||||
_.defaults({}, visLibParams || {}, {
|
||||
addTooltip: true,
|
||||
addLegend: true,
|
||||
defaultYExtents: false,
|
||||
setYExtents: false,
|
||||
yAxis: {},
|
||||
type: 'histogram',
|
||||
}),
|
||||
getDeps()
|
||||
);
|
||||
}
|
||||
|
|
|
@ -17,36 +17,29 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import ngMock from 'ng_mock';
|
||||
import expect from '@kbn/expect';
|
||||
import $ from 'jquery';
|
||||
|
||||
// Data
|
||||
import series from '../fixtures/mock_data/date_histogram/_series';
|
||||
import columns from '../fixtures/mock_data/date_histogram/_columns';
|
||||
import rows from '../fixtures/mock_data/date_histogram/_rows';
|
||||
import stackedSeries from '../fixtures/mock_data/date_histogram/_stacked_series';
|
||||
import $ from 'jquery';
|
||||
import 'ui/persisted_state';
|
||||
|
||||
import getFixturesVislibVisFixtureProvider from '../fixtures/_vis_fixture';
|
||||
import { getVis, getMockUiState } from '../fixtures/_vis_fixture';
|
||||
|
||||
const dateHistogramArray = [series, columns, rows, stackedSeries];
|
||||
const names = ['series', 'columns', 'rows', 'stackedSeries'];
|
||||
|
||||
dateHistogramArray.forEach(function(data, i) {
|
||||
describe('Vislib Handler Test Suite for ' + names[i] + ' Data', function() {
|
||||
let vis;
|
||||
let persistedState;
|
||||
const events = ['click', 'brush'];
|
||||
let vis;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(
|
||||
ngMock.inject(function(Private, $injector) {
|
||||
const getVis = getFixturesVislibVisFixtureProvider(Private);
|
||||
vis = getVis();
|
||||
persistedState = new ($injector.get('PersistedState'))();
|
||||
vis.render(data, persistedState);
|
||||
})
|
||||
);
|
||||
beforeEach(() => {
|
||||
vis = getVis();
|
||||
vis.render(data, getMockUiState());
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
vis.destroy();
|
||||
|
@ -107,9 +100,7 @@ dateHistogramArray.forEach(function(data, i) {
|
|||
|
||||
describe('removeAll Method', function() {
|
||||
beforeEach(function() {
|
||||
ngMock.inject(function() {
|
||||
vis.handler.removeAll(vis.element);
|
||||
});
|
||||
vis.handler.removeAll(vis.element);
|
||||
});
|
||||
|
||||
it('should remove all DOM elements from the el', function() {
|
||||
|
|
|
@ -18,18 +18,17 @@
|
|||
*/
|
||||
|
||||
import d3 from 'd3';
|
||||
import ngMock from 'ng_mock';
|
||||
import expect from '@kbn/expect';
|
||||
import 'ui/persisted_state';
|
||||
import $ from 'jquery';
|
||||
|
||||
// Data
|
||||
import series from '../fixtures/mock_data/date_histogram/_series';
|
||||
import columns from '../fixtures/mock_data/date_histogram/_columns';
|
||||
import rows from '../fixtures/mock_data/date_histogram/_rows';
|
||||
import stackedSeries from '../fixtures/mock_data/date_histogram/_stacked_series';
|
||||
import $ from 'jquery';
|
||||
|
||||
import { Layout } from '../../../lib/layout/layout';
|
||||
import getFixturesVislibVisFixtureProvider from '../fixtures/_vis_fixture';
|
||||
import { getVis, getMockUiState } from '../fixtures/_vis_fixture';
|
||||
import { VisConfig } from '../../../lib/vis_config';
|
||||
|
||||
const dateHistogramArray = [series, columns, rows, stackedSeries];
|
||||
|
@ -38,23 +37,18 @@ const names = ['series', 'columns', 'rows', 'stackedSeries'];
|
|||
dateHistogramArray.forEach(function(data, i) {
|
||||
describe('Vislib Layout Class Test Suite for ' + names[i] + ' Data', function() {
|
||||
let vis;
|
||||
let persistedState;
|
||||
let mockUiState;
|
||||
let numberOfCharts;
|
||||
let testLayout;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
|
||||
beforeEach(function() {
|
||||
ngMock.inject(function(Private, $injector) {
|
||||
const getVis = getFixturesVislibVisFixtureProvider(Private);
|
||||
vis = getVis();
|
||||
persistedState = new ($injector.get('PersistedState'))();
|
||||
vis.render(data, persistedState);
|
||||
numberOfCharts = vis.handler.charts.length;
|
||||
});
|
||||
beforeEach(() => {
|
||||
vis = getVis();
|
||||
mockUiState = getMockUiState();
|
||||
vis.render(data, mockUiState);
|
||||
numberOfCharts = vis.handler.charts.length;
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
afterEach(() => {
|
||||
vis.destroy();
|
||||
});
|
||||
|
||||
|
@ -81,7 +75,7 @@ dateHistogramArray.forEach(function(data, i) {
|
|||
type: 'histogram',
|
||||
},
|
||||
data,
|
||||
persistedState,
|
||||
mockUiState,
|
||||
vis.element,
|
||||
() => undefined
|
||||
);
|
||||
|
|
|
@ -18,19 +18,16 @@
|
|||
*/
|
||||
|
||||
import _ from 'lodash';
|
||||
import ngMock from 'ng_mock';
|
||||
import expect from '@kbn/expect';
|
||||
|
||||
import { layoutTypes as layoutType } from '../../../lib/layout/layout_types';
|
||||
|
||||
describe('Vislib Layout Types Test Suite', function() {
|
||||
let layoutFunc;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(
|
||||
ngMock.inject(function() {
|
||||
layoutFunc = layoutType.point_series;
|
||||
})
|
||||
);
|
||||
beforeEach(() => {
|
||||
layoutFunc = layoutType.point_series;
|
||||
});
|
||||
|
||||
it('should be an object', function() {
|
||||
expect(_.isObject(layoutType)).to.be(true);
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
*/
|
||||
|
||||
import d3 from 'd3';
|
||||
import ngMock from 'ng_mock';
|
||||
import expect from '@kbn/expect';
|
||||
import $ from 'jquery';
|
||||
|
||||
import { chartSplit } from '../../../../../lib/layout/splits/column_chart/chart_split';
|
||||
import { chartTitleSplit } from '../../../../../lib/layout/splits/column_chart/chart_title_split';
|
||||
import { xAxisSplit } from '../../../../../lib/layout/splits/column_chart/x_axis_split';
|
||||
|
@ -150,16 +150,13 @@ describe('Vislib Split Function Test Suite', function() {
|
|||
],
|
||||
};
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(
|
||||
ngMock.inject(function() {
|
||||
el = d3
|
||||
.select('body')
|
||||
.append('div')
|
||||
.attr('class', 'visualization')
|
||||
.datum(data);
|
||||
})
|
||||
);
|
||||
beforeEach(() => {
|
||||
el = d3
|
||||
.select('body')
|
||||
.append('div')
|
||||
.attr('class', 'visualization')
|
||||
.datum(data);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
el.remove();
|
||||
|
@ -168,11 +165,9 @@ describe('Vislib Split Function Test Suite', function() {
|
|||
describe('chart split function', function() {
|
||||
let fixture;
|
||||
|
||||
beforeEach(
|
||||
ngMock.inject(function() {
|
||||
fixture = d3.select('.visualization').call(chartSplit);
|
||||
})
|
||||
);
|
||||
beforeEach(function() {
|
||||
fixture = d3.select('.visualization').call(chartSplit);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
fixture.remove();
|
||||
|
@ -192,28 +187,26 @@ describe('Vislib Split Function Test Suite', function() {
|
|||
let newEl;
|
||||
let fixture;
|
||||
|
||||
beforeEach(
|
||||
ngMock.inject(function() {
|
||||
visEl = el.append('div').attr('class', 'visWrapper');
|
||||
visEl.append('div').attr('class', 'visAxis__splitTitles--x');
|
||||
visEl.append('div').attr('class', 'visAxis__splitTitles--y');
|
||||
visEl.select('.visAxis__splitTitles--x').call(chartTitleSplit);
|
||||
visEl.select('.visAxis__splitTitles--y').call(chartTitleSplit);
|
||||
beforeEach(function() {
|
||||
visEl = el.append('div').attr('class', 'visWrapper');
|
||||
visEl.append('div').attr('class', 'visAxis__splitTitles--x');
|
||||
visEl.append('div').attr('class', 'visAxis__splitTitles--y');
|
||||
visEl.select('.visAxis__splitTitles--x').call(chartTitleSplit);
|
||||
visEl.select('.visAxis__splitTitles--y').call(chartTitleSplit);
|
||||
|
||||
newEl = d3
|
||||
.select('body')
|
||||
.append('div')
|
||||
.attr('class', 'visWrapper')
|
||||
.datum({ series: [] });
|
||||
newEl = d3
|
||||
.select('body')
|
||||
.append('div')
|
||||
.attr('class', 'visWrapper')
|
||||
.datum({ series: [] });
|
||||
|
||||
newEl.append('div').attr('class', 'visAxis__splitTitles--x');
|
||||
newEl.append('div').attr('class', 'visAxis__splitTitles--y');
|
||||
newEl.select('.visAxis__splitTitles--x').call(chartTitleSplit);
|
||||
newEl.select('.visAxis__splitTitles--y').call(chartTitleSplit);
|
||||
newEl.append('div').attr('class', 'visAxis__splitTitles--x');
|
||||
newEl.append('div').attr('class', 'visAxis__splitTitles--y');
|
||||
newEl.select('.visAxis__splitTitles--x').call(chartTitleSplit);
|
||||
newEl.select('.visAxis__splitTitles--y').call(chartTitleSplit);
|
||||
|
||||
fixture = newEl.selectAll(this.childNodes)[0].length;
|
||||
})
|
||||
);
|
||||
fixture = newEl.selectAll(this.childNodes)[0].length;
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
newEl.remove();
|
||||
|
@ -237,17 +230,15 @@ describe('Vislib Split Function Test Suite', function() {
|
|||
let fixture;
|
||||
let divs;
|
||||
|
||||
beforeEach(
|
||||
ngMock.inject(function() {
|
||||
fixture = d3
|
||||
.select('body')
|
||||
.append('div')
|
||||
.attr('class', 'columns')
|
||||
.datum({ columns: [{}, {}] });
|
||||
d3.select('.columns').call(xAxisSplit);
|
||||
divs = d3.selectAll('.x-axis-div')[0];
|
||||
})
|
||||
);
|
||||
beforeEach(function() {
|
||||
fixture = d3
|
||||
.select('body')
|
||||
.append('div')
|
||||
.attr('class', 'columns')
|
||||
.datum({ columns: [{}, {}] });
|
||||
d3.select('.columns').call(xAxisSplit);
|
||||
divs = d3.selectAll('.x-axis-div')[0];
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
fixture.remove();
|
||||
|
@ -263,19 +254,17 @@ describe('Vislib Split Function Test Suite', function() {
|
|||
let fixture;
|
||||
let divs;
|
||||
|
||||
beforeEach(
|
||||
ngMock.inject(function() {
|
||||
fixture = d3
|
||||
.select('body')
|
||||
.append('div')
|
||||
.attr('class', 'rows')
|
||||
.datum({ rows: [{}, {}] });
|
||||
beforeEach(function() {
|
||||
fixture = d3
|
||||
.select('body')
|
||||
.append('div')
|
||||
.attr('class', 'rows')
|
||||
.datum({ rows: [{}, {}] });
|
||||
|
||||
d3.select('.rows').call(yAxisSplit);
|
||||
d3.select('.rows').call(yAxisSplit);
|
||||
|
||||
divs = d3.selectAll('.y-axis-div')[0];
|
||||
})
|
||||
);
|
||||
divs = d3.selectAll('.y-axis-div')[0];
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
fixture.remove();
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
*/
|
||||
|
||||
import d3 from 'd3';
|
||||
import ngMock from 'ng_mock';
|
||||
import expect from '@kbn/expect';
|
||||
import $ from 'jquery';
|
||||
|
||||
import { chartSplit } from '../../../../../lib/layout/splits/gauge_chart/chart_split';
|
||||
import { chartTitleSplit } from '../../../../../lib/layout/splits/gauge_chart/chart_title_split';
|
||||
|
||||
|
@ -148,16 +148,13 @@ describe('Vislib Gauge Split Function Test Suite', function() {
|
|||
],
|
||||
};
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(
|
||||
ngMock.inject(function() {
|
||||
el = d3
|
||||
.select('body')
|
||||
.append('div')
|
||||
.attr('class', 'visualization')
|
||||
.datum(data);
|
||||
})
|
||||
);
|
||||
beforeEach(function() {
|
||||
el = d3
|
||||
.select('body')
|
||||
.append('div')
|
||||
.attr('class', 'visualization')
|
||||
.datum(data);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
el.remove();
|
||||
|
@ -166,11 +163,9 @@ describe('Vislib Gauge Split Function Test Suite', function() {
|
|||
describe('chart split function', function() {
|
||||
let fixture;
|
||||
|
||||
beforeEach(
|
||||
ngMock.inject(function() {
|
||||
fixture = d3.select('.visualization').call(chartSplit);
|
||||
})
|
||||
);
|
||||
beforeEach(function() {
|
||||
fixture = d3.select('.visualization').call(chartSplit);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
fixture.remove();
|
||||
|
@ -188,15 +183,13 @@ describe('Vislib Gauge Split Function Test Suite', function() {
|
|||
describe('chart title split function', function() {
|
||||
let visEl;
|
||||
|
||||
beforeEach(
|
||||
ngMock.inject(function() {
|
||||
visEl = el.append('div').attr('class', 'visWrapper');
|
||||
visEl.append('div').attr('class', 'visAxis__splitTitles--x');
|
||||
visEl.append('div').attr('class', 'visAxis__splitTitles--y');
|
||||
visEl.select('.visAxis__splitTitles--x').call(chartTitleSplit);
|
||||
visEl.select('.visAxis__splitTitles--y').call(chartTitleSplit);
|
||||
})
|
||||
);
|
||||
beforeEach(function() {
|
||||
visEl = el.append('div').attr('class', 'visWrapper');
|
||||
visEl.append('div').attr('class', 'visAxis__splitTitles--x');
|
||||
visEl.append('div').attr('class', 'visAxis__splitTitles--y');
|
||||
visEl.select('.visAxis__splitTitles--x').call(chartTitleSplit);
|
||||
visEl.select('.visAxis__splitTitles--y').call(chartTitleSplit);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
visEl.remove();
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
|
||||
import d3 from 'd3';
|
||||
import _ from 'lodash';
|
||||
import ngMock from 'ng_mock';
|
||||
import expect from '@kbn/expect';
|
||||
|
||||
import { layoutTypes } from '../../../../lib/layout/layout_types';
|
||||
|
||||
describe('Vislib Column Layout Test Suite', function() {
|
||||
|
@ -85,16 +85,13 @@ describe('Vislib Column Layout Test Suite', function() {
|
|||
yAxisLabel: 'Count',
|
||||
};
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(
|
||||
ngMock.inject(function() {
|
||||
el = d3
|
||||
.select('body')
|
||||
.append('div')
|
||||
.attr('class', 'visualization');
|
||||
columnLayout = layoutTypes.point_series(el, data);
|
||||
})
|
||||
);
|
||||
beforeEach(function() {
|
||||
el = d3
|
||||
.select('body')
|
||||
.append('div')
|
||||
.attr('class', 'visualization');
|
||||
columnLayout = layoutTypes.point_series(el, data);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
el.remove();
|
||||
|
|
|
@ -17,12 +17,13 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import ngMock from 'ng_mock';
|
||||
import expect from '@kbn/expect';
|
||||
import { vislibPointSeriesTypes as pointSeriesConfig } from '../../../lib/types/point_series';
|
||||
|
||||
import percentileTestdata from './testdata_linechart_percentile.json';
|
||||
import percentileTestdataResult from './testdata_linechart_percentile_result.json';
|
||||
|
||||
import { vislibPointSeriesTypes as pointSeriesConfig } from '../../../lib/types/point_series';
|
||||
|
||||
describe('Point Series Config Type Class Test Suite', function() {
|
||||
let parsedConfig;
|
||||
const histogramConfig = {
|
||||
|
@ -95,8 +96,6 @@ describe('Point Series Config Type Class Test Suite', function() {
|
|||
},
|
||||
};
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
|
||||
describe('histogram chart', function() {
|
||||
beforeEach(function() {
|
||||
parsedConfig = pointSeriesConfig.column(histogramConfig, data);
|
||||
|
|
|
@ -18,10 +18,10 @@
|
|||
*/
|
||||
|
||||
import d3 from 'd3';
|
||||
import ngMock from 'ng_mock';
|
||||
import expect from '@kbn/expect';
|
||||
import 'ui/persisted_state';
|
||||
|
||||
import { VisConfig } from '../../lib/vis_config';
|
||||
import { getMockUiState } from './fixtures/_vis_fixture';
|
||||
|
||||
describe('Vislib VisConfig Class Test Suite', function() {
|
||||
let el;
|
||||
|
@ -85,27 +85,23 @@ describe('Vislib VisConfig Class Test Suite', function() {
|
|||
yAxisLabel: 'Count',
|
||||
};
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(
|
||||
ngMock.inject(function($injector) {
|
||||
const PersistedState = $injector.get('PersistedState');
|
||||
el = d3
|
||||
.select('body')
|
||||
.append('div')
|
||||
.attr('class', 'visWrapper')
|
||||
.node();
|
||||
beforeEach(() => {
|
||||
el = d3
|
||||
.select('body')
|
||||
.append('div')
|
||||
.attr('class', 'visWrapper')
|
||||
.node();
|
||||
|
||||
visConfig = new VisConfig(
|
||||
{
|
||||
type: 'point_series',
|
||||
},
|
||||
data,
|
||||
new PersistedState(),
|
||||
el,
|
||||
() => undefined
|
||||
);
|
||||
})
|
||||
);
|
||||
visConfig = new VisConfig(
|
||||
{
|
||||
type: 'point_series',
|
||||
},
|
||||
data,
|
||||
getMockUiState(),
|
||||
el,
|
||||
() => undefined
|
||||
);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
el.remove();
|
||||
|
|
|
@ -19,15 +19,15 @@
|
|||
|
||||
import d3 from 'd3';
|
||||
import _ from 'lodash';
|
||||
import ngMock from 'ng_mock';
|
||||
import expect from '@kbn/expect';
|
||||
import 'ui/persisted_state';
|
||||
import $ from 'jquery';
|
||||
|
||||
import { Axis } from '../../lib/axis';
|
||||
import { VisConfig } from '../../lib/vis_config';
|
||||
import { getMockUiState } from './fixtures/_vis_fixture';
|
||||
|
||||
describe('Vislib xAxis Class Test Suite', function() {
|
||||
let persistedState;
|
||||
let mockUiState;
|
||||
let xAxis;
|
||||
let el;
|
||||
let fixture;
|
||||
|
@ -105,34 +105,30 @@ describe('Vislib xAxis Class Test Suite', function() {
|
|||
yAxisLabel: 'Count',
|
||||
};
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(
|
||||
ngMock.inject(function($injector) {
|
||||
persistedState = new ($injector.get('PersistedState'))();
|
||||
beforeEach(() => {
|
||||
mockUiState = getMockUiState();
|
||||
el = d3
|
||||
.select('body')
|
||||
.append('div')
|
||||
.attr('class', 'visAxis--x')
|
||||
.style('height', '40px');
|
||||
|
||||
el = d3
|
||||
.select('body')
|
||||
.append('div')
|
||||
.attr('class', 'visAxis--x')
|
||||
.style('height', '40px');
|
||||
fixture = el.append('div').attr('class', 'x-axis-div');
|
||||
|
||||
fixture = el.append('div').attr('class', 'x-axis-div');
|
||||
|
||||
const visConfig = new VisConfig(
|
||||
{
|
||||
type: 'histogram',
|
||||
},
|
||||
data,
|
||||
persistedState,
|
||||
$('.x-axis-div')[0],
|
||||
() => undefined
|
||||
);
|
||||
xAxis = new Axis(visConfig, {
|
||||
type: 'category',
|
||||
id: 'CategoryAxis-1',
|
||||
});
|
||||
})
|
||||
);
|
||||
const visConfig = new VisConfig(
|
||||
{
|
||||
type: 'histogram',
|
||||
},
|
||||
data,
|
||||
mockUiState,
|
||||
$('.x-axis-div')[0],
|
||||
() => undefined
|
||||
);
|
||||
xAxis = new Axis(visConfig, {
|
||||
type: 'category',
|
||||
id: 'CategoryAxis-1',
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
fixture.remove();
|
||||
|
|
|
@ -19,15 +19,15 @@
|
|||
|
||||
import _ from 'lodash';
|
||||
import d3 from 'd3';
|
||||
import ngMock from 'ng_mock';
|
||||
import expect from '@kbn/expect';
|
||||
import 'ui/persisted_state';
|
||||
import $ from 'jquery';
|
||||
import expect from '@kbn/expect';
|
||||
|
||||
import { Axis } from '../../lib/axis';
|
||||
import { VisConfig } from '../../lib/vis_config';
|
||||
import { getMockUiState } from './fixtures/_vis_fixture';
|
||||
|
||||
const YAxis = Axis;
|
||||
let persistedState;
|
||||
let mockUiState;
|
||||
let el;
|
||||
let buildYAxis;
|
||||
let yAxis;
|
||||
|
@ -96,7 +96,7 @@ function createData(seriesData) {
|
|||
type: 'histogram',
|
||||
},
|
||||
data,
|
||||
persistedState,
|
||||
mockUiState,
|
||||
node,
|
||||
() => undefined
|
||||
);
|
||||
|
@ -121,15 +121,10 @@ function createData(seriesData) {
|
|||
}
|
||||
|
||||
describe('Vislib yAxis Class Test Suite', function() {
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
|
||||
beforeEach(
|
||||
ngMock.inject(function($injector) {
|
||||
persistedState = new ($injector.get('PersistedState'))();
|
||||
|
||||
expect($('.y-axis-wrapper')).to.have.length(0);
|
||||
})
|
||||
);
|
||||
beforeEach(() => {
|
||||
mockUiState = getMockUiState();
|
||||
expect($('.y-axis-wrapper')).to.have.length(0);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
if (el) {
|
||||
|
|
|
@ -19,19 +19,15 @@
|
|||
|
||||
import _ from 'lodash';
|
||||
import $ from 'jquery';
|
||||
import ngMock from 'ng_mock';
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import 'ui/persisted_state';
|
||||
|
||||
import series from './lib/fixtures/mock_data/date_histogram/_series';
|
||||
import columns from './lib/fixtures/mock_data/date_histogram/_columns';
|
||||
import rows from './lib/fixtures/mock_data/date_histogram/_rows';
|
||||
import stackedSeries from './lib/fixtures/mock_data/date_histogram/_stacked_series';
|
||||
import getFixturesVislibVisFixtureProvider from './lib/fixtures/_vis_fixture';
|
||||
import { getVis, getMockUiState } from './lib/fixtures/_vis_fixture';
|
||||
|
||||
const dataArray = [series, columns, rows, stackedSeries];
|
||||
|
||||
const names = ['series', 'columns', 'rows', 'stackedSeries'];
|
||||
|
||||
dataArray.forEach(function(data, i) {
|
||||
|
@ -39,19 +35,15 @@ dataArray.forEach(function(data, i) {
|
|||
const beforeEvent = 'click';
|
||||
const afterEvent = 'brush';
|
||||
let vis;
|
||||
let persistedState;
|
||||
let mockUiState;
|
||||
let secondVis;
|
||||
let numberOfCharts;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(
|
||||
ngMock.inject(function(Private, $injector) {
|
||||
const getVis = getFixturesVislibVisFixtureProvider(Private);
|
||||
vis = getVis();
|
||||
persistedState = new ($injector.get('PersistedState'))();
|
||||
secondVis = getVis();
|
||||
})
|
||||
);
|
||||
beforeEach(() => {
|
||||
vis = getVis();
|
||||
secondVis = getVis();
|
||||
mockUiState = getMockUiState();
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
vis.destroy();
|
||||
|
@ -60,7 +52,7 @@ dataArray.forEach(function(data, i) {
|
|||
|
||||
describe('render Method', function() {
|
||||
beforeEach(function() {
|
||||
vis.render(data, persistedState);
|
||||
vis.render(data, mockUiState);
|
||||
numberOfCharts = vis.handler.charts.length;
|
||||
});
|
||||
|
||||
|
@ -78,7 +70,7 @@ dataArray.forEach(function(data, i) {
|
|||
|
||||
it('should throw an error if no data is provided', function() {
|
||||
expect(function() {
|
||||
vis.render(null, persistedState);
|
||||
vis.render(null, mockUiState);
|
||||
}).to.throwError();
|
||||
});
|
||||
});
|
||||
|
@ -91,8 +83,8 @@ dataArray.forEach(function(data, i) {
|
|||
|
||||
describe('destroy Method', function() {
|
||||
beforeEach(function() {
|
||||
vis.render(data, persistedState);
|
||||
secondVis.render(data, persistedState);
|
||||
vis.render(data, mockUiState);
|
||||
secondVis.render(data, mockUiState);
|
||||
secondVis.destroy();
|
||||
});
|
||||
|
||||
|
@ -107,7 +99,7 @@ dataArray.forEach(function(data, i) {
|
|||
|
||||
describe('set Method', function() {
|
||||
beforeEach(function() {
|
||||
vis.render(data, persistedState);
|
||||
vis.render(data, mockUiState);
|
||||
vis.set('addLegend', false);
|
||||
vis.set('offset', 'wiggle');
|
||||
});
|
||||
|
@ -120,7 +112,7 @@ dataArray.forEach(function(data, i) {
|
|||
|
||||
describe('get Method', function() {
|
||||
beforeEach(function() {
|
||||
vis.render(data, persistedState);
|
||||
vis.render(data, mockUiState);
|
||||
});
|
||||
|
||||
it('should get attribute values', function() {
|
||||
|
@ -142,7 +134,7 @@ dataArray.forEach(function(data, i) {
|
|||
});
|
||||
|
||||
// Render chart
|
||||
vis.render(data, persistedState);
|
||||
vis.render(data, mockUiState);
|
||||
|
||||
// Add event after charts have rendered
|
||||
listeners.forEach(function(listener) {
|
||||
|
@ -196,7 +188,7 @@ dataArray.forEach(function(data, i) {
|
|||
vis.off(beforeEvent, listener1);
|
||||
|
||||
// Render chart
|
||||
vis.render(data, persistedState);
|
||||
vis.render(data, mockUiState);
|
||||
|
||||
// Add event after charts have rendered
|
||||
listeners.forEach(function(listener) {
|
||||
|
|
|
@ -18,14 +18,11 @@
|
|||
*/
|
||||
|
||||
import d3 from 'd3';
|
||||
import ngMock from 'ng_mock';
|
||||
import _ from 'lodash';
|
||||
import $ from 'jquery';
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import 'ui/persisted_state';
|
||||
|
||||
import getFixturesVislibVisFixtureProvider from '../lib/fixtures/_vis_fixture';
|
||||
import { getVis, getMockUiState } from '../lib/fixtures/_vis_fixture';
|
||||
|
||||
const dataTypesArray = {
|
||||
'series pos': require('../lib/fixtures/mock_data/date_histogram/_series'),
|
||||
|
@ -46,18 +43,14 @@ const visLibParams = {
|
|||
_.forOwn(dataTypesArray, function(dataType, dataTypeName) {
|
||||
describe('Vislib Area Chart Test Suite for ' + dataTypeName + ' Data', function() {
|
||||
let vis;
|
||||
let persistedState;
|
||||
let mockUiState;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(
|
||||
ngMock.inject(function(Private, $injector) {
|
||||
const getVis = getFixturesVislibVisFixtureProvider(Private);
|
||||
vis = getVis(visLibParams);
|
||||
persistedState = new ($injector.get('PersistedState'))();
|
||||
vis.on('brush', _.noop);
|
||||
vis.render(dataType, persistedState);
|
||||
})
|
||||
);
|
||||
beforeEach(() => {
|
||||
vis = getVis(visLibParams);
|
||||
mockUiState = getMockUiState();
|
||||
vis.on('brush', _.noop);
|
||||
vis.render(dataType, mockUiState);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
vis.destroy();
|
||||
|
@ -97,17 +90,15 @@ _.forOwn(dataTypesArray, function(dataType, dataTypeName) {
|
|||
let d3selectedPath;
|
||||
let onMouseOver;
|
||||
|
||||
beforeEach(
|
||||
ngMock.inject(function() {
|
||||
vis.handler.charts.forEach(function(chart) {
|
||||
path = $(chart.chartEl).find('path')[0];
|
||||
d3selectedPath = d3.select(path)[0][0];
|
||||
beforeEach(function() {
|
||||
vis.handler.charts.forEach(function(chart) {
|
||||
path = $(chart.chartEl).find('path')[0];
|
||||
d3selectedPath = d3.select(path)[0][0];
|
||||
|
||||
// d3 instance of click and hover
|
||||
onMouseOver = !!d3selectedPath.__onmouseover;
|
||||
});
|
||||
})
|
||||
);
|
||||
// d3 instance of click and hover
|
||||
onMouseOver = !!d3selectedPath.__onmouseover;
|
||||
});
|
||||
});
|
||||
|
||||
it('should attach a hover event', function() {
|
||||
vis.handler.charts.forEach(function() {
|
||||
|
@ -124,20 +115,18 @@ _.forOwn(dataTypesArray, function(dataType, dataTypeName) {
|
|||
let onClick;
|
||||
let onMouseOver;
|
||||
|
||||
beforeEach(
|
||||
ngMock.inject(function() {
|
||||
vis.handler.charts.forEach(function(chart) {
|
||||
circle = $(chart.chartEl).find('circle')[0];
|
||||
brush = $(chart.chartEl).find('.brush');
|
||||
d3selectedCircle = d3.select(circle)[0][0];
|
||||
beforeEach(() => {
|
||||
vis.handler.charts.forEach(function(chart) {
|
||||
circle = $(chart.chartEl).find('circle')[0];
|
||||
brush = $(chart.chartEl).find('.brush');
|
||||
d3selectedCircle = d3.select(circle)[0][0];
|
||||
|
||||
// d3 instance of click and hover
|
||||
onBrush = !!brush;
|
||||
onClick = !!d3selectedCircle.__onclick;
|
||||
onMouseOver = !!d3selectedCircle.__onmouseover;
|
||||
});
|
||||
})
|
||||
);
|
||||
// d3 instance of click and hover
|
||||
onBrush = !!brush;
|
||||
onClick = !!d3selectedCircle.__onclick;
|
||||
onMouseOver = !!d3selectedCircle.__onmouseover;
|
||||
});
|
||||
});
|
||||
|
||||
// D3 brushing requires that a g element is appended that
|
||||
// listens for mousedown events. This g element includes
|
||||
|
@ -219,7 +208,7 @@ _.forOwn(dataTypesArray, function(dataType, dataTypeName) {
|
|||
describe('defaultYExtents is true', function() {
|
||||
beforeEach(function() {
|
||||
vis.visConfigArgs.defaultYExtents = true;
|
||||
vis.render(dataType, persistedState);
|
||||
vis.render(dataType, mockUiState);
|
||||
});
|
||||
|
||||
it('should return yAxis extents equal to data extents', function() {
|
||||
|
@ -238,7 +227,7 @@ _.forOwn(dataTypesArray, function(dataType, dataTypeName) {
|
|||
beforeEach(function() {
|
||||
vis.visConfigArgs.defaultYExtents = true;
|
||||
vis.visConfigArgs.boundsMargin = boundsMarginValue;
|
||||
vis.render(dataType, persistedState);
|
||||
vis.render(dataType, mockUiState);
|
||||
});
|
||||
|
||||
it('should return yAxis extents equal to data extents with boundsMargin', function() {
|
||||
|
|
|
@ -18,16 +18,12 @@
|
|||
*/
|
||||
|
||||
import d3 from 'd3';
|
||||
import ngMock from 'ng_mock';
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import 'ui/persisted_state';
|
||||
|
||||
import { Chart } from '../../visualizations/_chart';
|
||||
import getFixturesVislibVisFixtureProvider from '../lib/fixtures/_vis_fixture';
|
||||
import { getVis, getMockUiState } from '../lib/fixtures/_vis_fixture';
|
||||
|
||||
describe('Vislib _chart Test Suite', function() {
|
||||
let persistedState;
|
||||
let vis;
|
||||
let el;
|
||||
let myChart;
|
||||
|
@ -109,30 +105,24 @@ describe('Vislib _chart Test Suite', function() {
|
|||
yAxisLabel: 'Count',
|
||||
};
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(
|
||||
ngMock.inject(function(Private, $injector) {
|
||||
const getVis = getFixturesVislibVisFixtureProvider(Private);
|
||||
persistedState = new ($injector.get('PersistedState'))();
|
||||
beforeEach(() => {
|
||||
el = d3
|
||||
.select('body')
|
||||
.append('div')
|
||||
.attr('class', 'column-chart');
|
||||
|
||||
el = d3
|
||||
.select('body')
|
||||
.append('div')
|
||||
.attr('class', 'column-chart');
|
||||
config = {
|
||||
type: 'histogram',
|
||||
addTooltip: true,
|
||||
addLegend: true,
|
||||
zeroFill: true,
|
||||
};
|
||||
|
||||
config = {
|
||||
type: 'histogram',
|
||||
addTooltip: true,
|
||||
addLegend: true,
|
||||
zeroFill: true,
|
||||
};
|
||||
vis = getVis(config, el[0][0]);
|
||||
vis.render(data, getMockUiState());
|
||||
|
||||
vis = getVis(config, el[0][0]);
|
||||
vis.render(data, persistedState);
|
||||
|
||||
myChart = vis.handler.charts[0];
|
||||
})
|
||||
);
|
||||
myChart = vis.handler.charts[0];
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
el.remove();
|
||||
|
|
|
@ -17,12 +17,10 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import ngMock from 'ng_mock';
|
||||
import _ from 'lodash';
|
||||
import d3 from 'd3';
|
||||
|
||||
import $ from 'jquery';
|
||||
import expect from '@kbn/expect';
|
||||
import 'ui/persisted_state';
|
||||
|
||||
// Data
|
||||
import series from '../lib/fixtures/mock_data/date_histogram/_series';
|
||||
|
@ -31,11 +29,11 @@ import seriesNeg from '../lib/fixtures/mock_data/date_histogram/_series_neg';
|
|||
import termsColumns from '../lib/fixtures/mock_data/terms/_columns';
|
||||
import histogramRows from '../lib/fixtures/mock_data/histogram/_rows';
|
||||
import stackedSeries from '../lib/fixtures/mock_data/date_histogram/_stacked_series';
|
||||
|
||||
import { seriesMonthlyInterval } from '../lib/fixtures/mock_data/date_histogram/_series_monthly_interval';
|
||||
import { rowsSeriesWithHoles } from '../lib/fixtures/mock_data/date_histogram/_rows_series_with_holes';
|
||||
import rowsWithZeros from '../lib/fixtures/mock_data/date_histogram/_rows';
|
||||
import $ from 'jquery';
|
||||
import getFixturesVislibVisFixtureProvider from '../lib/fixtures/_vis_fixture';
|
||||
import { getVis, getMockUiState } from '../lib/fixtures/_vis_fixture';
|
||||
|
||||
// tuple, with the format [description, mode, data]
|
||||
const dataTypesArray = [
|
||||
|
@ -54,7 +52,7 @@ dataTypesArray.forEach(function(dataType) {
|
|||
|
||||
describe('Vislib Column Chart Test Suite for ' + name + ' Data', function() {
|
||||
let vis;
|
||||
let persistedState;
|
||||
let mockUiState;
|
||||
const visLibParams = {
|
||||
type: 'histogram',
|
||||
addLegend: true,
|
||||
|
@ -67,16 +65,12 @@ dataTypesArray.forEach(function(dataType) {
|
|||
},
|
||||
};
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(
|
||||
ngMock.inject(function(Private, $injector) {
|
||||
const getVis = getFixturesVislibVisFixtureProvider(Private);
|
||||
vis = getVis(visLibParams);
|
||||
persistedState = new ($injector.get('PersistedState'))();
|
||||
vis.on('brush', _.noop);
|
||||
vis.render(data, persistedState);
|
||||
})
|
||||
);
|
||||
beforeEach(() => {
|
||||
vis = getVis(visLibParams);
|
||||
mockUiState = getMockUiState();
|
||||
vis.on('brush', _.noop);
|
||||
vis.render(data, mockUiState);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
vis.destroy();
|
||||
|
@ -200,7 +194,7 @@ dataTypesArray.forEach(function(dataType) {
|
|||
describe('defaultYExtents is true', function() {
|
||||
beforeEach(function() {
|
||||
vis.visConfigArgs.defaultYExtents = true;
|
||||
vis.render(data, persistedState);
|
||||
vis.render(data, mockUiState);
|
||||
});
|
||||
|
||||
it('should return yAxis extents equal to data extents', function() {
|
||||
|
@ -219,7 +213,7 @@ dataTypesArray.forEach(function(dataType) {
|
|||
beforeEach(function() {
|
||||
vis.visConfigArgs.defaultYExtents = true;
|
||||
vis.visConfigArgs.boundsMargin = boundsMarginValue;
|
||||
vis.render(data, persistedState);
|
||||
vis.render(data, mockUiState);
|
||||
});
|
||||
|
||||
it('should return yAxis extents equal to data extents with boundsMargin', function() {
|
||||
|
@ -247,7 +241,7 @@ dataTypesArray.forEach(function(dataType) {
|
|||
|
||||
describe('stackData method - data set with zeros in percentage mode', function() {
|
||||
let vis;
|
||||
let persistedState;
|
||||
let mockUiState;
|
||||
const visLibParams = {
|
||||
type: 'histogram',
|
||||
addLegend: true,
|
||||
|
@ -256,22 +250,18 @@ describe('stackData method - data set with zeros in percentage mode', function()
|
|||
zeroFill: true,
|
||||
};
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(
|
||||
ngMock.inject(function(Private, $injector) {
|
||||
const getVis = getFixturesVislibVisFixtureProvider(Private);
|
||||
vis = getVis(visLibParams);
|
||||
persistedState = new ($injector.get('PersistedState'))();
|
||||
vis.on('brush', _.noop);
|
||||
})
|
||||
);
|
||||
beforeEach(() => {
|
||||
vis = getVis(visLibParams);
|
||||
mockUiState = getMockUiState();
|
||||
vis.on('brush', _.noop);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
vis.destroy();
|
||||
});
|
||||
|
||||
it('should not mutate the injected zeros', function() {
|
||||
vis.render(seriesMonthlyInterval, persistedState);
|
||||
vis.render(seriesMonthlyInterval, mockUiState);
|
||||
|
||||
expect(vis.handler.charts).to.have.length(1);
|
||||
const chart = vis.handler.charts[0];
|
||||
|
@ -284,7 +274,7 @@ describe('stackData method - data set with zeros in percentage mode', function()
|
|||
});
|
||||
|
||||
it('should not mutate zeros that exist in the data', function() {
|
||||
vis.render(rowsWithZeros, persistedState);
|
||||
vis.render(rowsWithZeros, mockUiState);
|
||||
|
||||
expect(vis.handler.charts).to.have.length(2);
|
||||
const chart = vis.handler.charts[0];
|
||||
|
@ -298,7 +288,7 @@ describe('stackData method - data set with zeros in percentage mode', function()
|
|||
|
||||
describe('datumWidth - split chart data set with holes', function() {
|
||||
let vis;
|
||||
let persistedState;
|
||||
let mockUiState;
|
||||
const visLibParams = {
|
||||
type: 'histogram',
|
||||
addLegend: true,
|
||||
|
@ -307,16 +297,12 @@ describe('datumWidth - split chart data set with holes', function() {
|
|||
zeroFill: true,
|
||||
};
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(
|
||||
ngMock.inject(function(Private, $injector) {
|
||||
const getVis = getFixturesVislibVisFixtureProvider(Private);
|
||||
vis = getVis(visLibParams);
|
||||
persistedState = new ($injector.get('PersistedState'))();
|
||||
vis.on('brush', _.noop);
|
||||
vis.render(rowsSeriesWithHoles, persistedState);
|
||||
})
|
||||
);
|
||||
beforeEach(() => {
|
||||
vis = getVis(visLibParams);
|
||||
mockUiState = getMockUiState();
|
||||
vis.on('brush', _.noop);
|
||||
vis.render(rowsSeriesWithHoles, mockUiState);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
vis.destroy();
|
||||
|
@ -336,7 +322,7 @@ describe('datumWidth - split chart data set with holes', function() {
|
|||
|
||||
describe('datumWidth - monthly interval', function() {
|
||||
let vis;
|
||||
let persistedState;
|
||||
let mockUiState;
|
||||
const visLibParams = {
|
||||
type: 'histogram',
|
||||
addLegend: true,
|
||||
|
@ -345,16 +331,12 @@ describe('datumWidth - monthly interval', function() {
|
|||
zeroFill: true,
|
||||
};
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(
|
||||
ngMock.inject(function(Private, $injector) {
|
||||
const getVis = getFixturesVislibVisFixtureProvider(Private);
|
||||
vis = getVis(visLibParams);
|
||||
persistedState = new ($injector.get('PersistedState'))();
|
||||
vis.on('brush', _.noop);
|
||||
vis.render(seriesMonthlyInterval, persistedState);
|
||||
})
|
||||
);
|
||||
beforeEach(() => {
|
||||
vis = getVis(visLibParams);
|
||||
mockUiState = getMockUiState();
|
||||
vis.on('brush', _.noop);
|
||||
vis.render(seriesMonthlyInterval, mockUiState);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
vis.destroy();
|
||||
|
|
|
@ -17,21 +17,15 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import ngMock from 'ng_mock';
|
||||
import $ from 'jquery';
|
||||
import _ from 'lodash';
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import 'ui/persisted_state';
|
||||
|
||||
import data from '../lib/fixtures/mock_data/terms/_seriesMultiple';
|
||||
import getFixturesVislibVisFixtureProvider from '../lib/fixtures/_vis_fixture';
|
||||
import { getVis, getMockUiState } from '../lib/fixtures/_vis_fixture';
|
||||
|
||||
describe('Vislib Gauge Chart Test Suite', function() {
|
||||
let PersistedState;
|
||||
let vislibVis;
|
||||
let vis;
|
||||
let persistedState;
|
||||
let chartEl;
|
||||
const visLibParams = {
|
||||
type: 'gauge',
|
||||
|
@ -81,21 +75,15 @@ describe('Vislib Gauge Chart Test Suite', function() {
|
|||
vis.destroy();
|
||||
$('.visChart').remove();
|
||||
}
|
||||
vis = vislibVis(config);
|
||||
persistedState = new PersistedState();
|
||||
vis = getVis(config);
|
||||
vis.on('brush', _.noop);
|
||||
vis.render(data, persistedState);
|
||||
vis.render(data, getMockUiState());
|
||||
chartEl = vis.handler.charts[0].chartEl;
|
||||
}
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(
|
||||
ngMock.inject(function(Private, $injector) {
|
||||
vislibVis = getFixturesVislibVisFixtureProvider(Private);
|
||||
PersistedState = $injector.get('PersistedState');
|
||||
generateVis();
|
||||
})
|
||||
);
|
||||
beforeEach(() => {
|
||||
generateVis();
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
vis.destroy();
|
||||
|
|
|
@ -17,12 +17,10 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import ngMock from 'ng_mock';
|
||||
import _ from 'lodash';
|
||||
import $ from 'jquery';
|
||||
import d3 from 'd3';
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import 'ui/persisted_state';
|
||||
|
||||
// Data
|
||||
import series from '../lib/fixtures/mock_data/date_histogram/_series';
|
||||
|
@ -30,8 +28,8 @@ import seriesPosNeg from '../lib/fixtures/mock_data/date_histogram/_series_pos_n
|
|||
import seriesNeg from '../lib/fixtures/mock_data/date_histogram/_series_neg';
|
||||
import termsColumns from '../lib/fixtures/mock_data/terms/_columns';
|
||||
import stackedSeries from '../lib/fixtures/mock_data/date_histogram/_stacked_series';
|
||||
import $ from 'jquery';
|
||||
import getFixturesVislibVisFixtureProvider from '../lib/fixtures/_vis_fixture';
|
||||
|
||||
import { getVis, getMockUiState } from '../lib/fixtures/_vis_fixture';
|
||||
|
||||
// tuple, with the format [description, mode, data]
|
||||
const dataTypesArray = [
|
||||
|
@ -48,10 +46,8 @@ describe('Vislib Heatmap Chart Test Suite', function() {
|
|||
const data = dataType[1];
|
||||
|
||||
describe('for ' + name + ' Data', function() {
|
||||
let PersistedState;
|
||||
let vislibVis;
|
||||
let vis;
|
||||
let persistedState;
|
||||
let mockUiState;
|
||||
const visLibParams = {
|
||||
type: 'heatmap',
|
||||
addLegend: true,
|
||||
|
@ -66,20 +62,15 @@ describe('Vislib Heatmap Chart Test Suite', function() {
|
|||
|
||||
function generateVis(opts = {}) {
|
||||
const config = _.defaultsDeep({}, opts, visLibParams);
|
||||
vis = vislibVis(config);
|
||||
persistedState = new PersistedState();
|
||||
vis = getVis(config);
|
||||
mockUiState = getMockUiState();
|
||||
vis.on('brush', _.noop);
|
||||
vis.render(data, persistedState);
|
||||
vis.render(data, mockUiState);
|
||||
}
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(
|
||||
ngMock.inject(function(Private, $injector) {
|
||||
vislibVis = getFixturesVislibVisFixtureProvider(Private);
|
||||
PersistedState = $injector.get('PersistedState');
|
||||
generateVis();
|
||||
})
|
||||
);
|
||||
beforeEach(() => {
|
||||
generateVis();
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
vis.destroy();
|
||||
|
@ -174,7 +165,7 @@ describe('Vislib Heatmap Chart Test Suite', function() {
|
|||
});
|
||||
|
||||
it('should define default colors', function() {
|
||||
expect(persistedState.get('vis.defaultColors')).to.not.be(undefined);
|
||||
expect(mockUiState.get('vis.defaultColors')).to.not.be(undefined);
|
||||
});
|
||||
|
||||
it('should set custom range', function() {
|
||||
|
|
|
@ -19,12 +19,9 @@
|
|||
|
||||
import d3 from 'd3';
|
||||
import expect from '@kbn/expect';
|
||||
import ngMock from 'ng_mock';
|
||||
import $ from 'jquery';
|
||||
import _ from 'lodash';
|
||||
|
||||
import 'ui/persisted_state';
|
||||
|
||||
// Data
|
||||
import seriesPos from '../lib/fixtures/mock_data/date_histogram/_series';
|
||||
import seriesPosNeg from '../lib/fixtures/mock_data/date_histogram/_series_pos_neg';
|
||||
|
@ -32,7 +29,8 @@ import seriesNeg from '../lib/fixtures/mock_data/date_histogram/_series_neg';
|
|||
import histogramColumns from '../lib/fixtures/mock_data/histogram/_columns';
|
||||
import rangeRows from '../lib/fixtures/mock_data/range/_rows';
|
||||
import termSeries from '../lib/fixtures/mock_data/terms/_series';
|
||||
import getFixturesVislibVisFixtureProvider from '../lib/fixtures/_vis_fixture';
|
||||
|
||||
import { getVis, getMockUiState } from '../lib/fixtures/_vis_fixture';
|
||||
|
||||
const dataTypes = [
|
||||
['series pos', seriesPos],
|
||||
|
@ -50,25 +48,21 @@ describe('Vislib Line Chart', function() {
|
|||
|
||||
describe(name + ' Data', function() {
|
||||
let vis;
|
||||
let persistedState;
|
||||
let mockUiState;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(
|
||||
ngMock.inject(function(Private, $injector) {
|
||||
const getVis = getFixturesVislibVisFixtureProvider(Private);
|
||||
const visLibParams = {
|
||||
type: 'line',
|
||||
addLegend: true,
|
||||
addTooltip: true,
|
||||
drawLinesBetweenPoints: true,
|
||||
};
|
||||
beforeEach(() => {
|
||||
const visLibParams = {
|
||||
type: 'line',
|
||||
addLegend: true,
|
||||
addTooltip: true,
|
||||
drawLinesBetweenPoints: true,
|
||||
};
|
||||
|
||||
vis = getVis(visLibParams);
|
||||
persistedState = new ($injector.get('PersistedState'))();
|
||||
vis.render(data, persistedState);
|
||||
vis.on('brush', _.noop);
|
||||
})
|
||||
);
|
||||
vis = getVis(visLibParams);
|
||||
mockUiState = getMockUiState();
|
||||
vis.render(data, mockUiState);
|
||||
vis.on('brush', _.noop);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
vis.destroy();
|
||||
|
@ -82,20 +76,18 @@ describe('Vislib Line Chart', function() {
|
|||
let onClick;
|
||||
let onMouseOver;
|
||||
|
||||
beforeEach(
|
||||
ngMock.inject(function() {
|
||||
vis.handler.charts.forEach(function(chart) {
|
||||
circle = $(chart.chartEl).find('.circle')[0];
|
||||
brush = $(chart.chartEl).find('.brush');
|
||||
d3selectedCircle = d3.select(circle)[0][0];
|
||||
beforeEach(function() {
|
||||
vis.handler.charts.forEach(function(chart) {
|
||||
circle = $(chart.chartEl).find('.circle')[0];
|
||||
brush = $(chart.chartEl).find('.brush');
|
||||
d3selectedCircle = d3.select(circle)[0][0];
|
||||
|
||||
// d3 instance of click and hover
|
||||
onBrush = !!brush;
|
||||
onClick = !!d3selectedCircle.__onclick;
|
||||
onMouseOver = !!d3selectedCircle.__onmouseover;
|
||||
});
|
||||
})
|
||||
);
|
||||
// d3 instance of click and hover
|
||||
onBrush = !!brush;
|
||||
onClick = !!d3selectedCircle.__onclick;
|
||||
onMouseOver = !!d3selectedCircle.__onmouseover;
|
||||
});
|
||||
});
|
||||
|
||||
// D3 brushing requires that a g element is appended that
|
||||
// listens for mousedown events. This g element includes
|
||||
|
@ -177,7 +169,7 @@ describe('Vislib Line Chart', function() {
|
|||
describe('defaultYExtents is true', function() {
|
||||
beforeEach(function() {
|
||||
vis.visConfigArgs.defaultYExtents = true;
|
||||
vis.render(data, persistedState);
|
||||
vis.render(data, mockUiState);
|
||||
});
|
||||
|
||||
it('should return yAxis extents equal to data extents', function() {
|
||||
|
@ -196,7 +188,7 @@ describe('Vislib Line Chart', function() {
|
|||
beforeEach(function() {
|
||||
vis.visConfigArgs.defaultYExtents = true;
|
||||
vis.visConfigArgs.boundsMargin = boundsMarginValue;
|
||||
vis.render(data, persistedState);
|
||||
vis.render(data, mockUiState);
|
||||
});
|
||||
|
||||
it('should return yAxis extents equal to data extents with boundsMargin', function() {
|
||||
|
|
|
@ -18,19 +18,16 @@
|
|||
*/
|
||||
|
||||
import d3 from 'd3';
|
||||
import ngMock from 'ng_mock';
|
||||
import _ from 'lodash';
|
||||
import $ from 'jquery';
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
// TODO: Remove ui imports once converting to jest
|
||||
import 'ui/persisted_state';
|
||||
|
||||
import { vislibSlicesResponseHandlerProvider } from 'ui/vis/response_handlers/vislib';
|
||||
|
||||
import fixtures from 'fixtures/fake_hierarchical_data';
|
||||
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
|
||||
|
||||
import getFixturesVislibVisFixtureProvider from '../lib/fixtures/_vis_fixture';
|
||||
import { getVis, getMockUiState } from '../lib/fixtures/_vis_fixture';
|
||||
import { Vis, tabifyAggResponse } from '../../../legacy_imports';
|
||||
|
||||
const rowAgg = [
|
||||
|
@ -123,35 +120,31 @@ describe('No global chart settings', function() {
|
|||
addTooltip: true,
|
||||
};
|
||||
let chart1;
|
||||
let persistedState;
|
||||
let mockUiState;
|
||||
let indexPattern;
|
||||
let responseHandler;
|
||||
let data1;
|
||||
let stubVis1;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(
|
||||
ngMock.inject(function(Private, $injector) {
|
||||
const getVis = getFixturesVislibVisFixtureProvider(Private);
|
||||
chart1 = getVis(visLibParams1);
|
||||
persistedState = new ($injector.get('PersistedState'))();
|
||||
indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider);
|
||||
responseHandler = vislibSlicesResponseHandlerProvider().handler;
|
||||
beforeEach(() => {
|
||||
chart1 = getVis(visLibParams1);
|
||||
mockUiState = getMockUiState();
|
||||
indexPattern = new FixturesStubbedLogstashIndexPatternProvider();
|
||||
responseHandler = vislibSlicesResponseHandlerProvider().handler;
|
||||
|
||||
let id1 = 1;
|
||||
stubVis1 = new Vis(indexPattern, {
|
||||
type: 'pie',
|
||||
aggs: rowAgg,
|
||||
});
|
||||
let id1 = 1;
|
||||
stubVis1 = new Vis(indexPattern, {
|
||||
type: 'pie',
|
||||
aggs: rowAgg,
|
||||
});
|
||||
|
||||
stubVis1.isHierarchical = () => true;
|
||||
stubVis1.isHierarchical = () => true;
|
||||
|
||||
// We need to set the aggs to a known value.
|
||||
_.each(stubVis1.aggs.aggs, function(agg) {
|
||||
agg.id = 'agg_' + id1++;
|
||||
});
|
||||
})
|
||||
);
|
||||
// We need to set the aggs to a known value.
|
||||
_.each(stubVis1.aggs.aggs, function(agg) {
|
||||
agg.id = 'agg_' + id1++;
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
const table1 = tabifyAggResponse(stubVis1.aggs, fixtures.threeTermBuckets, {
|
||||
|
@ -159,7 +152,7 @@ describe('No global chart settings', function() {
|
|||
});
|
||||
data1 = await responseHandler(table1, rowAggDimensions);
|
||||
|
||||
chart1.render(data1, persistedState);
|
||||
chart1.render(data1, mockUiState);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
|
@ -216,40 +209,37 @@ describe('Vislib PieChart Class Test Suite', function() {
|
|||
addTooltip: true,
|
||||
};
|
||||
let vis;
|
||||
let persistedState;
|
||||
let mockUiState;
|
||||
let indexPattern;
|
||||
let data;
|
||||
let stubVis;
|
||||
let responseHandler;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(
|
||||
ngMock.inject(function(Private, $injector) {
|
||||
const getVis = getFixturesVislibVisFixtureProvider(Private);
|
||||
vis = getVis(visLibParams);
|
||||
persistedState = new ($injector.get('PersistedState'))();
|
||||
indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider);
|
||||
responseHandler = vislibSlicesResponseHandlerProvider().handler;
|
||||
beforeEach(() => {
|
||||
vis = getVis(visLibParams);
|
||||
mockUiState = getMockUiState();
|
||||
indexPattern = new FixturesStubbedLogstashIndexPatternProvider();
|
||||
responseHandler = vislibSlicesResponseHandlerProvider().handler;
|
||||
|
||||
let id = 1;
|
||||
stubVis = new Vis(indexPattern, {
|
||||
type: 'pie',
|
||||
aggs: dataAgg,
|
||||
});
|
||||
let id = 1;
|
||||
stubVis = new Vis(indexPattern, {
|
||||
type: 'pie',
|
||||
aggs: dataAgg,
|
||||
});
|
||||
|
||||
// We need to set the aggs to a known value.
|
||||
_.each(stubVis.aggs.aggs, function(agg) {
|
||||
agg.id = 'agg_' + id++;
|
||||
});
|
||||
})
|
||||
);
|
||||
// We need to set the aggs to a known value.
|
||||
_.each(stubVis.aggs.aggs, function(agg) {
|
||||
agg.id = 'agg_' + id++;
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
const table = tabifyAggResponse(stubVis.aggs, fixtures.threeTermBuckets, {
|
||||
metricsAtAllLevels: true,
|
||||
});
|
||||
data = await responseHandler(table, dataDimensions);
|
||||
vis.render(data, persistedState);
|
||||
|
||||
vis.render(data, mockUiState);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
*/
|
||||
|
||||
import d3 from 'd3';
|
||||
import $ from 'jquery';
|
||||
import expect from '@kbn/expect';
|
||||
import ngMock from 'ng_mock';
|
||||
|
||||
import series from '../lib/fixtures/mock_data/date_histogram/_series';
|
||||
import terms from '../lib/fixtures/mock_data/terms/_columns';
|
||||
import $ from 'jquery';
|
||||
import { TimeMarker } from '../../visualizations/time_marker';
|
||||
|
||||
describe('Vislib Time Marker Test Suite', function() {
|
||||
|
@ -57,26 +57,23 @@ describe('Vislib Time Marker Test Suite', function() {
|
|||
let maxDomain;
|
||||
let domain;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(
|
||||
ngMock.inject(function() {
|
||||
minDomain = getExtent(series.series, d3.min);
|
||||
maxDomain = getExtent(series.series, d3.max);
|
||||
domain = [minDomain, maxDomain];
|
||||
xScale = d3.time
|
||||
.scale()
|
||||
.domain(domain)
|
||||
.range([0, 500]);
|
||||
defaultMarker = new TimeMarker(times, xScale, height);
|
||||
customMarker = new TimeMarker(myTimes, xScale, height);
|
||||
beforeEach(function() {
|
||||
minDomain = getExtent(series.series, d3.min);
|
||||
maxDomain = getExtent(series.series, d3.max);
|
||||
domain = [minDomain, maxDomain];
|
||||
xScale = d3.time
|
||||
.scale()
|
||||
.domain(domain)
|
||||
.range([0, 500]);
|
||||
defaultMarker = new TimeMarker(times, xScale, height);
|
||||
customMarker = new TimeMarker(myTimes, xScale, height);
|
||||
|
||||
selection = d3
|
||||
.select('body')
|
||||
.append('div')
|
||||
.attr('class', 'marker');
|
||||
selection.datum(series);
|
||||
})
|
||||
);
|
||||
selection = d3
|
||||
.select('body')
|
||||
.append('div')
|
||||
.attr('class', 'marker');
|
||||
selection.datum(series);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
selection.remove('*');
|
||||
|
|
|
@ -17,20 +17,17 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import ngMock from 'ng_mock';
|
||||
import _ from 'lodash';
|
||||
import expect from '@kbn/expect';
|
||||
|
||||
import { visTypes } from '../../visualizations/vis_types';
|
||||
|
||||
describe('Vislib Vis Types Test Suite', function() {
|
||||
let visFunc;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(
|
||||
ngMock.inject(function() {
|
||||
visFunc = visTypes.point_series;
|
||||
})
|
||||
);
|
||||
beforeEach(function() {
|
||||
visFunc = visTypes.point_series;
|
||||
});
|
||||
|
||||
it('should be an object', function() {
|
||||
expect(_.isObject(visTypes)).to.be(true);
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
@import './variables';
|
||||
@import './vislib_vis_type';
|
||||
|
||||
@import './lib/index';
|
||||
@import './components/tooltip/index';
|
||||
@import './components/legend/index';
|
||||
|
||||
@import './visualizations/point_series/index';
|
||||
@import './visualizations/gauges/index';
|
||||
|
|
|
@ -7,12 +7,15 @@
|
|||
&.visLib--legend-left {
|
||||
flex-direction: row-reverse;
|
||||
}
|
||||
|
||||
&.visLib--legend-right {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
&.visLib--legend-top {
|
||||
flex-direction: column-reverse;
|
||||
}
|
||||
|
||||
&.visLib--legend-bottom {
|
||||
flex-direction: column;
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
@import './_legend';
|
|
@ -1,4 +1,4 @@
|
|||
@import '../../../../core_plugins/vis_type_vislib/public/vislib/variables';
|
||||
@import '../../variables';
|
||||
|
||||
// NOTE: Some of the styles attempt to align with the TSVB legend
|
||||
|
||||
|
@ -14,17 +14,16 @@ $visLegendLineHeight: $euiSize;
|
|||
display: flex;
|
||||
padding: $euiSizeXS;
|
||||
background-color: $euiColorEmptyShade;
|
||||
transition: opacity $euiAnimSpeedFast $euiAnimSlightResistance,
|
||||
background-color $euiAnimSpeedFast $euiAnimSlightResistance $euiAnimSpeedExtraSlow;
|
||||
transition: opacity $euiAnimSpeedFast $euiAnimSlightResistance, background-color $euiAnimSpeedFast $euiAnimSlightResistance $euiAnimSpeedExtraSlow;
|
||||
|
||||
&:focus {
|
||||
box-shadow: none;
|
||||
background-color: $euiFocusBackgroundColor !important;
|
||||
background-color: $euiFocusBackgroundColor !important; // sass-lint:disable-line no-important
|
||||
}
|
||||
}
|
||||
|
||||
.visLegend__toggle--isOpen {
|
||||
background-color: transparentize($euiColorDarkestShade, 0.9);
|
||||
background-color: transparentize($euiColorDarkestShade, .9);
|
||||
opacity: 1;
|
||||
}
|
||||
|
|
@ -17,5 +17,5 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
export { VisLegend } from './vislib_vis_legend';
|
||||
export { VisLegend } from './legend';
|
||||
export { CUSTOM_LEGEND_VIS_TYPES } from './models';
|
|
@ -23,7 +23,7 @@ import { mount, ReactWrapper } from 'enzyme';
|
|||
import { I18nProvider } from '@kbn/i18n/react';
|
||||
import { EuiButtonGroup } from '@elastic/eui';
|
||||
|
||||
import { VisLegend, VisLegendProps } from '../vislib_vis_legend/vislib_vis_legend';
|
||||
import { VisLegend, VisLegendProps } from './legend';
|
||||
import { legendColors } from './models';
|
||||
|
||||
jest.mock('@elastic/eui', () => ({
|
||||
|
@ -31,10 +31,10 @@ jest.mock('@elastic/eui', () => ({
|
|||
htmlIdGenerator: jest.fn().mockReturnValue(() => 'legendId'),
|
||||
}));
|
||||
|
||||
jest.mock('../../../visualize/loader/pipeline_helpers/utilities', () => ({
|
||||
jest.mock('../../../legacy_imports', () => ({
|
||||
getTableAggs: jest.fn(),
|
||||
}));
|
||||
jest.mock('../../../../../core_plugins/visualizations/public', () => ({
|
||||
jest.mock('../../../../../visualizations/public', () => ({
|
||||
createFiltersFromEvent: jest.fn().mockReturnValue(['yes']),
|
||||
}));
|
||||
|
|
@ -24,11 +24,11 @@ import { i18n } from '@kbn/i18n';
|
|||
import { EuiPopoverProps, EuiIcon, keyCodes, htmlIdGenerator } from '@elastic/eui';
|
||||
|
||||
// @ts-ignore
|
||||
import { createFiltersFromEvent } from '../../../../../core_plugins/visualizations/public';
|
||||
import { createFiltersFromEvent } from '../../../../../visualizations/public';
|
||||
import { CUSTOM_LEGEND_VIS_TYPES, LegendItem } from './models';
|
||||
import { VisLegendItem } from './vislib_vis_legend_item';
|
||||
import { VisLegendItem } from './legend_item';
|
||||
import { getPieNames } from './pie_utils';
|
||||
import { getTableAggs } from '../../../visualize/loader/pipeline_helpers/utilities';
|
||||
import { getTableAggs } from '../../../legacy_imports';
|
||||
|
||||
export interface VisLegendProps {
|
||||
vis: any;
|
||||
|
@ -138,7 +138,7 @@ export class VisLegend extends PureComponent<VisLegendProps, VisLegendState> {
|
|||
this.setState({
|
||||
labels: [
|
||||
{
|
||||
label: i18n.translate('common.ui.vis.visTypes.legend.loadingLabel', {
|
||||
label: i18n.translate('visTypeVislib.vislib.legend.loadingLabel', {
|
||||
defaultMessage: 'loading…',
|
||||
}),
|
||||
},
|
||||
|
@ -244,13 +244,13 @@ export class VisLegend extends PureComponent<VisLegendProps, VisLegendState> {
|
|||
className={classNames('visLegend__toggle kbn-resetFocusState', {
|
||||
'visLegend__toggle--isOpen': open,
|
||||
})}
|
||||
aria-label={i18n.translate('common.ui.vis.visTypes.legend.toggleLegendButtonAriaLabel', {
|
||||
aria-label={i18n.translate('visTypeVislib.vislib.legend.toggleLegendButtonAriaLabel', {
|
||||
defaultMessage: 'Toggle legend',
|
||||
})}
|
||||
aria-expanded={Boolean(open)}
|
||||
aria-controls={this.legendId}
|
||||
data-test-subj="vislibToggleLegend"
|
||||
title={i18n.translate('common.ui.vis.visTypes.legend.toggleLegendButtonTitle', {
|
||||
title={i18n.translate('visTypeVislib.vislib.legend.toggleLegendButtonTitle', {
|
||||
defaultMessage: 'Toggle legend',
|
||||
})}
|
||||
>
|
|
@ -77,7 +77,7 @@ const VisLegendItemComponent = ({
|
|||
const filterOptions: EuiButtonGroupOption[] = [
|
||||
{
|
||||
id: 'filterIn',
|
||||
label: i18n.translate('common.ui.vis.visTypes.legend.filterForValueButtonAriaLabel', {
|
||||
label: i18n.translate('visTypeVislib.vislib.legend.filterForValueButtonAriaLabel', {
|
||||
defaultMessage: 'Filter for value {legendDataLabel}',
|
||||
values: { legendDataLabel: item.label },
|
||||
}),
|
||||
|
@ -86,7 +86,7 @@ const VisLegendItemComponent = ({
|
|||
},
|
||||
{
|
||||
id: 'filterOut',
|
||||
label: i18n.translate('common.ui.vis.visTypes.legend.filterOutValueButtonAriaLabel', {
|
||||
label: i18n.translate('visTypeVislib.vislib.legend.filterOutValueButtonAriaLabel', {
|
||||
defaultMessage: 'Filter out value {legendDataLabel}',
|
||||
values: { legendDataLabel: item.label },
|
||||
}),
|
||||
|
@ -105,7 +105,7 @@ const VisLegendItemComponent = ({
|
|||
type="multi"
|
||||
isIconOnly
|
||||
isFullWidth
|
||||
legend={i18n.translate('common.ui.vis.visTypes.legend.filterOptionsLegend', {
|
||||
legend={i18n.translate('visTypeVislib.vislib.legend.filterOptionsLegend', {
|
||||
defaultMessage: '{legendDataLabel}, filter options',
|
||||
values: { legendDataLabel: item.label },
|
||||
})}
|
||||
|
@ -131,7 +131,7 @@ const VisLegendItemComponent = ({
|
|||
onBlur={onUnhighlight}
|
||||
data-label={item.label}
|
||||
title={item.label}
|
||||
aria-label={i18n.translate('common.ui.vis.visTypes.legend.toggleOptionsButtonAriaLabel', {
|
||||
aria-label={i18n.translate('visTypeVislib.vislib.legend.toggleOptionsButtonAriaLabel', {
|
||||
defaultMessage: '{legendDataLabel}, toggle options',
|
||||
values: { legendDataLabel: item.label },
|
||||
})}
|
||||
|
@ -163,7 +163,7 @@ const VisLegendItemComponent = ({
|
|||
<div className="visLegend__valueColorPicker" role="listbox">
|
||||
<span id={`${legendId}ColorPickerDesc`} className="euiScreenReaderOnly">
|
||||
<FormattedMessage
|
||||
id="common.ui.vis.visTypes.legend.setColorScreenReaderDescription"
|
||||
id="visTypeVislib.vislib.legend.setColorScreenReaderDescription"
|
||||
defaultMessage="Set color for value {legendDataLabel}"
|
||||
values={{ legendDataLabel: item.label }}
|
||||
/>
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue