piechart to show Data

Hi,

I am trying to show data on piechart, the field make has different data. 

I want to segregate the data into let's Ford and non Ford.

How can I do that?

{
  a!pieChartField(
    data: 'recordType!{aa4ce38f-1a9d-4827-af51-e2ccb80a2c8b}AS Vehicle',
    config: a!pieChartConfig(
      primaryGrouping: a!grouping(
        field: 'recordType!{aa4ce38f-1a9d-4827-af51-e2ccb80a2c8b}AS Vehicle.fields.{7aa3dcda-863a-4271-9034-85821a2bd453}make',
        alias: "vehicleMake_primaryGrouping"
      ),
      measures: {
        a!measure(
          function: "COUNT",
          field: 'recordType!{aa4ce38f-1a9d-4827-af51-e2ccb80a2c8b}AS Vehicle.fields.{595da20e-a849-4c36-a57e-d569453c622f}vehicleID',
          alias: "vehicleId_count_measure1"
        )
      },
      sort: {
        a!sortInfo(
          field: "vehicleId_count_measure1",
          ascending: false
        )
      },
      dataLimit: 100
    ),
    label: "Vehicles by Make",
    labelPosition: "ABOVE",
    showDataLabels: true,
    showAsPercentage: true,
    colorScheme: "RAINFOREST",
    style: "DONUT",
    seriesLabelStyle: "LEGEND",
    height: "MEDIUM",
    refreshAfter: "RECORD_ACTION"
  )
}

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    Can you share a screenshot of that chart?

    Did you try the reports builder?

  • 0
    Certified Lead Developer

    I hope you want to achieve the below requirement,

    You can not achieve this with your code. You have to write something like below,

    a!localVariables(
      local!fordCount: a!queryRecordType(
        recordType: 'recordType!{aa4ce38f-1a9d-4827-af51-e2ccb80a2c8b}AS Vehicle',
        fields: {},
        filters: a!queryLogicalExpression(
          operator: "AND",
          filters: {
            a!queryFilter(
              field: 'recordType!{aa4ce38f-1a9d-4827-af51-e2ccb80a2c8b}AS Vehicle.fields.{7aa3dcda-863a-4271-9034-85821a2bd453}vehicleMake',
              operator: "=",
              value: "Ford"
            )
          },
          ignoreFiltersWithEmptyValues: true
        ),
        pagingInfo: a!pagingInfo(
          startIndex: 1,
          batchSize: 100
        ),
        fetchTotalCount: true()
      ).totalCount,
      local!nonFordCount: a!queryRecordType(
        recordType: 'recordType!{aa4ce38f-1a9d-4827-af51-e2ccb80a2c8b}AS Vehicle',
        fields: {},
        filters: a!queryLogicalExpression(
          operator: "AND",
          filters: {
            a!queryFilter(
              field: 'recordType!{aa4ce38f-1a9d-4827-af51-e2ccb80a2c8b}AS Vehicle.fields.{7aa3dcda-863a-4271-9034-85821a2bd453}vehicleMake',
              operator: "<>",
              value: "Ford"
            )
          },
          ignoreFiltersWithEmptyValues: true
        ),
        pagingInfo: a!pagingInfo(
          startIndex: 1,
          batchSize: 100
        ),
        fetchTotalCount: true()
      ).totalCount,
      {
        a!pieChartField(
          label: "Pie Chart",
          labelPosition: "ABOVE",
          series: {
            a!chartSeries(label: "Ford", data: local!fordCount),
            a!chartSeries(label: "Non-Ford", data: local!nonFordCount)
          },
          showDataLabels: true,
          allowImageDownload: true,
          colorScheme: "RAINFOREST",
          style: "DONUT",
          seriesLabelStyle: "ON_CHART",
          height: "MEDIUM"
        )
      }
    )
    

    I hope this will be helpful for you.