Business Intelligence Tools

Spotfire Functions – Lines & Curves – Curve from Data Table

  • Would you like to know what Curve from Data Table is used for?
  • Would you like to understand how Curve from Data Table is different from Curve Draw?

Last week’s post focused on Curve Draw, and this week’s post will look at Curve Draw from Data Table.  The two functions are very similar, and I’m not really why TIBCO has chosen to split them out as two separate functions.

To review…

  • Both Curve Draw and Curve from Data Table will plot a line based on an equation specified by the user where y is a function of x.
  • Both will take into account filtering because they are plotting based on what is on the x axis, which is controlled by filtering.
  • Both will allow the user to reference functions and document properties, even though a list of properties is not presented as is customary in the Custom Expression dialog.  For example, the end of the Curve Draw post showed the user how to create a hyperbolic decline using Curve Draw.  The exact same result can be generated with Curve Draw from Data Table.  In the screen shot below, you can see I have added that decline via both features.  I copied and pasted the exact same expression when using Curve Draw and Curve from Data Table.


  • The key difference between Curve Draw and Curve from Data Table is that Curve Draw does not allow the user to reference table columns, and Curve Draw from Data Table does.
  • This difference is clearly evidenced by the difference in the menus.  Curve from Data Table has two dialogs.  The first asks the user to specify the data table, and then after clicking on the Edit button to edit the expression, another dialog is presented with a list of the data columns in specified table.  The second dialog shown is the exact same dialog seen in Curve Draw.

dialog-1 dialog-2

  • Lastly, because users can place data on a visualization from any table, relations may become important with Curve from Data Table.

I’m going to start out with a simple example so that you can see and understand exactly what the function does, and then we’ll go into a more details.  I generally try to provide oil and gas examples, but I don’t have a good use case.  I surveyed a few folks, and they all had use cases for Curve Draw, but not Curve from Data Table, so here we go, but you will get a good understand for what the function itself does.

In the screen shot below, you will see the production profile for a well in a line chart.  Above the line chart there is a very small table called Targets.  To the right of the Targets table is a text area with an input property control.  The idea was to put the two targets on the visualization and then, via expression, be able to move the targets based on the input.  For example, the targets shown are 120% of the values in the Targets table because the Target input is set to 1.2 and the expression in the Curve from Data Table is [Targets] * ${Range}.  The targets will move upward or downward if the input is changed.


dialog-1 dialog-2

Although this is a very simple example, there are a few key take aways.

  • Most importantly, there are two lines on the visualization because there are two targets (i.e. two rows) in the Targets table.  Thus, if my table had more rows, there would be more lines.  All Curve from Data Table is doing is passing values through to the expression.  This is also a warning…It’s very easy to create something messy with Curve from Data Table.
  • The line chart visualization was created from a completely different table (called Production Table), but I was still able to reference the Targets table on the visualization.

In the next set of examples, we are going to use a different data set entirely.  This data set is shown in the bottom left of the screen shot below.  The table is called Age & Max Heart rate, and it shows the age, observed max heart rate and gender for 14 people.  In the top left of the screen shot, I have copied information on the two most common max heart rate calculations.  We will use the second expression shown (206.9 – (.67 * Age)) to see how our sample group falls within the max for their age.  In order to perform this analysis, I created two visualizations with different Curve from Data Table expressions in order to demonstrate how the function can be used.  I also threw in a property control called HRFormulaInput that could be used to change the value at the beginning of the equation, just to show how moving parts can be incorporated.


The difference between the two visualizations is what is on the x axis.  One has Age and the other has Gender.  The bottom most visualization shown in the screenshot below has Age on the x axis.  Because Age is a continuous variable, we can reference it in our expression.  The expression isn’t referencing any columns of data, and the result is a single line.  The Curve from Data Table is simply finding a value for y based on the expression and the values of x on the visualization.


In the top most visualization, Gender is on the x axis rather than Age.  Because Gender is categorical rather than continuous, I can’t use it in my equation, but I can use the Age column in the expression.  The result is very different.  The result has 14 lines because there are 14 ages in the data table.  In the end, this is a bit messy and hard to understand.


Lastly, I wanted to show one more way to work with Curve from Data Table.  As mentioned earlier, Curve from Data Table is simply a way to pass values through to an expression.  Thus, rather hard code 206.9 or 220 into the expression, they can also be referenced from a table as shown in the screenshot below.


In conclusion, Curve from Data table is a way for the user to apply an expression to a visualization.  With Curve from Data Table, the user can reference functions, properties and columns of data.  When referencing columns of data, there will be as many lines as values in the column.

If you have any oil and gas use cases for Curve from Data Table, I’d been happy to hear/showcase them.  Next week I will cover Line from Data Table.

7 thoughts on “Spotfire Functions – Lines & Curves – Curve from Data Table

  1. Pingback: Missing Options in Lines & Curves • The Analytics Corner

  2. Naresh Reply


    Can we apply differentiate line labels by applying different colors, I know we can apply different colors for line but I want to apply colors for labels as well.

    Thanks in advance!

  3. Julie sebby Reply

    Hi Naresh,
    You can’t change label colors out of the box. If it’s possible, it would be done with CSS. HOWEVER, even with CSS you can probably only change the color of all labels, not individual labels.

  4. Manu Ujjwal Reply

    I have fitted Linear regression lines cross a category (well wise – watercut vs time plots) and wish to see the slope of the fit in a bar chart or a table. Is that possible? I can currently see this only through the watercut vs time plot for each well using trellis.

    • Julie Sebby Post authorReply

      I believe you can do this by extracting the data from the curve, putting it into a new table using IronPython or TERR, and then calculating the slope. I thought I had a posting on how to do this because I’ve definitely needed to do something similar, but I can’t find it. You might start with this — Once you have the values, you can calculate the slope.

    • Julie Sebby Post authorReply

      I found my solution for this. I used an IronPython script to extract data from the curve into a table. That can then be used on the bar chart. Here is the code for logistic regression. Just modify for your curve type. I believe that I used the link I posted above as a guide and then developed this.

      from Spotfire.Dxp.Application.Visuals import ScatterPlot, FittingModels
      source = scatterPlot.FittingModels[0].GetResultsDataSource()
      if Document.Data.Tables.Contains(“Logistic Regression Curve Extraction”):
      table=Document.Data.Tables[“Logistic Regression Curve Extraction”]
      Document.Data.Tables.Add(“Logistic Regression Curve Extraction”, source)

  5. Stephen Reply

    This is probably outside of lines and curves…I have daily production data for a few years and another set of production data sampled monthly. I want to sample the daily production data and apply it to the trend in my monthly dataset. So, where I don’t have data for my monthly set, it will follow the daily produciton data.

    I tried to calculate a curve from the data table to fit a curve to the trend, because it’s not a simple exponential, polynomial or power curve. However, it caluclated a series of horizontal lines for every value in the daily production column.

Leave a Reply

Your email address will not be published. Required fields are marked *