Ag-Grid & integrated charts showing additional series when utilising a row group

Viewed 305

Hopefully, someone will be able to help me resolve this problem.

I have a grid - relatively simple but it does utilise their row grouping & aggregation functionality. This all works as expected. Where I am having issues, is by utilising createCrossFilterChart to create a chart that is associated. Due to the row aggregation, it creates an additional series within the chart. Here is a plunker example of the issue reproduced based on one of their examples. Here

The grid options:

var gridOptions = {
  columnDefs: [
    { field: 'market', chartDataType: 'excluded', rowGroup: true },
    { field: 'salesRep', chartDataType: 'category' },
    { field: 'handset', chartDataType: 'category' },
    { field: 'sale', chartDataType: 'series' , aggFunc: 'sum' },
    { field: 'saleDate', chartDataType: 'category' },
  ],
  defaultColDef: {
    flex: 1,
    sortable: true,
    filter: 'agSetColumnFilter',
    floatingFilter: true,
    resizable: true,
  },
  rowData: generateData(),
  enableCharts: true,
  chartThemes: ['ag-default-dark'],
  onFirstDataRendered: onFirstDataRendered,
};

The Chart options:

params.api.createCrossFilterChart({
    chartType: 'pie',
    cellRange: {
      columns: ['salesRep', 'sale'],
    },
    aggFunc: 'sum',
    chartThemeOverrides: {
      common: {
        title: {
          enabled: true,
          text: 'Sales by Representative ($)',
        },
      },
      pie: {
        series: {
          title: {
            enabled: false,
          },
          label: {
            enabled: false,
          },
        },
      },
    },
    chartContainer: document.querySelector('#pieChart'),
  });

I have tried setting the grouped row to

  1. chartDataType: 'excluded' - had no effect on the additional series.
  2. hide: True - had no effect on the additional series.

Does anyone know if there is any magical setting that I am missing that allows us to sue these charts with grouped rows? If we do not group by the column, the chart works perfectly.

Cheers in advance,

0 Answers
Related