Skip to content

Can't Dynamically Set Size For Chart #7

@shal-xu

Description

@shal-xu

My goal is to let different charts have different sizes. For example, I might have a size prop in my component, and big would mean the chart is rendered bigger.

According to docs of keen-dataviz, It's better to control the size using the CSS of the container HTML element.
(While it's also possible to directly pass in {size: {width:..., height:xxx }}) to c3, it seems to only work for height, and not width.

Except we don't have access to the <div> directly in keen-react-charts.

I have tried adding two classNames through theme, e.g. theme="keen-dataviz my-own-class", but that seems to break the whole chart.

The solution could come in a variety of ways, but here are some I could see:

  1. Allow passing in a style prop to <Chart>, which will then be applied on the <div>
  2. Allow passing in a size prop to <Chart>, which will then be applied on the <div>
  3. Allow passing in multiple classNames as theme to <Chart>, which will then be applied on the <div>
  4. Allow passing in a id prop to <Chart>, which will then be applied on the <div>

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