Changing X & Y Axis Labels on Graphs - Salesforce Analytics Cloud

Recently I discovered that you could fully change the label including the AVG of OR sum of on the X & Y axis of a chart on Salesforce Analytics Cloud. Up until this point I had been building solutions that took this into consideration as something I couldnt change. There were a number of ways that we could deal with this:

  1. Hide the label in XMD
  2. Change the projection in a SAQL query to promote a label that was suitable ( So a calculation that is sum(column) / sum(Columnn) = avg_allcolumns
  3. Use a variety of graphical tricks to remove the "Sum of" component.

Below is an example of a label that we would want to change:

It turns out there is a way in the JSON to define this whole label. No longer do we need to use the "Sum Of" or "Avg Of" on our graphs. The change can be made by using the display option within the measure in the step in the Dashboard JSON. Below is the standard JSON Step of what we would see as part of a step that is created by default / has been created using the Dashboard designer in Salesforce Analytics Cloud.

As you can see in the code in the measures section we have "sum,Flights". This as a default is the was that the Salesforce Analytics graphics engine (Eclair) needs to see measures in order to display them in a graph. The same is when we use SAQL or PIGQL for queries, the projected measure for example must end in an aggregate and look like sum_Flights. The measures are also defined as sum,flights in the compact form section to allow the Eclair to graph the measure.

Using the display attribute in the measure step we can change the way that the measure is represented on the graph. In the above code you can see we added the following code to allow for the adjustment:

null, {
              "display": "New Label - All flights"

With the display code added to the step we now have this displayed on our graph on our dashboard.