Chart Label Prefix

Hello Helical Insight,

I am using Helical Insight 4.1GA and I am preparing chart with multiple measures. One of the measures is a currency and I want a currency symbol to be used as the data label. I tried to append dollar via SQL query, but then it changes number into a string and my chart is not getting generated as the charts needs numbers. Is it possible to do so, even if the actual data is a decimal number only?

Thanks,
Netta.

Hello Netta,

Yes, you can use the number as measure to prepare chart and append a currency symbol like a dollar sign ‘$’ before (or after) it to show it as currency.

In sample code below, we have a column name ‘sum_destination_id’ where we are appending a dollar symbol while all other columns will remain unaltered.

For each value in chart, the column name is residing in variable ‘ratio’ and its actual value is in variable named ‘value’ we are adding '$ ’ and returning the value.

hi_container.set("preExecution",function(c){
	var viz_Options = c.get("viz_Options");
		viz_Options.chartOptions["data"] = {
		  labels: {
		    format: function(value, ratio, id) {
			var d=value;				  
			if(ratio == 'sum_DESTINATION_ID'){
				return '$ ' + d; }
			else{
				return d; }
			} 
		  }
		};
	c.set("viz_Options",viz_Options); 
});

image

Thank You,
Helical Insight.