2 Replies Latest reply: Dec 11, 2017 5:45 AM by Ivan FELIPE ASENSIO RSS

    color chart by expression in API

    Samrat Maskey

      I was trying to color the chart by expression through API. below is the code, i kept missing "id":"colorByExpression", and lost some time while creating it. hope it would be helpful to someone.

      app.visualization.create( 'barchart',

            [ "Dimension",

              { "qDef": { "qDef": "Measure"}, "qAttributeExpressions": [{ "id":"colorByExpression", "qExpression": "=If(Dimension='D1', RGB(255,0,0), If(Dimension='D2', RGB(0,255,0)))" }] }



                "color": { "auto": false, "mode": "byExpression" }


          ).then(function (chart) {