Graphing Service


{|RESULT|}

  #start graph with the {|GRAPH|} command

  {|GRAPH|}

    #indicates that our graph should be of type 'pie' (p)

    graph/t/p


    #graph should be 300 pixels wide

    /w/300


    #graph should be 300 pixels high

    /h/300


    #loop each answer option for question 1268 and add its count

    #only display commas if there are more answer options to come

    /d/{|LOOP|RESULT.QUESTION_1268(SORT=ORDER_NUM)}

      {COUNT(QUESTION_1268)}{LOOP.HASNEXT?,}

    {/|LOOP|}


    #indicates color scheme for graph

    /c/803380,f1e09d


    #apikey required for authentication

    ?apikey={CONFIG.PDF_API_KEY}


    #adds labels to the pie slices

    #this is in the query string to avoid character encoding issues

    &l={|LOOP|RESULT.QUESTION_1268}

      {QUESTION_1268.NAME.FUSIONSAFE}{LOOP.HASNEXT?,}

    {/|LOOP|}


    #title for graph, URL encoded

    &n=Was%20this%20the%20best%20donut%20that%20you%20sampled%20today%3F

  {/|GRAPH|}

{/|RESULT|}



HighCharts



<div id="my-graph">

{|HIGHCHARTS|}

  {

    #graph title

    "title": {

      "text": "Title",

      "x": -20

    },

    

    #graph should be 300x300 pixels

    "chart": {

      "height": 300,

            "width": 300

    },

    

    #remove 'highcharts' label from graph

    "credits": {

      "enabled": false

    },

    

    #our actual data

    "series": 

    [

      {

        "type": "pie",

        "name": "Count",

        "data": 

        [

            {|RESULT|}

              {|LOOP|RESULT.DAY_OF_WEEK}

              [

                #label for pie slice - HC_SAFE_STRING handles escaping quotes

                "{DAY_OF_WEEK.NAME.HC_SAFE_STRING}",

    

                #actual data - HC_SAFE_NUMBER handles null values

                {COUNT(DAY_OF_WEEK).HC_SAFE_NUMBER}

              ]{LOOP.HASNEXT?,}

              {/|LOOP|}

            {/|RESULT|}

        ]

      }

    ]

  }  

{/|HIGHCHARTS|}

</div>