.show( opt )

Renders a cedar chart object into the specified element in the DOM.



Name Type Required Description
elementId string yes Id of the DOM node to render the chart into.
renderer string no svg or canvas (default) for drawing the chart.
width number no Explicit pixel width of chart. If not specified, will use width of elementId.
height number no Explicit pixel height of chart. If not specified, will use height of elementId.
maxLabelLength number no Explicit max length of axis labels. If set, axis labels will be truncated to the given length.
callback function no Function to call once the chart has been shown. Will be called with (err, data) arguments. If there was an error it will be available as err.

Example Code

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

var dataset = {
      "group": {"field":"District","label":"District"},
      "count": {"field":"Number_of","label":"Student Number_of"}

  var chart = new Cedar({"specification":"../../../cedar/data/templates/bar.json", "dataset": dataset});

//create and render a chart
  'elementId': '#chartDiv',
  'renderer': 'canvas'
}, function(err, data) {
  if (err) { console.log(err); }


Edit this page on GitHub