weknowinc / react-bubble-chart-d3

React Bubble Chart using D3
MIT License
57 stars 56 forks source link

buttonClickFunc not working #15

Closed af13s closed 5 years ago

af13s commented 6 years ago

The following is defined inside of a component. Defining a buttonClickFunc does not override the behavior of the default on click behavior which displays "Bubble [name of bubble] is clicked ..."

`createBubbleChart(){

            let graph = {
                zoom: 1.0,
                offsetX: -0.01,
                offsetY: -0.01,
            }

            let width = 1000
            let height = 1000

            let showLegend=false // optional value, pass false to disable the legend.
            let legendPercentage = 20 // number that represent the % of with that legend going to use.
            let legendFont={
                    family: 'Arial',
                    size: 12,
                    color: '#000',
                    weight: 'bold',
                }
            let valueFont={
                    family: 'Arial',
                    size: 12,
                    color: '#fff',
                    weight: 'bold',
                }
           let labelFont={
                    family: 'Arial',
                    size: 16,
                    color: '#fff',
                    weight: 'bold',
                }
            //Custom bubble/legend click functions such as searching using the label, redirecting to other page

            return <BubbleChart graph={graph}
                                width = {width}
                                height = {height}
                                showLegend = {showLegend}
                                legendPercentage = {legendPercentage}
                                legendFont = {legendFont}
                                valueFont = {valueFont}
                                labelFont  = {labelFont}
                                bubbleClickFunc={this.bubbleClick}
                                legendClickFun={this.legendClick}
                                data = {this.createBubbleChartData()}
                                > </BubbleChart>
}`
af13s commented 6 years ago

I have a fix for this issue. Can't I submit it for updating?

jmsv23 commented 6 years ago

Sure all the PR are welcome

af13s commented 6 years ago

I'm not sure how, but in the type definition for BubbleChart, I replaced "bubbleClickFun" with bubbleClickFunc. Please update for use with npm install. Thanks! I also change the param on line 131 with d instead of d.label.

Thanks!

PotLid commented 5 years ago

I checked the issue mentioned in this thread had been solved in the past. Please close the issue, thanks.