Victory: Animation has approx 1 sec delay before starting

Created on 19 Nov 2017  路  6Comments  路  Source: FormidableLabs/victory

When animation is turned on, it seems a long delay of about 1 second occurs before the animation begins (leaving the chart blank and empty for an awkward amount of time, no settings I can find get rid of it.

<VictoryChart
  responsive={false}
  domain={{ x: [0, 10] }}
  domainPadding={{ y: 80 }}
>
  <VictoryStack
    horizontal
    colorScale={["lightgreen", "red"]}
    animate={{
      onLoad: { delay: 0, duration: 800 },
      easing: "expInOut",
    }}
    style={{
      data: { width: 45, opacity: 0.7 },
      labels: { fontSize: 14 },
      parent: { border: "1px solid #ccc" }
    }}
  >
    <VictoryBar
      categories={{ x: [ "cats", "dogs" ] }}
      data={[{ x: "cats", y: 6 }, { x: "dogs", y: 3 }]}
    />
    <VictoryBar
      categories={{ x: [ "cats", "dogs" ] }}
      data={[{ x: "cats", y: 3 }, { x: "dogs", y: 5 }]}
    />
  </VictoryStack>
</VictoryChart>

Most helpful comment

When animation is turned on, it seems a long delay of about 1 second occurs before the animation begins (leaving the chart blank and empty for an awkward amount of time, no settings I can find get rid of it.

<VictoryChart
  responsive={false}
  domain={{ x: [0, 10] }}
  domainPadding={{ y: 80 }}
>
  <VictoryStack
    horizontal
    colorScale={["lightgreen", "red"]}
    animate={{
      onLoad: { delay: 0, duration: 800 },
      easing: "expInOut",
    }}
    style={{
      data: { width: 45, opacity: 0.7 },
      labels: { fontSize: 14 },
      parent: { border: "1px solid #ccc" }
    }}
  >
    <VictoryBar
      categories={{ x: [ "cats", "dogs" ] }}
      data={[{ x: "cats", y: 6 }, { x: "dogs", y: 3 }]}
    />
    <VictoryBar
      categories={{ x: [ "cats", "dogs" ] }}
      data={[{ x: "cats", y: 3 }, { x: "dogs", y: 5 }]}
    />
  </VictoryStack>
</VictoryChart>

can confirm

All 6 comments

Try setting a duration setting on top-level animate object too (i.e. sibling to onLoad and easing). That seems to do the trick for me, oddly enough.

When animation is turned on, it seems a long delay of about 1 second occurs before the animation begins (leaving the chart blank and empty for an awkward amount of time, no settings I can find get rid of it.

<VictoryChart
  responsive={false}
  domain={{ x: [0, 10] }}
  domainPadding={{ y: 80 }}
>
  <VictoryStack
    horizontal
    colorScale={["lightgreen", "red"]}
    animate={{
      onLoad: { delay: 0, duration: 800 },
      easing: "expInOut",
    }}
    style={{
      data: { width: 45, opacity: 0.7 },
      labels: { fontSize: 14 },
      parent: { border: "1px solid #ccc" }
    }}
  >
    <VictoryBar
      categories={{ x: [ "cats", "dogs" ] }}
      data={[{ x: "cats", y: 6 }, { x: "dogs", y: 3 }]}
    />
    <VictoryBar
      categories={{ x: [ "cats", "dogs" ] }}
      data={[{ x: "cats", y: 3 }, { x: "dogs", y: 5 }]}
    />
  </VictoryStack>
</VictoryChart>

can confirm

anyone with a fix?

Any news on this one? The delay is still present in version 34.3.11.

I've fixed that issue like this :
<VictoryChart animate={{onLoad: { delay: 0, duration: 1 }, duration: 500}} >

The duration of the effect is 500ms. Hope this helps

I thought i gave that a try already 馃 but yes, this does the trick. Thanks @gildas-succubus

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danielberndt picture danielberndt  路  4Comments

dinnayu picture dinnayu  路  3Comments

devth picture devth  路  4Comments

timhwang21 picture timhwang21  路  4Comments

iffy picture iffy  路  5Comments