-
Notifications
You must be signed in to change notification settings - Fork 117
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
feat(chart-provider): add component to wrap charts #4236
base: main
Are you sure you want to change the base?
Conversation
|
🦋 Changeset detectedLatest commit: 6a90b9c The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
{ | ||
"name": "@twilio-paste/chart-provider", | ||
"version": "0.0.0", | ||
"category": "data display", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure exactly what category we want to use for these charting components. What do you all think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unless we are adding a new category related to visualisation, data display looks good
View your CI Pipeline Execution ↗ for commit 6a90b9c.
☁️ Nx Cloud last updated this comment at |
View your CI Pipeline Execution ↗ for commit 6a90b9c.
☁️ Nx Cloud last updated this comment at |
highchartsOptions: Highcharts.Options; | ||
pasteOptions?: never; | ||
} | ||
|
||
export type ChartProviderProps = HighchartsOptions; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit redundant at this point as there is only one type but sets the groundwork for union types that will only allow users to either set pasteOptions
or highchartsOptions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good future thinking
// eslint-disable-next-line object-shorthand | ||
redraw: function (this) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When using highcharts you have to use these verbose functions and this syntax. Tried it other ways but just doesn't work :/
Size Change: +255 B (0%) Total Size: 1.12 MB
ℹ️ View Unchanged
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 6a90b9c:
|
Paste
|
Project |
Paste
|
Branch Review |
feat-chart-context-provider
|
Run status |
|
Run duration | 01m 59s |
Commit |
|
Committer | Kristian Antrobus |
View all properties for this run ↗︎ |
Test results | |
---|---|
|
0
|
|
0
|
|
0
|
|
0
|
|
67
|
View all changes introduced in this branch ↗︎ |
{ | ||
"name": "@twilio-paste/chart-provider", | ||
"version": "0.0.0", | ||
"category": "data display", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unless we are adding a new category related to visualisation, data display looks good
* The current chart type. Used to trigger rerenders of other components inside ChartProvider. | ||
* | ||
* @type {string} | ||
* @memberof ChartContextProps | ||
*/ | ||
chartType?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how will this string be used to trigger re-renders or other components?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When working on the sandbox I found that custom components that rendered based on nested elements could not pick up changes to re-render.
Specifically for this I had a legend that would look at the current series and see if there was a marker symbol used to show the correct marker in the legend. When switching between chart types it would no cause a re-render due to react only shallow comparing the chart context object. Picking up the change in the chart type options and listening for that fixed the issue.
It is not needed for this release so I'm happy to leave out and investigate further if there is a better way to capture this to avoid a breaking change in future.
highchartsOptions: Highcharts.Options; | ||
pasteOptions?: never; | ||
} | ||
|
||
export type ChartProviderProps = HighchartsOptions; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good future thinking
Adds the new component
ChartProvider
used to manage state for the child chart implementations.Added additional typedocs to the context attributes so developer understand the usage correctly when creating their own context providers or when using them in the custom components.
Added some storybooks and unit tests to be sure the callbacks and hooks function correctly.
Storybooks I am implementing a chart to fully test the context functions but the chart component is not included with this provider.