Skip to content
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

[Rect Anno] Support outside range fill #2051

Closed
nickofthyme opened this issue May 26, 2023 · 2 comments
Closed

[Rect Anno] Support outside range fill #2051

nickofthyme opened this issue May 26, 2023 · 2 comments
Labels
:annotation Annotation (line, rect, text) related issue enhancement New feature or request kibana cross issue Has a Kibana issue counterpart

Comments

@nickofthyme
Copy link
Collaborator

nickofthyme commented May 26, 2023

Is your feature request related to a problem? Please describe.

Currently RectAnnotations only support filling the inside of a data range. This issue proposes adding the ability to fill outside of a defined data range.

Describe the solution you'd like

Possibly add create a new fill property for inside and outside options.

We should be mindful of the existing outside and outsideDimension properties to not create confusion, may be necessary to refactor these to be more clear between the duplicate use of outside.

export type RectAnnotationSpec = BaseAnnotationSpec<
  typeof AnnotationType.Rectangle,
  RectAnnotationDatum,
  RectAnnotationStyle
> & {
  /**
   * @deprecated use customTooltipDetails
   */
  renderTooltip?: AnnotationTooltipFormatter;
  /**
   * z-index of the annotation relative to other elements in the chart
   * @defaultValue -1
   */
  zIndex?: number;
  /**
   * Renders annotation outside of chart area within axis gutter
   *
   * @defaultValue false
   */
  outside?: boolean;
  /**
   * Dimension, either height or width, of outside annotation
   */
  outsideDimension?: number;
};

Additional context

Related to #1200

Kibana Cross Issues

elastic/kibana#133784

@markov00
Copy link
Member

I don't believe too much into having this as a feature of elastic-charts, excluding a range can be achieved by adding 2 ranges in the 2 outside areas. Having this in elastic-charts will be just a "simplification" for the current existing API.

In any case we should probably call it differently than outside/inside, something like include/exclude the range could work (where include is the area within the range, and exclude is the area outside the range)

@nickofthyme
Copy link
Collaborator Author

Agreed, since both lower and upper bounds of the annotations default to +♾️ /-♾️ , this is an easy task for the consumer to implement. See https://codesandbox.io/s/pedantic-moon-bphvql?file=/src/App.tsx

 <RectAnnotation
   ...
   dataValues={[
     {
       coordinates: {
+        x1: 4,
-        x0: 4,
-        x1: 5,
       },
+      details: 'outside left',
-      details: 'inside',
     },
+    {
+      coordinates: {
+        x0: 5,
+      },
+      details: 'outside right',
+    },
   ]}
 />

@nickofthyme nickofthyme closed this as not planned Won't fix, can't repro, duplicate, stale May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:annotation Annotation (line, rect, text) related issue enhancement New feature or request kibana cross issue Has a Kibana issue counterpart
Projects
None yet
Development

No branches or pull requests

2 participants