Julie Schellberg 3 Posted July 8, 2015 Share Posted July 8, 2015 In the attached screen shot, I have two visualizations. The first visualization shows the sum of Adjusted Cum Production in MBOE/1000 FT using Color/Line by Lease. I also have a Line from Column Values on on the plot represented by the black dashed line. The x axis isc.Producing Months, which is a calculated column representing the number of months a well has been on production. This visualization works, but I would like to add an average line to the plot that is the average of Adjusted Cum Production MBOE/1000 FT for only the wells I have filtered to. I know that I need to write the average formula on the y axis so it only uses the wells I have filtered to. I also know that to make that visualization work, I need a hierarchy on my x axis. The second visualization includes an average line as I have described, but I have lost the line from column values because Spotfire won't let me make the x axis continuous. With the hierarchy, it appears that it is forcing it to be categorical. Is there anyway to get around this Again, what I am trying to create is something similiar to the top visualization but with the addition of an average line that is just the average for the filtered wells. Thank you! Link to comment Share on other sites More sharing options...
Manoj Chaurasia Posted July 21, 2015 Share Posted July 21, 2015 Write an R or TERR script to average the filtered data and output the results to another data table to be used in line from column values. Register that script as a data function in the library or embed it in the dxp. The input and outputs need to be mapped in the data function but once setup the avg line will update as the filters are changed. Link to comment Share on other sites More sharing options...
christopher sawtelle 2 Posted October 23, 2015 Share Posted October 23, 2015 Just did something similar. See if this might work by adding it via custom expression on the Y. I am using regular production date on the x. This reacts to filtering and to changing the date range. I used this on a combo chart to get a line that is the average over time for a particular set of bars. The first half of the expression just gives the sum for a bar on the chart. The second half after the "," is for the average which is a line. Sum([Chem Costs / Monthly BOE-6]) as [Chem Costs / Monthly BOE-6], Sum([Chem Costs / Monthly BOE-6]) THEN Avg([Value]) OVER (all([Axis.X])) as [Avg Chem/BOE] Link to comment Share on other sites More sharing options...
Julie Schellberg 3 Posted October 23, 2015 Author Share Posted October 23, 2015 That's not quite what we want because the average line needs to change each month. The lines in your screen shot appear to be one average for the data set. Link to comment Share on other sites More sharing options...
Julie Schellberg 3 Posted October 23, 2015 Author Share Posted October 23, 2015 Also, when I try to write the expression, I don't have Axis.X as an option. Link to comment Share on other sites More sharing options...
christopher sawtelle 2 Posted October 23, 2015 Share Posted October 23, 2015 Wasn't sure if It would work. I did want an average of a particular value over time. The values I am using are not cumulative. Did you remove the hierarchy to see if axis.x would be available Link to comment Share on other sites More sharing options...
Stephen Grant Posted October 23, 2015 Share Posted October 23, 2015 I have done this a couple of ways. In order of usefulness:. 1) Use a data function for the avg to create a table for line from column values 2) Use a property control for filtering then use the property in a calculated column using an over statement. It works but might not interact with the chart for your desired outcome.3) Create a TERR expression function to use as a custom expression. I haven't tried the 3rd but it should work as well as #1. Link to comment Share on other sites More sharing options...
thad andrews 2 Posted October 23, 2015 Share Posted October 23, 2015 I'm trying to figure out how to do this as well for a Cum Time plot. Can you explain the data function example. Link to comment Share on other sites More sharing options...
Richard Lake 4 Posted May 5, 2016 Share Posted May 5, 2016 Register Data Function Call it what you want. Checking "Allow caching" In script box paste: # organize the inputs into a dataframe # substitute Oil, Lease, ProdDate with names of your base matching columns (don't use aggregated production columns here) data = data.frame(Oil, Lease, ProdDate) # Get rid of downtime days data = data[data$Oil>0,] if(nrow(data) == 0) { Results Table Now Edit Parameters: Input Tab Check Refresh function automatically For each Oil, Lease and ProdDate select Column in theInput Handler and point to respective table and column, also Limit by: Your filter scheme or select a marked rows filter MonthsBin should just be a DocumentProperty slider or input field which for averaging month to month you would select or input 1 Output Tab Create New Data Table nameit "Results" (after you run script and the table is created, you'll want to change to replace existing data table, select Results table. Now you go to lines&curves on graph and ass line from column values and select Results Table and months on x axis and Oil on Y axis and it should appear and be interactive. Link to comment Share on other sites More sharing options...
Diane Seidel Posted May 1, 2020 Share Posted May 1, 2020 I have basically the same issue. Surprised this has never been addressed. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now