Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a scatter-plot with the following properties:
Dimension: Cofely.Id (Recno())
x-expression: Avg({TW1 <Cofely.Temperature ={">=$(=Min(Cofely.Temperature)) <=$(=max(Cofely.Temperature))"}>}Cofely.Temperature )
y-expression: Avg({TW1}($(vActiveUnitField)))
vActiveUnitField is a variable which can hold the following fields: Cofely.GasInm3, Cofely.GasInkWh or Cofely.GasInMJ
To get a regressionline I selected the Linear checkbox under trendlines. That works well. However, I want to be able to turn the regression line on or off according to a checkbox that is checked. It seems like it is not possible to add a condition to the regression line. I know that there's an option under the Presentation-tab of the chart properties to add a reference line. This means that I must give the formula of the line. The line has the following defenition: y = mx + b.
I learned (with the help of the community) that m and b can be calculated with the LINEST functions. The values are as follows:
m: LINEST_M(aggr(NODISTINCT Avg({TW1}($(vActiveUnitField))),Cofely.Id),aggr(NODISTINCT Avg({TW1}Cofely.Temperature),Cofely.Id))
b: LINEST_B(aggr(NODISTINCT Avg({TW1}($(vActiveUnitField))),Cofely.Id),aggr(NODISTINCT Avg({TW1}Cofely.Temperature),Cofely.Id))
What would be the appropriate expression/value for x?
As far as I know the reference lines you can add on the Presentation tab can only be horizontal or vertical (depending on the axis you select). You'll have to add your reference line as an expression. Unfortunately that's not possible in a scatter chart. And trying to create a line chart and overlay it on the scatter chart so it display just right is going to be very very difficult. Probably the easiest solution is to create two scatter charts, one with the reference line and one without and show/hide the right one as needed.
As far as I know the reference lines you can add on the Presentation tab can only be horizontal or vertical (depending on the axis you select). You'll have to add your reference line as an expression. Unfortunately that's not possible in a scatter chart. And trying to create a line chart and overlay it on the scatter chart so it display just right is going to be very very difficult. Probably the easiest solution is to create two scatter charts, one with the reference line and one without and show/hide the right one as needed.