GithubHelp home page GithubHelp logo

Comments (7)

ronvenna avatar ronvenna commented on July 19, 2024 1

@DalerAsrorov no problem, thanks for the quick response. Will take a look at this and submit a PR.

from britecharts-react.

ronvenna avatar ronvenna commented on July 19, 2024

Bump. Any workaround for this currently?

from britecharts-react.

dalerasrorov-eb avatar dalerasrorov-eb commented on July 19, 2024

@ronvenna thanks for bumping, we have not yet looked in this issue (due to different project priorities). I will look into it some time. Feel free to make a PR if you find a fix as well!

from britecharts-react.

jchen-eb avatar jchen-eb commented on July 19, 2024

Hi @ronvenna,

One workaround I've been able to use is to wrap the entire chart in a functional component. This way, it forces React to instantiate a new object every time it gets new props.

So instead of

render() {
	const renderStackedArea = (props) => (
            <ResponsiveStackedArea
                data={stackedAreaData.with3Sources()}
                {...props}
            />
        );

	return (
            <Tooltip
                data={stackedAreaData.with3Sources()}
                render={renderStackedArea}
            />
	);
}

you can do:

render() {
	const renderStackedArea = (props) => (
            <ResponsiveStackedArea
                data={props.data}
                {...props}
            />
        );

	const TooltipWithStackedArea = ({data}) => (
		<Tooltip
		    data={data}
		    render={renderStackedArea}
		/>
	);

	return (
            <TooltipWithStackedArea
        	data={stackedAreaData.with3Sources()}
            />
	);
}

This way, every time render() gets called, it creates a new functional component which it then renders, creating a new instance of the chart with the new data and replacing the old.

In theory, this will result in worse performance. However, in my testing I haven't noticed it being any worse on the various devices I've tried.

from britecharts-react.

davegomez avatar davegomez commented on July 19, 2024

This is an issue that is affecting other charts as well, so I created a prototype comparing the Bar and Line charts where you can see the issue happening.

I can work on a solution for this and make a PR but I need some help finding the issue.

from britecharts-react.

davegomez avatar davegomez commented on July 19, 2024

This is already fixed too in the PR #164

from britecharts-react.

miglesiasEB avatar miglesiasEB commented on July 19, 2024

Thanks!

from britecharts-react.

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.