# Switching to show different dataarrays (edited)

**URL:** https://discourse.vtk.org/t/switching-to-show-different-dataarrays-edited/4231
**Category:** Web
**Created:** [September 16, 2020, 8:15pm UTC](https://discourse.vtk.org/t/switching-to-show-different-dataarrays-edited/4231 "2020-09-16T20:15:50Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![samm-vs](https://discourse.vtk.org/user_avatar/discourse.vtk.org/samm-vs/32/2173_2.png) [@samm-vs](https://discourse.vtk.org/u/samm-vs)
#### Post date: [September 16, 2020, 8:15pm UTC](https://discourse.vtk.org/t/switching-to-show-different-dataarrays-edited/4231/1 "2020-09-16T20:15:50Z")

</div>

As the past few questions show, I am still really new to this and would appreciate any help available. My question is can you color a vti file using cell data? if so, is there a way to tell the volumeMapper or Volume actor to choose which type of data it should use? I know you are able to do that with vtp files, I just curious if you can do the same here.

---

<div class="post-metadata">

### Author: ![Forrest](https://discourse.vtk.org/user_avatar/discourse.vtk.org/forrest/32/300_2.png) [@Forrest](https://discourse.vtk.org/u/Forrest)
#### Post date: [September 21, 2020, 3:12pm UTC](https://discourse.vtk.org/t/switching-to-show-different-dataarrays-edited/4231/2 "2020-09-21T15:12:36Z")

</div>

Yeah you should be able to color using cell data. Check out the code for `setColorBy(array, location, componentIndex)` here: [https://github.com/Kitware/vtk-js/blob/master/Sources/Proxy/Core/AbstractRepresentationProxy/index.js#L123](https://github.com/Kitware/vtk-js/blob/master/Sources/Proxy/Core/AbstractRepresentationProxy/index.js#L123) for a sort of overview of how this is done. (Note that `arrayLocation = "cellData"` in your case.)

All you should really need to do is to set your lookup table on the mapper, and then adjust your lookup table’s data range to be the range of your cell data array.

---

<div class="post-metadata">

### Author: ![samm-vs](https://discourse.vtk.org/user_avatar/discourse.vtk.org/samm-vs/32/2173_2.png) [@samm-vs](https://discourse.vtk.org/u/samm-vs)
#### Post date: [September 21, 2020, 4:50pm UTC](https://discourse.vtk.org/t/switching-to-show-different-dataarrays-edited/4231/3 "2020-09-21T16:50:10Z")

</div>

The example is for the regular mapper, is it the same way for volumeMapper?

---

<div class="post-metadata">

### Author: ![Forrest](https://discourse.vtk.org/user_avatar/discourse.vtk.org/forrest/32/300_2.png) [@Forrest](https://discourse.vtk.org/u/Forrest)
#### Post date: [September 22, 2020, 3:32pm UTC](https://discourse.vtk.org/t/switching-to-show-different-dataarrays-edited/4231/4 "2020-09-22T15:32:25Z")

</div>

Hm, I don’t think you can color by cell data with the VolumeMapper (unless @Sebastien_Jourdain knows how). I would instead recommend moving your data as another component of the point data scalars, and use multi-component rendering as seen here: [https://kitware.github.io/vtk-js/examples/TestVolumeTypes.html](https://kitware.github.io/vtk-js/examples/TestVolumeTypes.html). I think that should work for you.

---

<div class="post-metadata">

### Author: ![samm-vs](https://discourse.vtk.org/user_avatar/discourse.vtk.org/samm-vs/32/2173_2.png) [@samm-vs](https://discourse.vtk.org/u/samm-vs)
#### Post date: [September 22, 2020, 5:51pm UTC](https://discourse.vtk.org/t/switching-to-show-different-dataarrays-edited/4231/5 "2020-09-22T17:51:01Z")

</div>

Oh, I did not know that you can’t color via cell color. I will look into multi-component rendering.
