Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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) {
chart.show(chartid);
deferred.resolve(chart);
});
Samrat,
Can you explain what this is doing a bit? For example, what is setting qDef to Measure doing? What's the measure?
Also (a shot in the dark here), have you developed an extensions where you do something similar - i.e., setting color by dimension expression?
Thanks for sharing Samrat, I've been looking for the solution for hours without success!
Very useful