0

我正在尝试使 Python CGI 脚本显示带有线性趋势线的 Google ScatterChart,我可以在其他地方使用其方程。ScatterChart 趋势线选项绘制趋势线,我可以通过将指针放在趋势线上来找出线的方程,但这没有帮助,因为我需要以编程方式从方程中获取系数。

我能想到的一种解决方案是编写一个函数来计算趋势线并将其显示在 ScatterChart 的顶部。这里的问题是我不知道如何制作一个谷歌图表,它有两个不同的数据系列(一个系列作为点,另一个作为一条线)。

一个混合解决方案是使用我的函数来计算趋势线,这样我的程序中就有了方程,然后用它自己的谷歌生成的趋势线显示图表。这里的问题是,我知道制作线性趋势线的方法不止一种,但我不知道 Google 使用哪种方式。

4

1 回答 1

0

使用 series..lineWidth 选项使一个系列用连接线绘制:

series: {
    0: {
        // scatter series
        lineWidth: 0
    },
    1: {
        // trendline
        lineWidth: 1,
        // control the point size of the trendline
        pointSize: 0,
        // set this if you don't want the points on the trendline to spawn tooltips
        enableInteractivity: false,
        // set this to remove the trendline from the legend
        visibleInLegend: false
    }
}
于 2013-09-12T18:50:01.443 回答