-
Notifications
You must be signed in to change notification settings - Fork 601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🥰 [FEATURE] 回归散点图增加显示拟合函数的配置项 #3474
Comments
@Cuiyansong 在 G2 中这么做还是挺合理的,到 G2Plot 中,也有相关的 demo。你不确定是否合理的是指什么? |
我期望的需求是在图形上显示出回归函数的方程式,回归方程式是从运算的函数中获取的,而不是在“外部自定义”或者如G2的示例中的“写死的/固定的”一个方程式。 不确定是否合理的是:在G2Plot中扩展RegressionLine配置参数,例如增加项{ showEquation: boolean }, 如果为true的话,则显示的效果类似上面的EChart的现实方式(红框内的方程式) 注释:
|
再次确认下,目前在G2Plot中无法显示上图中红框内的方程式吧? |
参考了源码的adaptor.ts中的regressionLine函数,大体改造思路如下: step1: 开启显示 regressionLine: {
showEquation: true
} step2: 改造util.ts中的getPath方法,增加equation值返回 |
@Cuiyansong 👍🏻 你的思路是对的,应该是需要内置一个文本,显示公式的,以及公式文本的样式。有兴趣来 PR 吗? |
可以试试 |
@hustcc 您好,已经提交了一个PR,方便的时候帮忙Review一下,不足的地方在补齐。 |
🥰 Features description [Please make everyone to understand it]
希望如ECharts回归散点图一样,允许展示回归后的函数方程式(例如下图红框中的内容),进而判断回归参考线是否有意义。
🏞 What problem does this feature solve
🧐 What does the proposed API look like
最终可能实现的样式基本可以参考G2的示例,唯一需要开发的从regression函数(如d3-regression中的out值)中获取不同回归函数的方程式替代G2示例中的label.text中的内容,这样是否合理?
🚑 Any additional [like screenshots]
ECharts示例参考:

The text was updated successfully, but these errors were encountered: