Cedar chart not updating

1398
0
12-23-2016 07:00 PM
BenjaminMittler
Occasional Contributor III

HI all. I'm using Cedar to build a chart on a website. The data for the chart is being pulled from a Survey123 layer. This way when I submit something to Survey123 the chart will be automatically. My problem is that when I submit somthing to Survey123 my chart is not updating when the page is reloaded. Does anyone see anything wrong with my chart code? Im very new to JavaScript..

Thanks

<script>

  var chart = new Cedar({"type": "bar-horizontal"});

  //create the dataset w/ mappings
  var dataset = {
    "url":"https://services7.arcgis.com/2lya1j9hNfBnQwN6/arcgis/rest/services/survey123_xxxxxxxxxxxxxxxx/Featur...",
    "query": {
      "groupByFieldsForStatistics": "field_0",
      "outStatistics": [{
        "statisticType": "count",
        "onStatisticField": "field_0",
        "outStatisticFieldName": "Number_of_SUM"
      }]
    },
    "mappings":{
      "y": {"field":"field_0","label":"Food?"},
      "x": {"field":"Number_of_SUM","label":"# of Eats"}
    }
  };
  //show the chart
  chart.show({
    elementId: "#chart"
  });
  
  //assign to the chart
  chart.dataset = dataset;

  chart.update();

</script>  ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
Tags (1)
0 Kudos
0 Replies