ag-gridobservablehq

How to use sparklines in AG Grid with observablehq?


A couple of months ago, I created an observablehq based AG Grid table with sparklines. Recently, the sparklines stopped working, and I am not sure why. Here is a notebook with an example that used to work, but is not working anymore. The third column, Rate of Change, is supposed to contain sparklines.

I previously loaded AG Grid with AgGrid = require('ag-grid-enterprise/dist/ag-grid-enterprise.js'), but this generates an error now so I changed it to AgGrid = require('https://cdn.jsdelivr.net/npm/ag-grid-enterprise@25.2.0/dist/ag-grid-enterprise.min.js'), which seems to be working for the grid, but does not render the sparklines. I do not know why the former require call no longer works. When I inspect the devtools, it says AG Grid: Looking for component [agSparklineCellRenderer] but it wasn't found. so apparently the sparkline module is not imported correctly.


Solution

  • This should work.

    AgGrid = require("ag-grid-enterprise@27.3.0/dist/ag-grid-enterprise.js")