-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Small multiples in vis_type_xy plugin (#86880)
* Small multiples in vis_type_xy plugin * Fix tooltip and formatted split chart values * update advanced settings wording * Remove React import in files with no JSX and change the extension to .ts * Simplify conditions * fix bar interval on split charts in vislib * Fix charts not splitting for terms boolean fields * fix filtering for small multiples * Change tests interval values from 100 to 1000000 * Revert "Change tests interval values from 100 to 1000000" This reverts commit 92f9d1b. * Fix tests for interval issue in vislib (cherry picked from commit ef45b63) * Revert axis_scale changes related to interval * Enable _line_chart_split_chart test for new charts library * Move chart splitter id to const Co-authored-by: nickofthyme <nick.ryan.partridge@gmail.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
349fd5f
commit 191ad14
Showing
20 changed files
with
213 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* and the Server Side Public License, v 1; you may not use this file except in | ||
* compliance with, at your election, the Elastic License or the Server Side | ||
* Public License, v 1. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { Accessor, AccessorFn, GroupBy, GroupBySort, SmallMultiples } from '@elastic/charts'; | ||
|
||
interface ChartSplitterProps { | ||
splitColumnAccessor?: Accessor | AccessorFn; | ||
splitRowAccessor?: Accessor | AccessorFn; | ||
sort?: GroupBySort; | ||
} | ||
|
||
const CHART_SPLITTER_ID = '__chart_splitter__'; | ||
|
||
export const ChartSplitter = ({ | ||
splitColumnAccessor, | ||
splitRowAccessor, | ||
sort, | ||
}: ChartSplitterProps) => | ||
splitColumnAccessor || splitRowAccessor ? ( | ||
<> | ||
<GroupBy | ||
id={CHART_SPLITTER_ID} | ||
by={(spec, datum) => { | ||
const splitTypeAccessor = splitColumnAccessor || splitRowAccessor; | ||
if (splitTypeAccessor) { | ||
return typeof splitTypeAccessor === 'function' | ||
? splitTypeAccessor(datum) | ||
: datum[splitTypeAccessor]; | ||
} | ||
return spec.id; | ||
}} | ||
sort={sort || 'dataIndex'} | ||
/> | ||
<SmallMultiples | ||
splitVertically={splitRowAccessor ? CHART_SPLITTER_ID : undefined} | ||
splitHorizontally={splitColumnAccessor ? CHART_SPLITTER_ID : undefined} | ||
/> | ||
</> | ||
) : null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 0 additions & 44 deletions
44
src/plugins/vis_type_xy/public/components/split_chart_warning.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.