Skip to content

Get height bar? (when animating) #399

Discussion options

You must be logged in to vote

I've found @stockiNail comment on a similar issue that suggests using getProps, which enables retrieving the target prop value for the animation.

Example using this principle:

    plugins: {
      datalabels: {
        display(context) {
          const { chart, datasetIndex, dataIndex } = context;
          if (dataIndex === undefined) return false;
          const meta = chart.getDatasetMeta(datasetIndex);
          const model = meta.data[dataIndex];
          console.log('height: ', model.height); // -> NaN when animation enabled
          // passing true you can get the final value of element property
          // at the end of animation
          const { height } = model.getProps(['…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by peteruithoven
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant