-
Notifications
You must be signed in to change notification settings - Fork 1
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
bfs: support all charts #13
base: master
Are you sure you want to change the base?
Conversation
// Seems like the registered chart components change some | ||
// props in-place, which leads to unwanted side effects. Therefore, | ||
// we only pass a copy. | ||
JSON.parse(JSON.stringify(feature)), |
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.
minor: maybe lodash.clone(..)
could be used
// Seems like the registered chart components change some | ||
// props in-place, which leads to unwanted side effects. Therefore, | ||
// we only pass a copy. | ||
JSON.parse(JSON.stringify(chart.feature)), |
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.
minor: maybe lodash.clone(..) could be used
recreateCharts = true; | ||
} | ||
if ( | ||
JSON.stringify(currentChartConfigs) !== |
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.
minor: maybe lodash.isEqual(...)
could be used
@@ -108,27 +106,48 @@ export const groupByLocation = ( | |||
const currentLocation = locations[loc]; | |||
|
|||
if (Array.isArray(currentLocation)) { | |||
currentLocation.push(d); | |||
const item = { |
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.
minor: maybe use loadash function here: https://lodash.com/docs/4.17.15#clone
const transformedProps = chartTransformer(config); | ||
|
||
const feature: ChartConfigFeature = { | ||
type: 'Feature', | ||
geometry: JSON.parse(location), | ||
properties: transformedProps, | ||
properties: { |
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.
minor: maybe use lodash function here https://lodash.com/docs/4.17.15#clone
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.
some more suggestions
const c = await registry.getAsPromise(vizType); | ||
setChart(() => c); |
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.
writing the full variable name is better to understand IMHO
const c = await registry.getAsPromise(vizType); | |
setChart(() => c); | |
const chart = await registry.getAsPromise(vizType); | |
setChart(() => chart); |
const chartLayer = layers | ||
.getArray() | ||
.filter(layer => layer instanceof ChartLayer)[0] as ChartLayer; |
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.
maybe find
makes the code slightly easier to read https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find
const { r, g, b, a } = chartBackgroundColor; | ||
const cssColor = `rgba(${r}, ${g}, ${b}, ${a})`; |
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.
move outside of if/else block for minor simplification
const { r, g, b, a } = chartBackgroundColor; | ||
const cssColor = `rgba(${r}, ${g}, ${b}, ${a})`; |
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.
move outside of if/else block for minor simplification
Welcome to Codecov 🎉Once merged to your default branch, Codecov will compare your coverage reports and display the results in this comment. Thanks for integrating Codecov - We've got you covered ☂️ |
This adds support for any chart type - not only echarts. This is done retrieving the required component from the component registry. Also some bugs were fixed.
@JakobMiksch please review