How To Assign Custom Color In Google Column Chart Based On Value (django)
I have values : m=72 n=34 z=59 I got the following google column chart :
Solution 1:
Could you use django template logic?
{% if m > 70 %}green{% elif m > 50 %}orange{% else %}red{%endif %}
function drawChart() {
var data = google.visualization.arrayToDataTable([
["Apple", {{m}}, "{% if m > 70 %}green{% elif m > 50 %}orange{% else %}red{%endif %}"],
["Orange", {{n}}, "{% if n > 70 %}green{% elif n > 50 %}orange{% else %}red{%endif %}"],
["Grape", {{z}}, "{% if z > 70 %}green{% elif z > 50 %}orange{% else %}red{%endif %}"],)
Post a Comment for "How To Assign Custom Color In Google Column Chart Based On Value (django)"