# How to do axis rotation of AxesActor and adding label

**URL:** <https://discourse.vtk.org/t/how-to-do-axis-rotation-of-axesactor-and-adding-label/11323>\
**Category:** Development\
**Tags:** vtkjs\
**Created:** [April 27, 2023, 4:56am UTC](https://discourse.vtk.org/t/how-to-do-axis-rotation-of-axesactor-and-adding-label/11323 "2023-04-27T04:56:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sneha-pk](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sneha-pk/32/4216_2.png) [@Sneha-pk](https://discourse.vtk.org/u/Sneha-pk)\
**Post date:** [April 27, 2023, 4:56am UTC](https://discourse.vtk.org/t/how-to-do-axis-rotation-of-axesactor-and-adding-label/11323/1 "2023-04-27T04:56:06Z")

</div>

Hello,  
I am using axesActor to represent the axis of my viewer as shown in the image.Is there a label function in vtk.js (i know it is there in C++ and cubeaxesactor) to set labels for axis.  
Also,while rotating the axis (rotateWXYZ()), i am expecting the coordinates to change for example, if the origin(0,0) at bottom left corner, it should be at bottom right corner after rotation. As shown in the images, the direction of the x flips from right to left but has no impact on the image. Can that be achieved using vtk.js?  
Please provide some insight.

 ![image](https://discourse.vtk.org/uploads/default/original/2X/2/2d251ea021e1b7474d4265f5b2c214ee4a78f5d6.jpeg)

 ![image](https://discourse.vtk.org/uploads/default/original/2X/d/df1334a24494c8e4fbd32eaef02a40ec5cdead78.jpeg)

 ![image](https://discourse.vtk.org/uploads/default/original/2X/a/a1d509965c23f18b8e33734f87beadd564469419.png)

 ![image](https://discourse.vtk.org/uploads/default/original/2X/1/178c88b10f5ae55af0fee9892124d5aea275f77f.png)

---

<div class="post-metadata">

**Author:** ![Sneha-pk](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sneha-pk/32/4216_2.png) [@Sneha-pk](https://discourse.vtk.org/u/Sneha-pk)\
**Post date:** [April 30, 2023, 11:01pm UTC](https://discourse.vtk.org/t/how-to-do-axis-rotation-of-axesactor-and-adding-label/11323/2 "2023-04-30T23:01:57Z")

</div>

Hello All,  
I am still stuck in this. However i did have some progress. `  
actorImage= vtkImageSlice.newInstance();  
const axesActor = vtkAxesActor.newInstance();  
const orientation = axesActor.getOrientation();

// Create a transformation matrix that reflects the x-axis and rotation around y-axis.  
const reflectionXMatrix = vtkMatrixBuilder.buildFromDegree(0,180,0);  
const rotatedMatrix = vtkMatrixBuilder.buildFromDegree(0,-orientation[1],0);  
const transformedMatrix = vtkMatrixBuilder.multiply(reflectionXMatrix,rotatedMatrix);  
const transform = vtkTransform.newInstance();  
transform.setMatrix(transformedMatrix);

actorImage.setUserMatrix(transformedMatrix);  
`

However, i am getting an error that multiply is not a function of matrixBuilder. Please give some suggestions.  
Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)\
**Post date:** [May 1, 2023, 2:11pm UTC](https://discourse.vtk.org/t/how-to-do-axis-rotation-of-axesactor-and-adding-label/11323/3 "2023-05-01T14:11:05Z")

</div>

Just use the api.

---

<div class="post-metadata">

**Author:** ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)\
**Post date:** [May 1, 2023, 2:12pm UTC](https://discourse.vtk.org/t/how-to-do-axis-rotation-of-axesactor-and-adding-label/11323/4 "2023-05-01T14:12:55Z")

</div>

[https://kitware.github.io/vtk-js/api/Common\_Core\_MatrixBuilder.html](https://kitware.github.io/vtk-js/api/Common_Core_MatrixBuilder.html)

---

<div class="post-metadata">

**Author:** ![Sneha-pk](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sneha-pk/32/4216_2.png) [@Sneha-pk](https://discourse.vtk.org/u/Sneha-pk)\
**Post date:** [May 2, 2023, 3:24am UTC](https://discourse.vtk.org/t/how-to-do-axis-rotation-of-axesactor-and-adding-label/11323/5 "2023-05-02T03:24:00Z")

</div>

@Sebastien_Jourdain isn’t it the same path as this?

> **[vtk-js/Sources/Common/Core/MatrixBuilder at master · Kitware/vtk-js](https://github.com/Kitware/vtk-js/tree/master/Sources/Common/Core/MatrixBuilder)**
>
> master/Sources/Common/Core/MatrixBuilder

---

<div class="post-metadata">

**Author:** ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)\
**Post date:** [May 6, 2023, 5:34pm UTC](https://discourse.vtk.org/t/how-to-do-axis-rotation-of-axesactor-and-adding-label/11323/6 "2023-05-06T17:34:50Z")

</div>

yes same class
