How to swap rows and columns in a Heat Map in real time?


#1

Hi, I’m using ChartFactor toolkit to generate a Heat Map , but I need to transpose the data, meaning I want to swap the rows with the columns in the visualization in real time with a button i have in my UI.

Is there a built-in option in the library to do this, or do I need to manually transform the data before passing it to the chart?

Thanks for your help!


#2

I see, well yes you can do it, using the transpose feature, let me show how you can do it in real time:

// obtain the visualization
const myViz = cf.getVisualization("your_viz_id");

// set the transpose property to true or false as you need
myViz.set('transpose', true) // transposed values
myViz.set('transpose', false) // normal values

#3

Thanks, it works good, now I wonder if the labels of the x axis can be at the bottom, is that posible?


#4

mm i see, well, you cam use this also:

.set('xAxisPosition', 'bottom')

This will move the labels to the bottom


#5

It works, thanks for your help. :+1:t3::+1:t3: