Skip to Content

How to Swap Dimension in Stacked Column Chart under "Color"

Hi Experts.

Using the radio button I am swapping X Axis Dimensions from both graphs.

It’s working on the left graph. But it’s not working on the right graph (Stacked Column Chart)

Dimension in Stacked Column Chart is under Color as shown below in Pic 1. in my Case, " Region"

Using this code to delete X axis dimensions first and then moving radio button selected dimension into rows

var selectedValue = P1_RADIO.getSelectedValue();

DS1.getDimensions(Axis.ROWS).forEach(function(dimension, index) {




pic1.png (37.7 kB)
pic2.png (34.8 kB)
Add comment
10|10000 characters needed characters exceeded

  • when i was clicking the radio button for swapping, it was actually stacking both the dimensions on the same access.

    But now its working. Instead of rows, i cleared the column dimensions and moved the selected dimension into the column.


  • What do you mean exactly by the code not working for stacked chart ?

    Can you post a screenshot of the initial view of data source for the stacked chart ?

  • Get RSS Feed

2 Answers

  • Best Answer
    Feb 18, 2018 at 09:20 PM


    Instead of remove the dimension and then adding the new one try

    DS_1.swapDimensions(dimension1, dimension2)

    the moveDimensionToRows(selectedValue,0) is not currently working as intended - should be corrected in week 11 (Lumira 2.1 SP01)

    And when you use the foreach statement to find the dimension on the rows - there should only be one dimension in that row - put the other dimensions in the columns in the datasource (DS_1)



    Add comment
    10|10000 characters needed characters exceeded

    • Thanks René, For your response.

      I someone got it working using the following code. i cleared the Columns and moved the dimension into Columns. Although the actual dimension is under " Color" in Stacked Column chart it still worked.

      var selectedValue = P1_RADIO.getSelectedValue();

      P1_CH1.getDimensions(Axis.ROWS).forEach(function(dimension, index) { P1_CH1.removeDimension(dimension); });


      P1_CH2.getDimensions(Axis.COLUMNS).forEach(function(dimension, index) { P1_CH2.removeDimension(dimension); });


  • Feb 19, 2018 at 04:38 AM

    P1_CH2.getDimensions(Axis.COLUMNS).forEach(function(dimension, index) { P1_CH2.removeDimension(dimension); }); P1_CH2.moveDimensionToColumns(selectedValue);

    Add comment
    10|10000 characters needed characters exceeded