diff --git a/x-pack/plugins/canvas/public/functions/plot/get_tick_hash.ts b/x-pack/plugins/canvas/public/functions/plot/get_tick_hash.ts index 68c1247275668..3b46967c2a360 100644 --- a/x-pack/plugins/canvas/public/functions/plot/get_tick_hash.ts +++ b/x-pack/plugins/canvas/public/functions/plot/get_tick_hash.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { get, sortBy } from 'lodash'; +import { get } from 'lodash'; import { PointSeriesColumns, DatatableRow, Ticks } from '../../../types'; export const getTickHash = (columns: PointSeriesColumns, rows: DatatableRow[]) => { @@ -21,23 +21,19 @@ export const getTickHash = (columns: PointSeriesColumns, rows: DatatableRow[]) = }; if (get(columns, 'x.type') === 'string') { - sortBy(rows, ['x']) - .reverse() - .forEach((row) => { - if (!ticks.x.hash[row.x]) { - ticks.x.hash[row.x] = ticks.x.counter++; - } - }); + rows.forEach((row) => { + if (!ticks.x.hash[row.x]) { + ticks.x.hash[row.x] = ticks.x.counter++; + } + }); } if (get(columns, 'y.type') === 'string') { - sortBy(rows, ['y']) - .reverse() - .forEach((row) => { - if (!ticks.y.hash[row.y]) { - ticks.y.hash[row.y] = ticks.y.counter++; - } - }); + rows.reverse().forEach((row) => { + if (!ticks.y.hash[row.y]) { + ticks.y.hash[row.y] = ticks.y.counter++; + } + }); } return ticks; diff --git a/x-pack/plugins/canvas/public/functions/plot/index.ts b/x-pack/plugins/canvas/public/functions/plot/index.ts index 47b9212bbc4c0..c0c73c3a21bc6 100644 --- a/x-pack/plugins/canvas/public/functions/plot/index.ts +++ b/x-pack/plugins/canvas/public/functions/plot/index.ts @@ -81,8 +81,7 @@ export function plotFunctionFactory( fn: (input, args) => { const seriesStyles: { [key: string]: SeriesStyle } = keyBy(args.seriesStyle || [], 'label') || {}; - - const sortedRows = sortBy(input.rows, ['x', 'y', 'color', 'size', 'text']); + const sortedRows = input.rows; const ticks = getTickHash(input.columns, sortedRows); const font = args.font ? getFontSpec(args.font) : {};