question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Understanding makeInteractive in 0.5

See original GitHub issue

If I understand the changes correctly, the desired way to interact with a makeInteractive component is to pass in interactiveState, which is controlled by the component?

In the render method, the interactiveState is a property:

render() {
        var { enabled, endPointCircleFill, endPointCircleRadius } = this.props;
        var { xScale, chartConfig, plotData, xAccessor, interactiveState, show } = this.props;
               ...

https://github.com/rrag/react-stockcharts/blob/master/src/lib/interactive/TrendLine.jsx#L266

Also defined as a property Type

interactiveState: PropTypes.object,

https://github.com/rrag/react-stockcharts/blob/22fdff0298c50b690eb6a6d077f3feef92b81061/src/lib/interactive/TrendLine.jsx#L489

So if we are using trendline, and wanted to “load” in previously saved data (eg trends[] array), is interactiveState the best way to reflect that?

(pretend I have 2 lines that I have saved...)
var myTrends={trends: [{ start: [Ax1, Ay1], end: [Bx2, By2] }, { start: [Cx1, Cy1], end: [Cx2, Cy2] }]}

render(){
                        <EventCapture mouseMove zoom pan>
                    <TrendLine forChart={1} id={1} ref="trend"
                        enabled={this.state.enableTrendLine}
                        type="LINE"   
                                                interactiveState={myTrends}
                        snap={true} snapTo={d => [d.high, d.low]}
                        onStart={() => console.log("START")}
                        onComplete={this.onTrendLineComplete}
                        />
                </EventCapture>
}

I am stumbling understanding the different usages of

  • overrideInteractive
  • state.interactiveState
  • props.interactiveState
  • interactive where they are applicable, seems like there were many changes

I guess just wondering is there a brief description out there about the rational, so I can understand it better?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
itsjimbocommented, Aug 2, 2016

Just wanted to contribute a small plunkr about this for others, which to my understanding is the correct way to load in previous trends[]

https://plnkr.co/edit/e42l6Dk7NaHFHLS3PkIQ?p=info

I am not sure how to directly get access to the EventHandler interactiveState array, without modification to the library.

https://github.com/rrag/react-stockcharts/blob/master/src/lib/EventHandler.js#L58

so I am not sure how the sample code you provided would apply, maybe a plunkr would help if you can make one

this.interactiveState = [
  { chartId: 0, id: 0, interactive: { trends: [...] } },
  { chartId: 0, id: 1, interactive: { retracements: [...] } }
]

instead I have resorted to using the getInteractiveState setInteractiveState methods provided by the Trendline component

0reactions
rragcommented, Aug 2, 2016

this is a clever use of props to override the default behavior. Thanks for sharing. Please use this till a better solution comes out in 0.6

Read more comments on GitHub >

github_iconTop Results From Across the Web

Interactive Visualizations — umap 0.5 documentation
It is interactive, letting you switch between 2D and 3D representations and has a wide selection of different animals. Attempting to guess the...
Read more >
Create Basic Interactive Response Questions - SYLVA
Interactive response questions focus on the student's thought process and help them gain intuition through hands-on interactivity.
Read more >
Essentials: Adopting Interactive Content - Top Hat Support
By default, all Top Hat questions are graded with 0.5 points to correctness, and 0.5 points to participation. These default weights are added ......
Read more >
Understanding Correlations - R Psychologist
An interactive app to visualize and understand standardized effect sizes.
Read more >
Interactive Data Visualization in Python With Bokeh
This Python tutorial will get you up and running with Bokeh, using examples and a real-world dataset. You'll learn how to visualize your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found