# Spotfire Functions – Lines & Curves – Curve Draw

• Would you like to know more about how to use the curve draw function?
• Would you like to create your own decline curve in Spotfire?

As promised, this week’s post will discuss Curve Draw, one of the four Lines & Curves features showcased last week, but only at a high level.  This week, I’ll go a bit deeper into Curve Draw starting with an example to show how it works, and then I’ll move on to a more functional example.

To recap from last week, curve draw will plot a line based on an equation specified by the user where y is a function of x.  In the example below, I am plotting a line that is 2 * x.

Things to know about curve draw

• Users may employ functions and properties in the expression.  This is slightly counter intuitive because the dialog provides a list of functions but not a list of properties.  The user must know the syntax and property control name.  Just make sure the Status: line says OK as shown here.
• Users cannot employ columns of data from the data table.
• The user must enter all operators.  Expressions such as 2x are not valid.
• Curve Draw is plotting based on an expression.  If x is utilized, then filtering is taken into consideration because there won’t be any values on the x axis that have been filtered out.

Here is an example of the Curve Draw being used with the simple expression y = 2*x.  Y is very clearly a function of x.

Here is an example of the log function being used to draw lines.   The expression is provided as a label in the visualization.

Now that I’ve explained what Curve Draw does, let’s look at another example.

In the screen shot below, I have created three input property controls named Qi, Di and bfactor that will be the inputs into a hyperbolic decline curve.  I used the Curve Draw function with the expression shown below to calculate the decline.  The expression is referencing the property controls using the syntax \${PropertyName}.  Note that the expression uses the x axis value, which is time in number of months.  Also notice that there are two parts to the expression, which I have indicated with different colors.  The only difference between them is that the first part is looking at x and the second part is looking at x-1, so the calculation is subtracting the result of month 2 from the result of month 1 and so on.

\${Qi}/((1-\${bfactor})*\${Di})*(1-((1+\${bfactor}*\${Di}*x)^(1-1/\${bfactor}))) – \${Qi}/((1-\${bfactor})*\${Di})*(1-((1+\${bfactor}*\${Di}*(x-1))^(1-1/\${bfactor})))

Next week I will discuss Curve from Data Table.

### 10 thoughts on “Spotfire Functions – Lines & Curves – Curve Draw”

Is there any way to reset the position of label for draw line and curve label?

Is there are way to terminate the line at a 0,0 origin position? For instance, creating a custom axis?

There is a way to do that. Someone asked me that in one of the first weeks I ever worked support. I will have to dig to find that answer though.

Do you want to terminate a curve draw line specifically?