elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.74k stars 8.14k forks source link

[uiActions] Allow brushing and filtering at the same time using combined context #103062

Open flash1293 opened 3 years ago

flash1293 commented 3 years ago

Right now it's either possible to emit an ui action for the VALUE_CLICK_TRIGGER or SELECT_RANGE_TRIGGER for chart interactions because our chart types allowed these two things.

However the elastic-charts heatmap allows selecting a rectangle of cells at the same time - if one of the axes is a histogram axis, this is basically a click and select range action at the same time: thenew

This should show the filter selection modal with three lines:

I suggest extending the value click trigger for this to handle ranges as well:

Current state:

export interface ValueClickContext<T extends IEmbeddable = IEmbeddable> {
  embeddable?: T;
  data: {
    data: Array<{
      table: Pick<Datatable, 'rows' | 'columns'>;
      column: number;
      row: number;
      value: any;
    }>;
    timeFieldName?: string;
    negate?: boolean;
  };
}

Extension:

export interface ValueClickContext<T extends IEmbeddable = IEmbeddable> {
  embeddable?: T;
  data: {
    data: Array<{
      table: Pick<Datatable, 'rows' | 'columns'>;
      column: number;
      row: number;
      value: any;
    } | {
      table: Pick<Datatable, 'rows' | 'columns'>;
      column: number;
      range: number[];
    }>;
    timeFieldName?: string;
    negate?: boolean;
  };
}

This is basically pulling the range context data into the value click context.

What do you think @ppisljar ?

elasticmachine commented 3 years ago

Pinging @elastic/kibana-app-services (Team:AppServices)

ppisljar commented 3 years ago

would that mean we get rid of the range select action completely ? should we simplify the typing then and say that we always do range selection, but possibly startdate === enddate for the case of simple value click ?

flash1293 commented 3 years ago

No strong opinion on how the API is going to look like

ppisljar commented 3 years ago

i would suggest something like this:

export interface ValueClickContext<T extends IEmbeddable = IEmbeddable> {
  embeddable?: T;
  data: {
    data: Array<{
      table: Pick<Datatable, 'rows' | 'columns'>;
      column: number;
      range: number[];
      value: any;
    }>;
    timeFieldName?: string;
    negate?: boolean;
  };
}

if range.from === range.to then its a simple click

elasticmachine commented 8 months ago

Pinging @elastic/appex-sharedux (Team:SharedUX)

elasticmachine commented 8 months ago

Pinging @elastic/kibana-visualizations (Team:Visualizations)

markov00 commented 8 months ago

This is now possible to implement in the tooltip actions, we can add a function that says filter both time and selected series.