Skip to content

Passing of properties to children of Chart component #8

Description

@benhowes

With the top level chart component - I issued a PR the other week which we merged in to pass down label's to the Axis components, but it seems that there are more properties to pass down too, such as padding.

I was wondering if the way that properties are passed down also needs to be a bit smarter about how it overrides properties on a component. If you want 2 Yaxis components for example (left&right), then you would not be able to do:

<LineChart ....>
   ....
   <YAxis yTickOrient='left' />
   <YAxis yTickOrient='right' />
</LineChart>

Because the properties would be overridden by https://github.com/react-d3/react-d3-shape/blob/master/src/chart.jsx#L100-L123. Importantly, this also seems to affect completely custom child components too.

It should be possible to merge the properties of the children with the chart so that overridden properties are not lost. an Object.assign ought to be enough.

Are you happy to accept a PR for this?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions