-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[XY] Support vis_dimension
type for accessors
#128063
[XY] Support vis_dimension
type for accessors
#128063
Conversation
…to chart_expressions-xy
# Conflicts: # src/plugins/chart_expressions/expression_xy/common/expression_functions/legend_config.ts # x-pack/plugins/lens/public/xy_visualization/visualization.tsx
…to chart_expressions-xy
# Conflicts: # x-pack/test/functional/apps/lens/show_underlying_data.ts
…art_expressions-xy-support-visdimension-type
…y-support-visdimension-type
src/plugins/chart_expressions/expression_xy/public/components/reference_lines.tsx
Show resolved
Hide resolved
…pressions-xy-support-visdimension-type # Conflicts: # packages/kbn-optimizer/limits.yml # src/plugins/chart_expressions/expression_xy/public/components/reference_lines.tsx
Pinging @elastic/kibana-vis-editors @elastic/kibana-vis-editors-external (Team:VisEditors) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First glance at the code: LGTM 👍 Left a couple of nits.
I'll test locally tomorrow.
@@ -23,7 +27,9 @@ export const getAppliedTimeRange = (layers: DataLayerArgs[], data: LensMultiTabl | |||
return Object.entries(data.tables) | |||
.map(([tableId, table]) => { | |||
const layer = layers.find((l) => l.layerId === tableId); | |||
const xColumn = table.columns.find((col) => col.id === layer?.xAccessor); | |||
const xColumn = layer?.xAccessor | |||
? getColumnByAccessor(layer?.xAccessor, table.columns) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: you can use layer.xAccessor
here.
.flatMap((layer) => | ||
data.tables[layer.layerId].rows.map((row) => row[layer.xAccessor!].valueOf() as number) | ||
) | ||
.flatMap((layer) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: instead of using as number
, you could use flatMap<number>
here.
PS: I know, you are not the author of this code.
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]Public APIs missing comments
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: cc @VladLasitsa |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found such a weird bug. Could you, please, address it.
Screen.Recording.2022-04-01.at.16.59.49.mov
Expression:
kibana
| lens_merge_tables layerIds="f6ed53d9-fc5d-4051-85c1-f6a3eba00726"
layerIds="8975a4f4-46c0-4481-9c91-1c036feb489d"
tables={esaggs index={indexPatternLoad id="90943e30-9a47-11e8-b64d-95841ca0b247"} aggs={aggDateHistogram id="0" enabled=true schema="segment" field="@timestamp" useNormalizedEsInterval=true interval="auto" drop_partials=false min_doc_count=0 extended_bounds={extendedBounds} extendToTimeRange=true} aggs={aggAvg id="1" enabled=true schema="metric" field="bytes"} metricsAtAllLevels=false partialRows=false timeFields="@timestamp" | lens_rename_columns idMap="{\"col-0-0\":{\"label\":\"@timestamp\",\"dataType\":\"date\",\"operationType\":\"date_histogram\",\"sourceField\":\"@timestamp\",\"isBucketed\":true,\"scale\":\"interval\",\"params\":{\"interval\":\"auto\",\"includeEmptyRows\":true,\"dropPartials\":false},\"id\":\"c2305c94-6b9e-4e8d-a46a-c10b79c76f01\"},\"col-1-1\":{\"label\":\"Average of bytes\",\"dataType\":\"number\",\"operationType\":\"average\",\"sourceField\":\"bytes\",\"isBucketed\":false,\"scale\":\"ratio\",\"params\":{\"emptyAsNull\":true},\"id\":\"4bca57f0-7d03-4fb3-b7a7-e1b6f418eac9\"}}"}
tables={createTable rowCount=1 | mathColumn id="26f34410-a1f5-42eb-bc10-6dc4bc893ac4" name="Static value: 7299" expression="7299"}
| xyVis title="" description="" xTitle="" yTitle="" yRightTitle="" legend={legendConfig isVisible=true position="right" shouldTruncate=true} fittingFunction="None" endValue="None" emphasizeFitting=false curveType="LINEAR" fillOpacity=0.3 yLeftExtent={axisExtentConfig mode="full"} yRightExtent={axisExtentConfig mode="full"}
axisTitlesVisibilitySettings={axisTitlesVisibilityConfig x=true yLeft=true yRight=true} tickLabelsVisibilitySettings={tickLabelsConfig x=true yLeft=true yRight=true} gridlinesVisibilitySettings={gridlinesConfig x=true yLeft=true yRight=true} labelsOrientation={labelsOrientationConfig x=0 yLeft=0 yRight=0} valueLabels="hide" hideEndzones=false valuesInLegend=false
layers={dataLayer layerId="f6ed53d9-fc5d-4051-85c1-f6a3eba00726" hide=false xAccessor="c2305c94-6b9e-4e8d-a46a-c10b79c76f01" yScaleType="linear" xScaleType="time" isHistogram=true seriesType="bar_stacked" accessors={visdimension "4bca57f0-7d03-4fb3-b7a7-e1b6f418eac9"} columnToLabel="{\"4bca57f0-7d03-4fb3-b7a7-e1b6f418eac9\":\"Average of bytes\"}" palette={system_palette name="default"}}
layers={referenceLineLayer layerId="8975a4f4-46c0-4481-9c91-1c036feb489d" yConfig={yConfig forAccessor="26f34410-a1f5-42eb-bc10-6dc4bc893ac4" axisMode="left" color="#69707d" lineStyle="solid" lineWidth=1 fill="none" iconPosition="auto" textVisibility=false} accessors={visdimension "26f34410-a1f5-42eb-bc10-6dc4bc893ac4"} columnToLabel="{\"26f34410-a1f5-42eb-bc10-6dc4bc893ac4\":\"Static value: 7299\"}"}
Completes part of #127115
Summary
Added full support of visdimension at fields:
splitAccessor
,accessors
,xAccessor
,forAccessor