javascript - Google pie chart shows opposite colors -
javascript - Google pie chart shows opposite colors -
i have pie chart looks in javascript:
function drawcurrentpiechart(title,days) { var name = document.getelementbyid("dropdownsubcategories").value; $ .ajax({ url : "piechartlist/", type : "get", aync : true, datatype : "json", info : {days:days, categoryname : name + ""}, error : function(e) { alert(e.message + "error "); }, success : function(response) { var jsondata = response; if (response == "") { alert("error: threshold not valid or there no status in database within 24 hours."); } else { var info = [["count","color"]], colors = []; for(var c in jsondata){ data[data.length] = [jsondata[c]["color"],jsondata[c]["count"]]; colors[colors.length] = jsondata[c]["color"]; } info = google.visualization.arraytodatatable(data); var options = { title: title, 'chartarea': {'width': '100%', 'height': '80%'}, 'legend': {'position': 'bottom'}, backgroundcolor: 'transparent', colors : colors }; var chart = new google.visualization.piechart(document.getelementbyid('piechart'+days)); chart.draw(data, options); } } });
when draws chart, shows opposite colors recieves database (green red, reddish greenish etc.) can problem?
javascript jquery ajax charts google-visualization
Comments
Post a Comment