.dataset Property

Getter/Setter for the dataset. Allows the developer to make changes to the dataset, most usefully the .query hash.

Getter Syntax

var ds = chart.dataset;

Setter Syntax

chart.dataset = myDatasetObject;

Example Code

<div id='chartDiv'></div>

<script>
var chart = new Cedar({'specification': 'https://example.org/url_to_specification.json'})

//create dataset object
var dataset = {
    "url":"https://services.arcgis.com/uDTUpUPbk8X8mXwl/arcgis/rest/services/Public_Schools_in_Onondaga_County/FeatureServer/0",
    "mappings":{
      "group": {"field":"District","label":"District"},
      "count": {"field":"Number_of","label":"Student Number_of"}
    }
  };

//assign to chart
chart.dataset = dataset;

//create and render a chart
chart.show({
  'elementId': '#chartDiv'
});

</script>

Edit this page on GitHub