Parse JSON with containing function

المشرف العام

Administrator
طاقم الإدارة
I want to create a diagram like this:



This works pretty well, but now I want to do the same with varying input data. My plan to do this like in this minimal example:

This works as well, but when I try to add the rule for the different colors into my text, it does not work to parse it to a JSON.

Do you know how I can insert the color function into my text in order to parse it correctly to a JSON?

color: function (color, d) { if(d.value < -1){ return d3.rgb('red'); } else if(d.value >= -1 && d.value
 
أعلى