I have a newbie question on ag-grid enterprise (using v23.0.0). When I create a simple grid, and then do these user actions:
- Right click on a numeric cell
- Choose Chart Range, Column, Grouped (actually, none of the charting options work...)
I get No data available to be charted.
This works fine in the demo (https://www.ag-grid.com/example.php), but not in my application. What do I need to do to get the data to be displayed in the chart?
I am using the Flask web application framework to host my Python code. Here is my HTML/JavaScript code:
agpoc.html:
<!DOCTYPE html>
<html lang="en">
<head>
<script src="{{url_for('static', filename='ag-grid-enterprise.js')}}"></script>
<script src="{{url_for('static', filename='agpoc.js')}}"></script>
</head>
<body>
<div id="salesGrid" style="height: 200px; width:500px;" class="ag-theme-balham"></div>
</body>
</html>
agpoc.js:
document.addEventListener('DOMContentLoaded', function() {
var gridDiv = document.querySelector('#salesGrid');
new agGrid.Grid(gridDiv, gridOptions);
});
var columnDefs = [
{headerName: "brand", field: "brand"},
{headerName: "sales", field: "sales", type: "numericColumn"}
];
var rowData = [
{"brand": "Brand X", "sales": "270.12"},
{"brand": "Brand Y", "sales": "400.89"}
];
var gridOptions = {
columnDefs: columnDefs,
rowData: rowData,
enableCharts: true,
enableRangeSelection: true,
};
I have debugged this and it appears that the following code within ag-grid-enterprise.js:
ChartDataModel.prototype.getSelectedValueColState()
returns an empty list. I do not understand what example.js is doing that I am not doing wrt this behavior.
Does anyone have any pointers?
Thank you