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

bfs: support all charts #13

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

bfs: support all charts #13

wants to merge 3 commits into from

Conversation

jansule
Copy link
Member

@jansule jansule commented Feb 16, 2023

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.

superset-cartodiagram

@JakobMiksch please review

// 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)),

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

https://www.geeksforgeeks.org/lodash-_-clone-method/

// 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)),

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

https://www.geeksforgeeks.org/lodash-_-clone-method/

recreateCharts = true;
}
if (
JSON.stringify(currentChartConfigs) !==

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

https://lodash.com/docs/4.17.15#isEqual

@@ -108,27 +106,48 @@ export const groupByLocation = (
const currentLocation = locations[loc];

if (Array.isArray(currentLocation)) {
currentLocation.push(d);
const item = {

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: {

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

Copy link

@JakobMiksch JakobMiksch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some more suggestions

Comment on lines +34 to +35
const c = await registry.getAsPromise(vizType);
setChart(() => c);

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

Suggested change
const c = await registry.getAsPromise(vizType);
setChart(() => c);
const chart = await registry.getAsPromise(vizType);
setChart(() => chart);

Comment on lines 252 to 254
const chartLayer = layers
.getArray()
.filter(layer => layer instanceof ChartLayer)[0] as ChartLayer;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 350 to 351
const { r, g, b, a } = chartBackgroundColor;
const cssColor = `rgba(${r}, ${g}, ${b}, ${a})`;

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

Comment on lines 384 to 385
const { r, g, b, a } = chartBackgroundColor;
const cssColor = `rgba(${r}, ${g}, ${b}, ${a})`;

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

@codecov-commenter
Copy link

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 ☂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants