1

I'm trying to set a fill color on a sprite based on a data value from a json object. The result would be custom fill color from each entry in the features array.

My data structure

var cities = {
        "type": "FeatureCollection",
        "features": [{
          "type": "Feature",
          "properties": {
            "name": "New York City",
            "color": "red"
          },
          "geometry": {
            "type": "Point",
            "coordinates": [-73.778137, 40.641312]
          }
        }, {
          "type": "Feature",
          "properties": {
            "name": "London",
            "color": "blue"
          },
          "geometry": {
            "type": "Point",
            "coordinates": [-0.454296, 51.470020]
          }
        }]
      };

My sprite

pointSeries.bullets.push(function() {
        return am5.Bullet.new(root, {
          sprite: am5.Circle.new(root, {
            radius: 5,
            fill: am5.color('#3794d1'), //I'd like to use fill: {color}
            stroke: am5.color('#fff'),
            strokeWidth: 1
          })
        });
MrDirby
  • 181
  • 6

0 Answers0