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

refactor(react-chart): move point coordinates calculations specifics down to the pointComponent #1753

Merged
merged 17 commits into from Jan 15, 2019

Conversation

Krijovnick
Copy link
Contributor

@Krijovnick Krijovnick commented Jan 10, 2019

BREAKING CHANGES:

Previously, pointComponent of BarSeries and PieSeries accepted precalculated fields (width and d, respectively). Now, pointComponent accepts fields that provide raw data for calculation. This makes pointComponent more flexible as the width and d fields can now be calculated the way you need.
 
The following substitutions took place:
 

  • width => barWidth and maxBarWidth
  • d => innerRadius, outerRadius, maxRadius, startAngle, and endAngle

scaleName,
seriesComponent,
pointComponent,
color,
Copy link
Contributor

Choose a reason for hiding this comment

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

There is no difference between color and restProps here.

pointComponent,
color,
...restProps
} = this.props;
const symbolName = Symbol(name);
const seriesItem = {
getPointTransformer,
createHitTester,
...this.props,
Copy link
Contributor

Choose a reason for hiding this comment

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

seriesItem contains common series configuration - specific and appearance settings are merged later in addSeries.
common configuration - settings separated from restProps several lines above.

// It is used to generate unique series dependent attribute names for patterns.
// *symbolName* cannot be used as it cannot be part of DOM attribute name.
const index = series.length;
return [...series, {
...props,
name: getUniqueName(series, props.name),
index,
points: createPoints(props.argumentField, props.valueField, data),
points: createPoints(props.argumentField, props.valueField, data, restProps),
palette, // TODO: For Pie only. Find a better place for it.
color: props.color || palette[index % palette.length],
Copy link
Contributor

Choose a reason for hiding this comment

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

color should be merged to restProps - otherwise there will be no color property in a series point.
restProps should be enumerated here instead of color.

Actually there is color property in a series point. But it is so because of {...restProps} in point-collection.jsx.

Let's add note in point-collection.jsx saying that restProps are used because of getAnimatedStyle and scales.

y: valueScale(point.value),
y1,
width,
spacingForBar: getWidth(argumentScale),
Copy link
Contributor

Choose a reason for hiding this comment

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

We should verify this name.

@Krijovnick Krijovnick merged commit fde7756 into DevExpress:master Jan 15, 2019
@Krijovnick Krijovnick deleted the series_to_point branch January 15, 2019 15:00
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.

None yet

4 participants