Skip to content

Commit

Permalink
Move mock data to its own file
Browse files Browse the repository at this point in the history
  • Loading branch information
stratoula committed Oct 19, 2021
1 parent 8102c77 commit 482b5c7
Show file tree
Hide file tree
Showing 2 changed files with 224 additions and 216 deletions.
217 changes: 1 addition & 216 deletions src/plugins/vis_types/xy/public/config/get_config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,222 +7,7 @@
*/

import { getConfig } from './get_config';
import type { Datatable } from '../../../../expressions/public';
import type { VisParams } from '../types';

const visData = {
type: 'datatable',
columns: [
{
id: 'col-0-2',
name: 'timestamp per 12 hours',
meta: {
type: 'date',
field: 'timestamp',
index: 'kibana_sample_data_logs',
},
},
{
id: 'col-1-3',
name: 'Average memory',
meta: {
type: 'number',
field: 'memory',
index: 'kibana_sample_data_logs',
},
},
{
id: 'col-2-1',
name: 'Average bytes',
meta: {
type: 'number',
field: 'bytes',
index: 'kibana_sample_data_logs',
},
},
],
rows: [
{
'col-0-2': 1632603600000,
'col-1-3': 27400,
'col-2-1': 6079.305555555556,
},
{
'col-0-2': 1632646800000,
'col-1-3': 148270,
'col-2-1': 6164.056818181818,
},
{
'col-0-2': 1632690000000,
'col-1-3': 235280,
'col-2-1': 6125.469387755102,
},
{
'col-0-2': 1632733200000,
'col-1-3': 206750,
'col-2-1': 5362.68306010929,
},
],
} as Datatable;

const visParamsWithTwoYAxes = {
type: 'histogram',
addLegend: true,
addTooltip: true,
legendPosition: 'right',
addTimeMarker: false,
maxLegendLines: 1,
truncateLegend: true,
categoryAxes: [
{
type: 'category',
id: 'CategoryAxis-1',
show: true,
position: 'bottom',
title: {},
scale: {
type: 'linear',
},
labels: {
filter: true,
show: true,
truncate: 100,
},
},
],
labels: {
type: 'label',
show: false,
},
thresholdLine: {
type: 'threshold_line',
show: false,
value: 10,
width: 1,
style: 'full',
color: '#E7664C',
},
valueAxes: [
{
type: 'value',
name: 'LeftAxis-1',
id: 'ValueAxis-1',
show: true,
position: 'left',
axisType: 'value',
title: {
text: 'my custom title',
},
scale: {
type: 'linear',
mode: 'normal',
scaleType: 'linear',
},
labels: {
type: 'label',
filter: false,
rotate: 0,
show: true,
truncate: 100,
},
},
{
type: 'value',
name: 'RightAxis-1',
id: 'ValueAxis-2',
show: true,
position: 'right',
title: {
text: 'my custom title',
},
scale: {
type: 'linear',
mode: 'normal',
},
labels: {
filter: false,
rotate: 0,
show: true,
truncate: 100,
},
},
],
grid: {
categoryLines: false,
},
seriesParams: [
{
type: 'histogram',
data: {
label: 'Average memory',
id: '3',
},
drawLinesBetweenPoints: true,
interpolate: 'linear',
lineWidth: 2,
mode: 'stacked',
show: true,
showCircles: true,
circlesRadius: 3,
seriesParamType: 'histogram',
valueAxis: 'ValueAxis-2',
},
{
type: 'line',
data: {
label: 'Average bytes',
id: '1',
},
drawLinesBetweenPoints: true,
interpolate: 'linear',
lineWidth: 2,
mode: 'stacked',
show: true,
showCircles: true,
circlesRadius: 3,
valueAxis: 'ValueAxis-1',
},
],
dimensions: {
x: {
type: 'xy_dimension',
label: 'timestamp per 12 hours',
aggType: 'date_histogram',
accessor: 0,
format: {
id: 'date',
params: {
pattern: 'YYYY-MM-DD HH:mm',
},
},
params: {
date: true,
},
},
y: [
{
label: 'Average memory',
aggType: 'avg',
params: {},
accessor: 1,
format: {
id: 'number',
params: {},
},
},
{
label: 'Average bytes',
aggType: 'avg',
params: {},
accessor: 2,
format: {
id: 'bytes',
params: {},
},
},
],
},
} as unknown as VisParams;
import { visData, visParamsWithTwoYAxes } from '../mocks';

// ToDo: add more tests for all the config properties
describe('getConfig', () => {
Expand Down
Loading

0 comments on commit 482b5c7

Please sign in to comment.