Code Monkey home page Code Monkey logo

Comments (12)

kirjs avatar kirjs commented on May 18, 2024 1

Would that help?
https://github.com/kirjs/react-highcharts#limiting-highchart-rerenders

from react-highcharts.

olegafx avatar olegafx commented on May 18, 2024 1

@rizkiandrianto just use something like cloneDeep from lodash

Example in React:

this.setState({ chart: cloneDeep(chart) })

from react-highcharts.

mahtikebab avatar mahtikebab commented on May 18, 2024

Thanks for the reply. It was actually a problem with how I used state in the parent react component. When clicking on a point it messaged the parent to change its state, which caused it to send new props and this caused my highcharts component to redraw (the parent is doing the AJAX reqs for the data since this data is used on other children of it aswell, meaning I do chart updating in componentWillReceiveProps).

When using isPureConfig what would be the proper way to trigger a chart redraw? In what react lifecycle method and exactly how would it be best?

Cheers!

from react-highcharts.

kirjs avatar kirjs commented on May 18, 2024

isPureConfig works similarly to https://facebook.github.io/react/docs/pure-render-mixin.html
It won't update the chart if the config wasn't updated.

from react-highcharts.

kirjs avatar kirjs commented on May 18, 2024

I'm closing the issue, feel free to reopen it if if you need further help

from react-highcharts.

olegafx avatar olegafx commented on May 18, 2024

What's the correct way to redraw chart with a new data using isPureConfig? I tried to use setOptions, redraw and series[0].setData, but I got nothing useful. And where my highcharts config should live?

Ex. an app where we'are changing select value and redrawing new data on the same chart.

from react-highcharts.

olegafx avatar olegafx commented on May 18, 2024

@kirjs I couldn't make it work. Config is in state and isPureConfig option is used. Could you help me?

from react-highcharts.

kirjs avatar kirjs commented on May 18, 2024

Hi Oleg, the config you're passing should be a reference to a object different from the original one.
It's best done with some immutable library, or you could deep clone the object.

from react-highcharts.

olegafx avatar olegafx commented on May 18, 2024

@kirjs oh, I was using deep cloning in a wrong place. My fault… Thanks for your response and your work 👍

from react-highcharts.

kirjs avatar kirjs commented on May 18, 2024

No worries, good luck with your project

from react-highcharts.

nixsurya avatar nixsurya commented on May 18, 2024

Is there a known issue if props of the parent changes and I re-render Treemap or Heatmap.

There is no issue while re-rendering a simple line chart.
The issue I see is TypeError: Cannot read property 'data classes' of undefined.

from react-highcharts.

rizkiandrianto avatar rizkiandrianto commented on May 18, 2024

Hi Oleg, the config you're passing should be a reference to a object different from the original one.
It's best done with some immutable library, or you could deep clone the object.

What do you mean different object @kirjs ? Would you give me example code to set state the config with isPureconfig?

Edit: I found a way that easier, chart.reflow(). Is it okay or will be a memory leak? or somthing like that?

from react-highcharts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.