Hello - I am trying to use a stacked bar chart and change the color of the two data points. I can change the color of each bar (as if it were one) but it doesn’t seem to be picking up the second data point. It seems to read it as one. My code I have is below. I am trying to show values1 as #232c68 and values2 as#6da141. The color #9455a2 was just being used to see if and what changes there were based on the coding. With this code my result is ‘Today’ is all green and 1 Yr Before is all purple. the orange and yellow are the default colors. I left them so you can see the two different data points.
Can anyone help me?
if (results.length) {
// The data-chartdata attribute only holds the key value pairs of the data
var chartData = ;
chartData.push({‘value_label’ : ‘Today’,
‘values_1’ : record.tables[‘Longitudinal’][0].fields[‘EligToday’],“color”:“#232c68”,
‘values_2’ : record.tables[‘Longitudinal’][0].fields[‘PartToday’],“color”:“#6da141”});
chartData.push({‘value_label’ : ‘1 Yr Before’,
‘values_1’ : record.tables[‘Longitudinal’][0].fields[‘EligYr1’],“color”:“#9455a2”,
‘values_2’ : record.tables[‘Longitudinal’][0].fields[‘PartYr1’]});
chartData.push({‘value_label’ : ‘2 Yr Before’,
‘values_1’ : record.tables[‘Longitudinal’][0].fields[‘EligYr2’],
‘values_2’ : record.tables[‘Longitudinal’][0].fields[‘PartYr2’]});
chartData.push({‘value_label’ : ‘3 Yr Before’,
‘values_1’ : record.tables[‘Longitudinal’][0].fields[‘EligYr3’],
‘values_2’ : record.tables[‘Longitudinal’][0].fields[‘PartYr3’]});
results.attr(‘data-chartData’, JSON.stringify(chartData));
var graphsData = {
'categoryField' : 'value_label',
'graphs' : [
{'title' : '', 'valueField':'values_1',"ColorField":"color"},
{'title' : '', 'valueField':'values_2',"ColorField":"color"}]
};
results.attr(‘data-graphsdata’, JSON.stringify(graphsData));
}
var params = JSON.parse(results.attr(“data-params”));
params.amValueAxis.color = “white”;
params.amGraph.colorField = “color”;
results.attr(“data-params”, JSON.stringify(params));