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 specifying curve and other props on LineSeries in LineChart component #41253

Open
ecgan opened this issue Jan 22, 2025 · 2 comments
Open
Labels
[Experiment] AI labels added [JS Package] Charts [Pri] Normal [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it

Comments

@ecgan
Copy link
Member

ecgan commented Jan 22, 2025

Impacted plugin

None / Other

What

I would like to have different curve property for the line series when I use the LineChart component.

How

Currently the line series in the LineChart component is built like this:

<AnimatedLineSeries
key={ seriesData?.label }
dataKey={ seriesData?.label }
data={ seriesData.data as DataPointDate[] } // TODO: this needs fixing or a more specific type for each chart
{ ...accessors }
stroke={ stroke }
strokeWidth={ 2 }
/>

The LineChart uses the default curveLinear factory (see https://airbnb.io/visx/docs/xychart#AnimatedLineSeries_curve). There isn't a way to specify a different curve factory.

In WooCommerce Analytics, we would like to have a different curve - see design screenshot below:

Image

The above can be done manually by doing something like this:

import { curveNatural } from '@visx/curve';

<LineSeries
	curve={ curveNatural }
/>

It would be good if the LineChart component can support different curves. Even better if it can support other LineSeries properties (not just curve), such as strokeWidth which is currently hardcoded with the value 2.

@ecgan ecgan added [JS Package] Charts [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it labels Jan 22, 2025
Copy link
Contributor

OpenAI suggested the following labels for this issue:

  • [Feature Group] WooCommerce Analytics: The issue specifically relates to the WooCommerce Analytics plugin and its use of the LineChart component.
  • [Feature] WooCommerce Analytics: The enhancement being requested directly impacts the functionality and flexibility of the WooCommerce Analytics data visualization.
  • [Feature] Custom CSS: Allowing customization options such as setting different curves and stroke widths implies a need for additional styling capabilities, often achieved through custom CSS.

Copy link
Contributor

This issue could use some more labels, to help prioritize and categorize our work. Could you please add at least a [Type], a [Feature], and a [Pri] label?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Experiment] AI labels added [JS Package] Charts [Pri] Normal [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Projects
None yet
Development

No branches or pull requests

2 participants