ag-grid - 当您使用 refreshCells 重新生成图表时,更改 Ag-Grid 中的字幕会做出反应
问题描述
我正在使用 Ag-Grid React,我是新手。我有一个下拉菜单,允许您通过 refreshCells 函数切换到从 AWS 调用的不同数据集到折线图中。当您从下拉列表中选择某些内容时,图表会刷新良好,但我还想更改折线图的副标题以匹配被拉取的数据(选定的下拉值)。这可能与页面初始加载后的 refreshCells 函数有关吗?
解决方案
在定义您的gridOptions
对象时定义processChartOptions
如下所示。
每当由于基础数据的变化而重绘图表时,都会调用此方法。您可以使用 params 对象动态设置标题/副标题值。
function processChartOptions(params) {
var options = params.options;
console.log('chart options:', options);
options.title.enabled = true;
options.title.text = 'your title here';
options.title.fontStyle = 'italic';
options.title.fontWeight = '600';
options.title.fontSize = 18;
options.title.fontFamily = 'Impact, sans-serif';
options.title.color = '#414182';
options.subtitle.enabled = true;
options.subtitle.text = 'your subtitle here';
options.subtitle.fontSize = 14;
options.subtitle.fontFamily = 'Monaco, monospace';
options.subtitle.color = 'rgb(100, 100, 100)';
return options;
}
这是一个演示。
推荐阅读
- python-3.x - 通过 Xarray 保存 NetCDF,尺寸由两个坐标给出
- kubernetes - kubectl exec 错误拨号后端:x509:证书由未知机构签名
- r - 用列的平均值计算数据虹膜
- python - 区间 [0,360] 中两个向量之间的角度
- python-3.x - 无法使用 PyPDF2 在 jupyter notebook 上打开我的 pdf 文件
- r - 计算R中Tobit的虚拟边际效应(及其标准误差)
- magento2 - 自动重新索引后无法应用 Magento 2 目录规则
- c# - 如何简单地添加两位小数并四舍五入到最接近的两位小数?
- python - 在 PCA 中获取两个以上特征值时出错
- php - 如何在 php 中使用 json decode 从数据库中获取数据并显示如下结果?