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

Allow passing raw values with ContextAccessor #2527

Open
nickofthyme opened this issue Sep 16, 2024 · 0 comments
Open

Allow passing raw values with ContextAccessor #2527

nickofthyme opened this issue Sep 16, 2024 · 0 comments
Assignees
Labels
:data Data/series/scales related issue enhancement New feature or request :xy Bar/Line/Area chart related

Comments

@nickofthyme
Copy link
Collaborator

nickofthyme commented Sep 16, 2024

When aggregating data to pass to the Chart, there are some cases where the raw value is a non-primitive value. A great example of this is the range type which is an object similar to that below.

{
  "gte": 0,
  "lt": 100,
  "label": "My range",
}

Currently in many places in kibana, especially in Lens, we format these values before passing the data to the chart. This works fine for most cases but sometimes we want the raw value and determining this after the fact is complex and challenging.

The proposal is to add a valueAccessor to each of the accessors including x, y, x0, y0 and split. This would enable something like the following, to pass the raw value and easily convert that value into a primitive value for use in the chart.

const MyChart = (
  <Chart>
    <BarSeries
      xAccessor="x"
      splitSeriesAccessor={["split"]}
      splitSeriesValueAccessor={(range) => formatRange(range)}
      data=[
         { x: 0, split: { gte: 0, lt: 100 } },
       ]
    />
  </Chart>
)

This was originally suggested in #808 and POC's in #837, but at the time the functional accessors were deemed sufficient. With new context surrounding this issue, this is desired to improve chart control functions in kibana/Lens.

@nickofthyme nickofthyme added :data Data/series/scales related issue :xy Bar/Line/Area chart related enhancement New feature or request labels Sep 16, 2024
@nickofthyme nickofthyme self-assigned this Sep 16, 2024
@nickofthyme nickofthyme changed the title [Data] Allow passing raw values with ContextAccessor Allow passing raw values with ContextAccessor Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:data Data/series/scales related issue enhancement New feature or request :xy Bar/Line/Area chart related
Projects
None yet
Development

No branches or pull requests

1 participant