我该如何使用图表工具提示格式化程序?我正在使用反应包装器来进行高级图表.
我有这样的配置:
const CHART_CONFIG = {
...
tooltip:
{
formatter: (tooltip) => {
var s = '<b>' + this.x + '</b>';
_.each(this.points, () => {
s += '<br/>' + this.series.name + ': ' + this.y + 'm';
});
return s;
},
shared: true
},
...
}
Run Code Online (Sandbox Code Playgroud)
但我无法使用此关键字访问图表范围,也无法从工具提示参数中获取信息.谢谢
我有外部目录common,我想将该目录中的 react 组件导入到web-static. 在web-static我使用 nextjs。
目前我有这个错误:
Module not found: Can't resolve 'react' in '/Users/jakub/Sites/WORK/wilio-web-common/common/src/@vendor/atoms'
我将这些行添加到next.config.js:
const babeRule = config.module.rules[babelRuleIndex];
if (babeRule && babeRule.test) {
babeRule.test = /\.(web\.)?(tsx|ts|js|mjs|jsx)$/;
if (babeRule.include) {
babeRule.include = [
...babeRule.include,
resolve(__dirname, "../common/src/@vendor"),
];
}
}
Run Code Online (Sandbox Code Playgroud)
config.resolve.alias = {
...config.resolve.alias,
"@vendor": resolve(__dirname, "../common/src/@vendor")
};
Run Code Online (Sandbox Code Playgroud)
我的tsconfig.json文件:
"paths": {
"@vendor/*": ["../common/src/@vendor/*"]
}
Run Code Online (Sandbox Code Playgroud)
Webpack 可以解析这些组件,但无法解析这些组件中已安装的包。
../common/src/@vendor/atoms/Test.js
Module not found: Can't resolve 'react' in '/Users/user1/Sites/WORK/web-app/common/src/@vendor/atoms'
Run Code Online (Sandbox Code Playgroud)
我还需要在 webpacks 中包含这个目录config.externals吗?当前的 nextjs …