snehilvj / dash-mantine-components

Plotly Dash components based on Mantine React Components
https://www.dash-mantine-components.com
MIT License
555 stars 55 forks source link

Animation property is not working in Line Chart #330

Closed namakshenas closed 2 weeks ago

namakshenas commented 3 weeks ago

Tried the following piece of code:

data = [
    {"date": "Mar 22", "Apples": 2890, "Oranges": 2338, "Tomatoes": 2452},
    {"date": "Mar 23", "Apples": 2756, "Oranges": 2103, "Tomatoes": 2402},
    {"date": "Mar 24", "Apples": 3322, "Oranges": 986, "Tomatoes": 1821},
    {"date": "Mar 25", "Apples": 3470, "Oranges": 2108, "Tomatoes": 2809},
    {"date": "Mar 26", "Apples": 3129, "Oranges": 1726, "Tomatoes": 2290}
]

html.Div(
        dmc.LineChart(
            h=300,
            dataKey="date",
            data=data,
            tooltipAnimationDuration=500,
            lineChartProps={"isAnimationActive":True,  
                            "animationDuration": 500, 
                            "animationEasing": "ease-in-out",
                            "animationBegin": 500},
            series=[
                {"name": "Apples", "color": "indigo.6"},
                {"name": "Oranges", "color": "blue.6"},
                {"name": "Tomatoes", "color": "teal.6"},
            ],
        )

But the chart loaded without any animation!

AnnMarieW commented 3 weeks ago

Hi @namakshenas Thanks for reporting! It's not working because the animation needs to be set using the lineProps property, which is missing. This prop will be added in the next release.

AnnMarieW commented 2 weeks ago

Hi @namakshenas

Check out this sample app hosted on PyCafe based on the PR

namakshenas commented 2 weeks ago

Hi @namakshenas

Check out this sample app hosted on PyCafe based on the PR

Brilliant!

Btw, do you have any plan to add the animation to different chart types (like bar charts)?

AnnMarieW commented 2 weeks ago

yes - working on it right now as part of this same PR. It works for some charts already, like the pie and donut. Just adding the other missing props for the others :-)

@namakshenas it should work with the bar charts, it's just not documented. Just use the barProps rather than barChartProps

namakshenas commented 2 weeks ago

yes - working on it right now as part of this same PR. It works for some charts already, like the pie and donut. Just adding the other missing props for the others :-)

@namakshenas it should work with the bar charts, it's just not documented. Just use the barProps rather than barChartProps

Well done! Looking forward to it!