-
Notifications
You must be signed in to change notification settings - Fork 120
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
Comments
Allow user to set custom names for series based on DataSeriesColorsValues elastic#245
Hello, |
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 |
@nickofthyme I think we can close this as it's solved in #539, is it right? |
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
, notsplitSeriesAccessors
)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
andcolorValues
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 onename
prop may not be the best.The other possibility is that instead of adding the function as a type on
splitSeriesAccessors
andyAccessors
, we could add it toname
instead and ensure that ifname
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
Kibana Cross Issues
listkibana cross issue
tag is associated to the issue if any kibana cross issue is presentThe text was updated successfully, but these errors were encountered: