【问题标题】:Python CGI script to show Google scatter chart with known trendline用于显示具有已知趋势线的 Google 散点图的 Python CGI 脚本
【发布时间】:2013-09-16 22:19:17
【问题描述】:

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

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

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

【问题讨论】:

    标签: google-visualization trendline


    【解决方案1】:

    使用 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
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-07-04
      • 1970-01-01
      • 2016-07-31
      • 1970-01-01
      • 2014-12-14
      • 2021-06-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多