在 BIRT 中绘制线性回归线

时间:2021-03-16 06:09:57

标签: sql sql-server birt

我正在尝试在 BIRT 中绘制一条直线。我有这样的数据:

enter image description here

在另一个查询中,我得到了斜率和截距值。

enter image description here

如果我使用两个不同的数据集(一个在 open 方法中,一个在 fetch 方法中),我会得到一个这样的表:

enter image description here

但是这个结果集实际上并没有画一条直线。这是我用来获取斜率和截距的查询。

select slope, (y_bar_max - x_bar_max * slope) as intercept  
 from ( 
        select  sum((delta - x_bar) * (reading - y_bar)) / sum((delta - x_bar) * (delta - x_bar)) as slope, 
                max(x_bar) as x_bar_max, max(y_bar) as y_bar_max 
        from ( 
                select  m2.delta, avg(m2.delta) over () as x_bar,m2.reading, avg(m2.reading) over () as y_bar  
                from METERREADING m2  where m2.assetnum ='ACOE-104' 
        ) as slope  
 ) as interslope;

我在想,如果我们得到这样的数据,我们可以画一条线。

enter image description here

我不明白我们如何做到这一点。有没有办法在 SQL 或 BIRT 中得到这个?提前致谢。

0 个答案:

没有答案