javascript - AMCharts How to color bullets by value? -
i working amcharts , tried color bullets in chart values have. created array in javascript , passed values database it. green value testing.
var chartdata = [ <?php foreach($tmp $row) { echo'{"wahrscheinlichkeit":'.$row[3].',"schaden":'.$row[4].',"value":1,"beschreibung":"'.$row[2].'", "color":"green"},'; } ?> ];
here create chart:
chart = new amcharts.amxychart(); chart.dataprovider = chartdata;
here draw chart:
var graph = new amcharts.amgraph(); graph.valuefield = "value"; // größe der kugeln graph.xfield = "wahrscheinlichkeit"; graph.yfield = "schaden"; graph.maxbulletsize=20; graph.linealpha = 0; graph.bullet = "circle"; graph.bulletcolor= "[[color]]"; graph.balloontext = "wahrscheinlichkeit:<b>[[x]]</b> schaden:<b>[[y]]</b><br>beschreibung:<b> [[beschreibung]]</b>" chart.addgraph(graph);
at point "bulletcolor" try color out of array, doesn't work.
chart.write("chartdiv");
looking forward getting tips , you
"bulletcolor" can't reference fields in data this.
instead, please use "linecolorfield":
http://docs.amcharts.com/3/javascriptcharts/amgraph#linecolorfield
i.e.:
var graph = new amcharts.amgraph(); graph.valuefield = "value"; // größe der kugeln graph.xfield = "wahrscheinlichkeit"; graph.yfield = "schaden"; graph.maxbulletsize=20; graph.linealpha = 0; graph.bullet = "circle"; graph.linecolorfield = "color"; graph.balloontext = "wahrscheinlichkeit:<b>[[x]]</b> schaden:<b>[[y]]</b><br>beschreibung:<b> [[beschreibung]]</b>" chart.addgraph(graph);
Comments
Post a Comment