I have to set different colors in pie chart legend values. If I am using static color the color code set in all the legend. but when I set array[0] the colors not to be displayed.
My code:
data: [
{/literal}
{section name=foo start=1 loop=$value.0.count+1 step=0}
{assign var=op value=$smarty.section.foo.index}
{assign var=a value=optcount$op}
{assign var=an value=optans$op}
{assign var=cor value=$colors.col$op}
{literal}
{name: '{/literal}{$value.0.$an}{literal}',y: {/literal}{$value.0.$a}{literal}, color: '{/literal}$cor{literal}'}
{/literal}
{if $op neq $value.0.count},{/if}
{/section}
{literal}
]
Here $colors is an array, having this value:
$colors = array(col1 => '#6B8E23', col2 => '#A9A9A9', col3 => '#696969', col4 => '##FFFFFF', col5 => 'blue');
If I pass the value like this, its working but got assigned in all the legends in one color:
{literal}
{name: '{/literal}{$value.0.$an}{literal}',y: {/literal}{$value.0.$a}{literal}, color: '{/literal}green{literal}'}
{/literal}
1 Answer