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 customization of sub series names #245

Closed
3 tasks
emmacunningham opened this issue Jun 19, 2019 · 3 comments
Closed
3 tasks

Allow customization of sub series names #245

emmacunningham opened this issue Jun 19, 2019 · 3 comments
Assignees
Labels
discuss To be discussed enhancement New feature or request :interactions Interactions related issue :legend Legend related issue

Comments

@emmacunningham
Copy link
Contributor

emmacunningham commented Jun 19, 2019

Is your feature request related to a problem? Please describe.
Currently the name for a sub series is automatically created by concatenating the split series values and yAccessors. This leads to issues in both the legend and element hover tooltip when the split series values need to be formatted.

(in the example below, the UUIDs are defined as yAccessors, not splitSeriesAccessors)
image

Describe the solution you'd like
This is related to the request in #241 though not completely the same as with that request, the user may want to do more than just the series name formatting.

For this enhancement, we could do something similar to how @nickofthyme is extending the Accessor type for colorAccessors so that we can define either a string field accessor as we do now (in which case the series name would be the default concatenation) or a function which has specId and colorValues params that can be used to return a custom formatted string.

Describe alternatives you've considered
We already have the name prop on a series and could use that; the problem there is that for a split series, we may want different custom names per split series and so just using the one name prop may not be the best.

The other possibility is that instead of adding the function as a type on splitSeriesAccessors and yAccessors, we could add it to name instead and ensure that if name is defined, it always takes precedence over the default.

Additional context
related to #241

Kibana Cross Issues
Add any Kibana related issues/feature requests here.

Checklist

  • this request is checked against already exist requests
  • every related Kibana issue is listed under Kibana Cross Issues list
  • kibana cross issue tag is associated to the issue if any kibana cross issue is present
@emmacunningham emmacunningham added enhancement New feature or request discuss To be discussed :interactions Interactions related issue :legend Legend related issue labels Jun 19, 2019
@emmacunningham emmacunningham changed the title Allow customization of split series name Allow customization of sub series names Jun 19, 2019
nickofthyme added a commit to nickofthyme/elastic-charts that referenced this issue Aug 6, 2019
Allow user to set custom names for series based on DataSeriesColorsValues

elastic#245
@angorayc
Copy link

Hello,
I am excited about this feature, as we have similar request in SIEM.
When splitAccessor's got a single value, the legend label shows different from what we expected.
elastic/kibana#48260 (comment)
I'm looking forward to have the same behaviour for showing the legend label doesn't matter how many group we have in the dataset.
Thank you for taking this into consideration.

@nickofthyme
Copy link
Collaborator

Hey @angorayc we needed to refactor some of the code in order to make this work in a useful way without going through the rigmarole of this 👇

const barCustomSeriesNames: CustomSeriesNamesMap = new Map();
const barDataSeries: DataSeriesColorsValues = {
  colorValues: ['cloudflare.com', 'direct-cdn', 'y2'],
  specId: getSpecId('bars'),
};
barCustomSeriesNames.set(barDataSeries, 'MY CUSTOM SERIES');

return (
  <Chart className="story-chart">
    {/* base config stuff */}

    <BarSeries
      id={getSpecId('bars')}
      xScaleType={ScaleType.Linear}
      yScaleType={ScaleType.Linear}
      xAccessor="x"
      yAccessors={['y1', 'y2']}
      splitSeriesAccessors={['g1', 'g2']}
      customSeriesNames={barCustomSeriesNames}
      data={TestDatasets.BARCHART_2Y2G}
    />
  </Chart>
)

The good news is that that work is currently in progress and I expect this feature to be available sooner rather than later. See progress in PR #419

@markov00
Copy link
Member

@nickofthyme I think we can close this as it's solved in #539, is it right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discuss To be discussed enhancement New feature or request :interactions Interactions related issue :legend Legend related issue
Projects
None yet
Development

No branches or pull requests

4 participants