Skip to content

How to handle click in a Histogram BarSeries? #102

Closed

Description

@bmantoni

I tried putting an onClick handler in the BarSeries within the Histogram, and on the Histogram, no luck. Is this possible?

            <Histogram
            ariaLabel="My histogram of ..."
            orientation="vertical"
            width={380}
            height={280}
            cumulative={false}
            normalized
            binCount={this.state.numBins}
            valueAccessor={datum => datum.overallPercentile}
            binType="numeric"
            renderTooltip={({ event, datum, data, color }) => (
                <div style={{'left': '15px', top: '15px'}}>
                    <strong style={{ color }}>{datum.bin0} to {datum.bin1}</strong>
                    <div><strong>count </strong>{datum.count}</div>
                    <div><strong>cumulative </strong>{datum.cumulative}</div>
                    <div><strong>density </strong>{datum.density}</div>
                </div>
            )}
            >
            <BarSeries
                animated
                rawData={this.state.candidateList /* or binnedData={...} */}
                onClick={(e) => console.log('bar clicked ' + e)}
            />
            <XAxis />
            <YAxis />
            </Histogram>

Activity

  1. williaster commented on May 23, 2018

    @williaster
    Owner

    Hey @bmantoni thanks for checking out @data-ui! This is currently not supported but will be trivial to add. I should be able to get to it today and will tag you in the PR 👍

  2. bmantoni commented on May 23, 2018

    @bmantoni
    Author

    Hey! That would be amazing. Working on something I'd like to demo around the company - interactions between a list and visuals - so knowing which bar/bin got clicked and updating the data source/list. This feature will really help.
    Appreciate your reply and your work here :)

  3. williaster commented on May 23, 2018

    @williaster
    Owner

    @bmantoni this should be fixed in @data-ui/histogram@0.0.57

  4. bmantoni commented on May 23, 2018

    @bmantoni
    Author

    Worked like a charm, thanks! 🥇 👍

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